Commit Graph

839860 Commits

Author SHA1 Message Date
David Wu
fa48ce6f4b net: ethernet: stmmac: dwmac-rk: Add gmac support for rk1808
Add constants and callback functions for the dwmac on rk1808 soc.
As can be seen, the base structure is the same, only registers
and the bits in them moved slightly.

Change-Id: I39a75b89cd17331bb4373b9b249ae206e1420e71
Signed-off-by: David Wu <david.wu@rock-chips.com>
2019-04-04 18:13:10 +08:00
David Wu
e178f7fa48 ethernet: stmmac: dwmac-rk: Add MAC driver support for rk3308
Add constants and callback functions for the dwmac on rk3308 soc.
The base structure is the same, but registers and the bits in
them moved slightly, and add the clk_mac_speed for the select
of mac speed.

Change-Id: Ieaea3ade9e51d5118f0eb855d8e02febfb2275d1
Signed-off-by: David Wu <david.wu@rock-chips.com>
2019-04-04 18:13:02 +08:00
David Wu
4abe2873ce ethernet: stmmac: rockchip: Fix the correct clock for mdc divider
The MDC clock is divider from APB Clock for rockchip's socs, if it
was from mac_clk, the mdc clk range might not be between the frequency
range 1.0 MHz - 2.5 MHz.

Change-Id: I4e4fcb1be239a8d78a39fc1f4e2af5bb87258798
Signed-off-by: David Wu <david.wu@rock-chips.com>
2019-04-04 18:12:54 +08:00
Zhangbin Tong
c2a7dbb9c7 net: stmmac: dwmac-rk: read mac address from devinfo first
Change-Id: I2888dcfc57c2e5a266fdf1058f9ab70e04034f22
Signed-off-by: Zhangbin Tong <zebulun.tong@rock-chips.com>
2019-04-04 18:12:46 +08:00
David Wu
fa3b8e0c40 net: stmmac: The netif_device_attach() should be called after napi_enable()
If the netif_device_attach() is called earlier, the state of dev_queue is
waked, txtimer might be modified, and the txtimer is added at same time.
It might make run_timer_softirq crashed, because the timer is be detached
twice together.

Change-Id: I31dde4e940bddcc36372ca1f4a8313c0389d4e6b
Signed-off-by: David Wu <david.wu@rock-chips.com>
2019-04-04 18:12:37 +08:00
Weiguo Hu
a493c7f14f ethernet: rockchip: get and save eth addr in vendor storage
Change-Id: I83d8bc81ca8d33e6f2575d0d90a3dc5978500a64
Signed-off-by: Weiguo Hu <hwg@rock-chips.com>
2019-04-04 18:12:21 +08:00
Sugar Zhang
46020da40c dmaengine: pl330: _loop_cyclic: fixup loopcnt is too large
This patch fixup dma transfer data lost if loop cnt is larger
than 256.

Change-Id: Id49302cdcc1ac871d03070ce07eaa7653e54408c
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-04-04 18:06:28 +08:00
Sugar Zhang
4e3b147bc1 dmaengine: pl330: _stop: clear interrupt status
This patch kill instructs the DMAC to immediately terminate
execution of a thread. and then clear the interrupt status,
at last, stop generating interrupts for DMA_SEV. to guarantee
the next dma start is clean. otherwise, one interrupt maybe leave
to next start and make some mistake.

we can reporduce the problem as follows:

DMASEV: modify the event-interrupt resource, and if the INTEN sets
function as interrupt, the DMAC will set irq<event_num> HIGH to
generate interrupt. write INTCLR to clear interrupt.

	DMA EXECUTING INSTRUCTS		DMA TERMINATE
		|				|
		|				|
	       ...			      _stop
		|				|
		|			spin_lock_irqsave
	     DMASEV				|
		|				|
		|			    mask INTEN
		|				|
		|			     DMAKILL
		|				|
		|			spin_unlock_irqrestore

in above case, a interrupt was left, and if we unmask INTEN, the DMAC
will set irq<event_num> HIGH to generate interrupt.

to fix this, do as follows:

	DMA EXECUTING INSTRUCTS		DMA TERMINATE
		|				|
		|				|
	       ...			      _stop
		|				|
		|			spin_lock_irqsave
	     DMASEV				|
		|				|
		|			     DMAKILL
		|				|
		|			   clear INTCLR
		|			    mask INTEN
		|				|
		|			spin_unlock_irqrestore

Change-Id: I5d452cad70964c519b53711a292d2d2714b811a1
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-04-04 18:06:28 +08:00
Huibin Hong
c03395df9c dmaengine: pl330: fix bug that chan descdone is null
The pl330 irq may come after terminal chan, and desc is
set null. It can't be avoided by disabling irq, because
other chans use the common irq. If the chan is terminaled,
we needn't call its callback or restart it.

Change-Id: I73201eaa4dbdd09c765129f9f3f41573c73faf73
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2019-04-04 18:06:28 +08:00
Huibin Hong
1b69a6a2e8 dmaengine: pl330: pl330_tasklet init power_down by pch->active
To fix issue like this:
dma-pl330 ff6d0000.dma-controller: pl330_update:1733 Unexpected!
dma-pl330 ff6d0000.dma-controller: DMAC halted!

The root cause is DMA clk is closed when DMA interrupt is
in service. This may happen, as follow:

1. When pl330_terminate_all is called, and set pch->active false,
power_down is true, call pm_runtime_put_autosuspend.
2. Then pl330_tasklet is called, if power_down is also true, call
pm_runtime_put_autosuspend again.
3. DMA is opened again, because the autosuspend is asyn, it may close
the DMA clk. If DMA interrupt is coming, it causes the issue.

Change-Id: Ib1feb508c16afb4bc9ced0c3660f2b6b4a19c068
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2019-04-04 18:06:28 +08:00
Sugar Zhang
6b420297ef dmaengine: pl330: redefine the cyclic transfer
dmaengine_prep_dma_cyclic, to use buf_addr with size buf_len,
generate an interrupt every period_len. But DMA must restart
every period_len, it may be blocked. If i2s use it, it may
cause sound break. Infiniteloop is helpful to solve this
issue. In infiniteloop mode, when DMA transfers all buf_len
data, it goes back to the start of buf_addr and continue to
transfer endless.

Change-Id: Ibbc92c416d0a9dd58633e7991176c86300c3da98
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-04-04 18:06:28 +08:00
Shuyu Wei
789095fa46 FROMLIST: net: arc/emac: Move arc_emac_tx_clean() into arc_emac_tx() and disable tx interrut
Doing tx_clean() inside poll() may scramble the tx ring buffer if
tx() is running. This will cause tx to stop working, which can be
reproduced by simultaneously downloading two large files at high speed.

Moving tx_clean() into tx() will prevent this. And tx interrupt is no
longer needed now.

Picked the Shuyu's patch up, the patch is sent on
https://patchwork.kernel.org/patch/8356821/, since that make sense for
rockchip platform.
Note: Many people feedback the cransh problems with rk3036/rk3188 emac when
download the heavy loading and this patch is indeed can fix the crash.

The crash log as the followings:
...
[ 2191.996127 ] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc6 #114
[ 2192.002475 ] Hardware name: Rockchip (Device Tree)
[ 2192.007174 ] Backtrace:
[ 2192.009658 ] [<c00134d4>] (dump_backtrace) from [<c0013680>]
    (show_stack+0x18/0x1c)
[ 2192.017220 ]  r7:c051c4f8 r6:ef463180 r5:c05b7000 r4:00000000
[ 2192.022948 ] [<c0013668>] (show_stack) from [<c0219d90>]
    (dump_stack+0x90/0xa0)
[ 2192.030176 ] [<c0219d00>] (dump_stack) from [<c00b2cd4>]
    (bad_page+0xdc/0x12c)
[ 2192.037302 ]  r5:c059a100 r4:c05f430c
[ 2192.040913 ] [<c00b2bf8>] (bad_page) from [<c00b606c>]
    (get_page_from_freelist+0x388/0x95c)
[ 2192.049166 ]  r9:00000008 r8:ef463180 r7:c051c4d0 r6:00000000
    r5:00000000 r4:c051c4e4
[ 2192.056982 ] [<c00b5ce4>] (get_page_from_freelist) from
[<c00b6880>] (__alloc_pages_nodemask+0xd8/0x8e8)
[ 2192.066362 ]  r10:c001b068 r9:00000000 r8:ee0b02b0 r7:60000113
    r6:00000003 r5:02095220
[ 2192.074254 ]  r4:c05ca1c0
[ 2192.076809 ] [<c00b67a8>] (__alloc_pages_nodemask) from
[<c00b7140>] (__alloc_page_frag+0xb0/0x160)
[ 2192.085757 ]  r10:c001b068 r9:00000000 r8:ee0b02b0 r7:60000113
    r6:02080020 r5:00000740
[ 2192.093650 ]  r4:eedbc884
[ 2192.096207 ] [<c00b7090>] (__alloc_page_frag) from [<c03273b4>]
    (__netdev_alloc_skb+0xa0/0x104)
[ 2192.104806 ]  r7:60000113 r6:eedbc884 r5:ee0b0000 r4:00000740
[ 2192.110525 ] [<c0327314>] (__netdev_alloc_skb) from [<c02aac00>]
    (arc_emac_poll+0x318/0x57c)
[ 2192.118865 ]  r9:00000000 r8:ee0b02b0 r7:0000019c r6:ee163780
    r5:00000670 r4:ee0b0000
[ 2192.126683 ] [<c02aa8e8>] (arc_emac_poll) from [<c0339ed8>]
    (net_rx_action+0x1f0/0x2ec)
[ 2192.134590 ]  r10:c0599df8 r9:c059a100 r8:00073760 r7:0000012c
    r6:00000028 r5:c02aa8e8
[ 2192.142483 ]  r4:ee0b04e0
[ 2192.145040 ] [<c0339ce8>] (net_rx_action) from [<c0026f5c>]
    (__do_softirq+0x134/0x258)
[ 2192.152860 ]  r10:c059a080 r9:40000003 r8:00000003 r7:00000100
    r6:c0598000 r5:c059a08c
[ 2192.160751 ]  r4:00000000
...

Change-Id: Ie7c161809d511bda5d65af7b48fefffff30c07e8
Signed-off-by: Shuyu Wei <sy.w@outlook.com>
Tested-by: Michael Niewoehner <linux@mniewoehner.de>
Tested-by: Xing Zheng <zhengxing@rock-chips.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexander Kochetkov <al.kochet@gmail.com>
Cc: netdev@vger.kernel.org
(am from https://patchwork.kernel.org/patch/9032581/)
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2019-04-04 18:04:56 +08:00
David Wu
906cea2b56 pwm: rockchip: Disable irq for pwm config
Add irq disabled protection at the PWM configuration, which can
speed up the PWM configuration and reduce the possibility of
interrupting the configuration.

Change-Id: I8ca3c4b9790b747c12804fa82b51456a0de7fb92
Signed-off-by: David Wu <david.wu@rock-chips.com>
2019-04-04 18:04:12 +08:00
Sandy Huang
aff06ee422 pwm: rockchip: add pwm en for voppwm
voppwm is frame effect, so we need add vop pwm en to
indicate the pwm en state.

Change-Id: I1492322f99b638c8dc6cf03c87035f28dca3de8f
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-04-04 18:04:12 +08:00
David Wu
7ea176cbc3 pwm: rockchip: fix ioremap failed for voppwm
Change-Id: I3df7e2ee2b8cb24c4c8aad30cf6d55d11adf0573
Signed-off-by: David Wu <david.wu@rock-chips.com>
2019-04-04 18:04:12 +08:00
Mark Yao
ff707b3d8d video: backlight: pwm_bl: fix backlight polarity
Backlight polarity not works without pwm_adjust_config.

Change-Id: I11e5eefe340f758b6721021f13238306b3721270
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2019-04-04 17:58:45 +08:00
David Wu
624648cdc2 video: backlight: pwm_bl: Fix the bug of Splashing screen when boot
The pwm_apply_args() should be removed when switching to the atomic
PWM API. Oherwise, the screen would splashing as the backlight is
disabled once when boot.

Change-Id: I0cadd471db54140192c39b9d7c6a673862e8f8d8
Signed-off-by: David Wu <david.wu@rock-chips.com>
2019-04-04 17:58:39 +08:00
Sandy Huang
a8c3c7858f drm/rockchip: add basic version for linux 4.19 rockchip drm driver
Change-Id: Iba498d40d6f4fea0d446c9a84943ca1ed9ff14de
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-04-04 15:41:54 +08:00
Daniele Castagna
9dd100fafe UPSTREAM: drm/rockchip: Add reflection properties
Add the KMS plane rotation property to the DRM rockchip driver,
for SoCs RK3328, RK3368 and RK3399.

RK3288 only supports rotation at the display level (i.e. CRTC),
but for now we are only interested in plane rotation.

This commit only adds support for the value of reflect-y
and reflect-x (i.e. mirroring).

Note that y-mirroring is not compatible with YUV.

The following modetest commands would test this feature,
where 30 is the plane ID, and 49 = rotate_0 + relect_y + reflect_x.

X mirror:
modetest -s 43@33:1920x1080@XR24 -w 30:rotation:17

Y mirror:
modetest -s 43@33:1920x1080@XR24 -w 30:rotation:33

XY mirror:
modetest -s 43@33:1920x1080@XR24 -w 30:rotation:49

Change-Id: Ibda4ed59be47996a0104288091576f7ab98e710f
Signed-off-by: Daniele Castagna <dcastagna@chromium.org>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190109185639.5093-4-ezequiel@collabora.com
(cherry picked from commit 677e8bbc0e)
2019-04-03 18:02:00 +08:00
Ezequiel Garcia
f7fb6d9c98 UPSTREAM: drm/rockchip: Fix typo in VOP macros argument
Fix a small typo in the macros VOP argument. The macro argument
is currently wrongly named "x", and then never used. The code
built fine almost by accident, as the macros are always used
in a context where a proper "vop" symbol exists.

This fix is almost cosmetic, as the resulting code shouldn't change.

Change-Id: Ic100c20dd988bd850b1d4b3f47d4d1f1f7ef83f3
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190109185639.5093-2-ezequiel@collabora.com
(cherry picked from commit 2996fb75d6)
2019-04-03 17:59:23 +08:00
Daniele Castagna
560dc664f6 UPSTREAM: drm/rockchip: Fix YUV buffers color rendering
Currently, YUV hardware overlays are converted to RGB using
a color space conversion different than BT.601.

The result is that colors of e.g. NV12 buffers don't match
colors of YUV hardware overlays.

In order to fix this, enable YUV2YUV and set appropriate coefficients
for formats such as NV12 to be displayed correctly.

This commit was tested using modetest, gstreamer and chromeos (hardware
accelerated video playback). Before the commit, tests rendering
with NV12 format resulted in colors not displayed correctly.

Test examples (Tested on RK3399 and RK3288 boards
connected to HDMI monitor):

  $ modetest 39@32:1920x1080@NV12
  $ gst-launch-1.0 videotestrc ! video/x-raw,format=NV12 ! kmssink

Change-Id: Ice00c20dd9a8bd850b1d4b3f47d4d1f1f7ef83f3
Signed-off-by: Daniele Castagna <dcastagna@chromium.org>
[ezequiel: rebase on linux-next and massage commit log]
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190108214659.28794-1-ezequiel@collabora.com
(cherry picked from commit 1c21aa8f2b)
2019-04-03 17:55:18 +08:00
Gustavo A. R. Silva
f2f2809287 UPSTREAM: drm/rockchip: Use struct_size() in devm_kzalloc()
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
	int stuff;
        void *entry[];
};

instance = devm_kzalloc(dev, sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

or, like in this particular case:

size = sizeof(struct foo) + sizeof(void *) * count;
instance = devm_kzalloc(dev, size, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = devm_kzalloc(dev, struct_size(instance, entry, count),
GFP_KERNEL);

This issue was detected with the help of Coccinelle.

Change-Id: Ice00c20dd988bd850b1d4b3f47d4d1f1f7ef83fa
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180826184712.GA9330@embeddedor.com
(cherry picked from commit 29adeb4f95)
2019-04-03 17:53:47 +08:00
Mahesh Kumar
d327288a19 UPSTREAM: drm/crc: Cleanup crtc_crc_open function
This patch make changes to allocate crc-entries buffer before
enabling CRC generation.
It moves all the failure check early in the function before setting
the source or memory allocation.
Now set_crc_source takes only two variable inputs, values_cnt we
already gets as part of verify_crc_source.

Changes since V1:
 - refactor code to use single spin lock
Changes since V2:
 - rebase
Changes since V3:
 - rebase on top of VKMS driver

Change-Id: Ice00c20dd988bd850b1d4b3f47d4d1f1f7ef83f6
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Leo Li <sunpeng.li@amd.com> (V2)
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (V3)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180821083858.26275-3-mahesh1.kumar@intel.com
(cherry picked from commit c0811a7d5b)
2019-04-03 17:38:17 +08:00
Mahesh Kumar
93d8cf1baa UPSTREAM: drm/rockchip/crc: Implement verify_crc_source callback
This patch implements "verify_crc_source" callback function for
rockchip drm driver.

Changes since V1:
 - simplify the verification (Jani N)

Change-Id: Ibda4ed59be47996a0104288091576f7ab98e710e
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-4-mahesh1.kumar@intel.com
(cherry picked from commit b8d913c0ee)
2019-04-03 15:33:27 +08:00
Mahesh Kumar
227a1f60df UPSTREAM: drm: crc: Introduce get_crc_sources callback
This patch introduce a callback function "get_crc_sources" which
will be called during read of control node. It is an optional
callback function and if driver implements this callback, driver
should return a constant pointer to an array of crc sources list
and update count according to the number of source in the list.

Changes Since V1: (Daniel)
 - return const pointer to an array of crc sources list
 - do validation of sources in CRC-core
Changes Since V2:
 - update commit message
 - update callback documentation
 - print one source name per line

Change-Id: Ice00c20dd988bd850b1d4b3f47d4d1f1f7ef83f5
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-3-mahesh1.kumar@intel.com
(cherry picked from commit 4396551e9c)
2019-04-03 14:35:28 +08:00
Mahesh Kumar
2966fa2110 UPSTREAM: drm: crc: Introduce verify_crc_source callback
This patch adds a new callback function "verify_crc_source" which will
be used during setting the crc source in control node. This will help
in avoiding setting of wrong string for source.

Changes since V1:
 - do not yet verify_crc_source during open.
Changes since V1:
 - improve callback description

Change-Id: Ice00c20dd988bd850b1d4b3f47d4d1f1f7ef83fe
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180713135942.25061-2-mahesh1.kumar@intel.com
(cherry picked from commit d5cc15a0c6)
2019-04-03 09:19:00 +08:00
Heiko Stuebner
4888311246 UPSTREAM: drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328
The rk3328 uses a dw-hdmi controller with an external hdmi phy from
Innosilicon which uses the generic phy framework for access.
Add the necessary data and the compatible for the rk3328 to the
rockchip dw-hdmi driver.

changes in v5:
- disable CEC_5V option to make CEC actually work (Jonas)
changes in v3:
- reword as suggested by Rob to show that it's a dw-hdmi + Inno phy

Change-Id: Ib2b196d723a29f8aad95f56905a954547bc93e92
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Zheng Yang <zhengyang@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180912124740.20343-7-heiko@sntech.de
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
(cherry picked from commit 1c53ba8f22)
2019-04-01 19:26:22 +08:00
Heiko Stuebner
b84da0d8e3 UPSTREAM: drm/rockchip: dw_hdmi: store rockchip_hdmi reference in phy_data object
When using special phy handling operations we'll often need access to
the rockchip_hdmi struct.

As the chip-data that occupies the phy_data pointer initially gets
assigned to the rockchip_hdmi struct, we can now re-use this phy_data
pointer to hold the reference to the rockchip_hdmi struct and use this
reference later on.

Inspiration for this comes from meson and sunxi dw-hdmi, which are using
the same method.

changes in v3:
- reword commit message

Change-Id: I9c16cb150f4d84f6637f6b20c54d8a3f75fc3360
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Zheng Yang <zhengyang@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180912124740.20343-6-heiko@sntech.de
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
(cherry picked from commit 5c3f3d2239)
2019-04-01 19:25:29 +08:00
Heiko Stuebner
7b8b4f9960 UPSTREAM: drm/rockchip: dw_hdmi: allow including external phys
Some variants of the dw-hdmi on Rockchip socs use a separate phy block
accessed via the generic phy framework, so allow them to be included
if such a phy reference is found.

Change-Id: I4797a4e9a381ffe205cfabd8acaff982ba65a5b3
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Zheng Yang <zhengyang@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180912124740.20343-5-heiko@sntech.de
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
(cherry picked from commit bd1302305a)
2019-04-01 19:24:09 +08:00
Heiko Stuebner
daf13600c7 UPSTREAM: dt-bindings: allow optional phys in Rockchip dw_hdmi binding
Some newer Rockchip SoCs use an Innosilicon hdmiphy accessed via general
mmio, so allow these to be referenced via the regular phy interfaces
and therefore add optional phy-related properties to the binding.

Change-Id: I217cfe622f226094cf8bf9c57865bc4e0e37210a
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180912124740.20343-4-heiko@sntech.de
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
(cherry picked from commit 9f891dbe39)
2019-04-01 19:22:30 +08:00
Heiko Stuebner
d28c45ee34 UPSTREAM: drm/rockchip: dw_hdmi: Allow outputs that don't need output switching
So far we always encountered socs with 2 output crtcs needing the driver
to tell the hdmi block which output to connect to. But there also exist
socs with only one crtc like the rk3228, rk3328 and rk3368.

So adapt the register field to simply carry a negative value to signal
that no output-switching is necessary.

changes in v3:
- fixed wording issue found by Robin Murphy

Change-Id: I368645dd1f07eedb801363ae65824ba876d66560
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Zheng Yang <zhengyang@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180912124740.20343-3-heiko@sntech.de
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
(cherry picked from commit 96c4704fec)
2019-04-01 19:20:18 +08:00
Heiko Stuebner
05cd8bdf2b UPSTREAM: drm/bridge: dw-hdmi: allow forcing vendor phy-type
In some IP implementations the reading of the phy-type may be broken.
One example are the Rockchip rk3228 and rk3328 socs that use a separate
vendor-type phy from Innosilicon but still report the HDMI20_TX type.

So allow the glue driver to force the vendor-phy for these cases.
In the future it may be necessary to allow forcing other types, but
for now we'll keep it simply to the case actually seen in the wild.

changes in v3:
- only allow forcing vendor type, as suggested by Laurent

Change-Id: I0e8587b3451bafc0dd707929c0546ab69d331e11
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Zheng Yang <zhengyang@rock-chips.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180912124740.20343-2-heiko@sntech.de
Link: https://patchwork.freedesktop.org/patch/msgid/20180912124740.20343-3-heiko@sntech.de
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
(cherry picked from commit 8faff37409)
2019-04-01 19:18:09 +08:00
Elaine Zhang
8dee51f53c clk: defer clk_gets on orphan clocks
Orphan clocks or children of orphan clocks don't have rate information at
all and can produce strange results if they're allowed to be used and the
parent becomes available later on.

This change, based on one from Stephen Boyd, defers __clk_create_clk()
calls on orphan clocks in all regular cases.

One special case that gets handled, is accessing such orphan clocks when
handling assigned-clocks configurations. In the boot-defaults it may be
the case that a clock is connected to an orphan parent which then might
be needed to get reparented to an actually usable clock using
assigned-clock-parents. In this case even orphaned clocks should be
usable, but only for the set-parent case.

The added of_clk_get_from_provider_with_orphans() is only available
to ccf internal parts to prevent abuse.

(am from https://patchwork.kernel.org/patch/7690221/)

Change-Id: I2e603dab191fa8a431adebad1f9d482d52b7deeb
Signed-off-by: Heiko Stuebner <heiko.stuebner@collabora.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-04-01 19:03:38 +08:00
Elaine Zhang
8d57e73b0b clk: rockchip: rk3036: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: Ic60f491d549e030490c14ea78f4857a8cead596d
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-04-01 19:03:38 +08:00
Elaine Zhang
e12acd34eb clk: rockchip: rk3128: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: I7f9bc78deef60b1fa48bada5b1a6203185ddce48
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-04-01 19:03:38 +08:00
Elaine Zhang
8ab246e533 clk: rockchip: rv1108: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: Ic4efc985892cbcc5e561203fe8e00dba116439e7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-04-01 19:03:38 +08:00
Elaine Zhang
22543d0656 clk: rockchip: rk3228: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: Ide2c3e8add083934672f6d22d8182bcfde046783
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-04-01 19:03:38 +08:00
Elaine Zhang
cdf4422a4b clk: rockchip: rk3288: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: I86ff4f12ed932431d131d22a307360418e2e9f40
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-04-01 19:03:38 +08:00
Elaine Zhang
909ec389a8 clk: rockchip: rk3368: add cru regs dump for panic
Add cru regs dump when system panic.
It's just for debug.

Change-Id: I3aeeeb7f7b9240c917c18bc2d36b082003dc6370
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-04-01 19:03:38 +08:00
Simon Xue
0a2140ea63 dt-bindings: adc: add description for rk1808 saradc
Change-Id: I047410349c527495f5b414d98054e535fc168524
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-03-31 19:55:26 +08:00
Simon Xue
178388b16a iommu/rockchip: use status register instead of flags as parameter
When iommu fall into interrupt, status register indicate more information
than read or write flag, so use status register as parameter when callback
report_iommu_fault

Change-Id: I07c6b9996f305eb970bd1d1d2b0f2a7db53cc6ba
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-03-31 19:55:18 +08:00
Simon Xue
26d6849bcd dt-bindings: iommu: add disable iommu reset and skip iommu read for rockchip iommu
Change-Id: I3f31f5745078717dfecba649ae6aca573eb7f30b
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-03-31 19:54:54 +08:00
Simon Xue
a9832de3c7 iommu/rockchip: skip read vop iommu registers on rk3128 and rk3126
RK3128 and RK3126 failed to read vop iommu register, it is SoC bug.
Add this patch as a workaround for this bug, make SoC work as normal

Change-Id: I44d4ef7f6e15f85a466563b0b3e8e091db23fba0
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-03-31 19:54:46 +08:00
Simon Xue
327bceb983 drm/rockchip: gem: reorder pages if page chunk less than 8
Change-Id: I03a91d2f9c017086b3cb35edeaf6b7913b147b9b
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-03-31 19:52:27 +08:00
Simon Xue
86d6035248 ion: reorder pages for scatterlist
Change-Id: I3a25eba9d65ac1345471321f61ae9d7a959a1be6
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-03-31 19:52:11 +08:00
Sugar Zhang
03b6c8a591 ASoC: rockchip: spdif: fix some coding style issues
Change-Id: Ibe8edc413df2944464848ba81afdc447edbd405e
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-03-28 22:13:27 +08:00
Sugar Zhang
c7f75167b3 dt-bindings: soc: rockchip: add pmugrf compatible for rv1108 soc
This patch adds pmugrf compatible for rv1108 soc.

Change-Id: I0b2e6fdcbd565ea324e403cddae8b4d56e8a9b46
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-03-28 22:13:27 +08:00
Sugar Zhang
25ee2cd8cd ASoC: rockchip: pdm: Correct PDM_CTRL0 reg value
This patch fix the wrong reg value for rk322x/rk322xh,
cuz there is no STORE JUSTIFIED MODE on it.

on rk322x/rk322xh, the same bit means PDM_MODE/RESERVED,
if the bit is set to RESERVED, the controller will not work.

Change-Id: I9bfc055e792d73a66f51c78c7c2ff5c4cba620ae
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-03-28 22:13:27 +08:00
Sugar Zhang
668b40d40a ASoC: rockchip: pdm: Mark RXFIFO_DATA as volatile and precious
This patch marks RXFIFO_DATA as precious to avoid being read
outside a call from the driver, such as regmap debugfs

Change-Id: Id94a3d6f4ea382fc09547241dabc6ab84ca74139
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-03-28 22:13:27 +08:00
Sugar Zhang
1b33ff5ec1 ASoC: rockchip: spdif: Mark SPDIF_SMPDR as volatile
This patch marks SPDIF_SMPDR as volatile to make it resaonable,
which also requires marking it as readable, even though it isn't.

Change-Id: Ia59136a4d7a9a3984d4f4b2518f835ead7419aec
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2019-03-28 22:13:27 +08:00