Commit graph

605,888 commits

Author SHA1 Message Date
zhangyunlong
1cea76da68 camera: rockchip: camsys driver v0.0x23.0
Change-Id: Ia4f527488f588c3adb6c3ea6cd1be868fe006d14
Signed-off-by: zhangyunlong <dalon.zhang@rock-chips.com>
2018-01-25 10:03:31 +08:00
Frank Wang
62932c7e33 usb: amend ehci no-relinquish-port for rk3288 platform
For the hardware bug of RK3288 OHCI, we use commit cfe6f1dd57
("usb: ehci: add rockchip relinquishing port quirk support") to fix
it previously. However, it have been ineffective after upstream commit
94c43b9897 ("USB: Check for dropped connection before switching to
full speed") was merged due to the condition of relinquishing port was
changed.

This patch adds an additional condition for the previous commit to ensure
no relinquish port quirk can take effect for RK3288 EHCI.

Change-Id: I0630265e101afb349816955e069e1c121745ac08
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2018-01-24 20:02:00 +08:00
Wyon Bi
35cd525521 drm/rockchip: lvds: Add support for PX30
Change-Id: I353e76f1afdac02edd2ec78b5d107d6431c4a7d8
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2018-01-24 15:27:44 +08:00
Wyon Bi
d79a942925 arm64: dts: rockchip: px30: update lvds and dsi node
Change-Id: Ib78c7287e75bbc3ded341a9b44a8531b374b8740
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2018-01-24 11:21:10 +08:00
Zhou weixin
f8eee37712 ARM: dts: rockchip: detect sdcard by gpio for rk312x
if the sdmmc detect with iomux sdmmc_detn will false trigger
once the system into deepsleep

Change-Id: I5928b94327175ee2b39bd0740ea2eafa9d28604d
Signed-off-by: Weixin Zhou <zwx@rock-chips.com>
2018-01-24 11:17:14 +08:00
Tao Huang
117a23131e Revert "asm-generic: fncpy: Add function copying macros"
This reverts commit 49d083bd72.

The patch is part of PIE, we do not need it anymore.

Change-Id: Iedc231105fa18c3cadd2cfd023c451c40570be96
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-01-24 10:58:19 +08:00
Finley Xiao
38cd02b946 clk: rockchip: px30: Add pclk for cif and isp
Change-Id: Ied25f2c6746e7cc233c4c22436f45ba82900631a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-01-24 10:36:56 +08:00
David Wu
f37ae45b20 dt-bindings: clock: px30-cru: Rename the gmac reset
Change-Id: I91976f4f4fe4e8b81a5520a12995c317c16b0190
Signed-off-by: David Wu <david.wu@rock-chips.com>
2018-01-24 09:45:19 +08:00
Xinhuang Li
28b5fdf0f4 ARM: dts: rk322x: add iep and iep_mmu node
Change-Id: I023fd9ca35c605f36555d8e7a4499c59b2573e0c
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com>
2018-01-24 09:24:48 +08:00
Alex Zhao
6b8e6ee695 net: wireless: rockchip_wlan: add WIFI_FEATURE_LINK_LAYER_STATS support
Change-Id: I97334e69270e280f39236eebee7663e08b78d6be
Signed-off-by: Alex Zhao <zzc@rock-chips.com>
2018-01-24 09:23:36 +08:00
Huicong Xu
fe62b85484 phy: rockchip: inno-hdmi: fix hdmi no display sometime wake up
when wake up only power on hdmi phy, it may result in tmds pll unlock
because when in deep suspend, the power maybe no in a normal state.
now reinstall all register when wark up.

Change-Id: Ie882fa9b99bc6f4bfb3b2a6ea88a043b2f89ed58
Signed-off-by: Huicong Xu <xhc@rock-chips.com>
2018-01-23 14:31:02 +08:00
Huicong Xu
bc980e7ce2 phy: rockchip: inno-hdmi: fix hdmi abnormal after set color depth
reinstall hdmi TMDS clock when set color depth between 8bit and 10bit
to fix tmds clock frequency mismatch

Change-Id: I5ac951cd6cc0ac04b595009be7ae250e42290854
Signed-off-by: Huicong Xu <xhc@rock-chips.com>
2018-01-23 14:30:05 +08:00
William Wu
784560b520 usb: dwc2: don't clear mode if already in normal mode
When clear the force mode bits, it needs to wait up to
100 ms to account for any potential IDDIG filter delay.
In the current code, it will call this three times during
probe if dr_mode == OTG. With this patch, we can reduce
it to once. It can help to speed up the DWC2 probe time.

Change-Id: I588042b03b086599e4020c3072653dfb3138fdc1
Signed-off-by: William Wu <william.wu@rock-chips.com>
2018-01-23 14:28:19 +08:00
John Stultz
8fff4c95e6 UPSTREAM: usb: dwc2: Error out of dwc2_hsotg_ep_disable() if we're in host mode
We've found that while in host mode, using Android, if one runs
the command:
  stop adbd

The existing usb devices being utilized in host mode are disconnected.
This is most visible with usb networking devices.

This seems to be due to adbd closing the file:
  /dev/usb-ffs/adb/ep0
Which calls ffs_ep0_release() and the following backtrace:

[<ffffff800875a430>] dwc2_hsotg_ep_disable+0x148/0x150
[<ffffff800875a498>] dwc2_hsotg_udc_stop+0x60/0x110
[<ffffff8008787950>] usb_gadget_remove_driver+0x58/0x78
[<ffffff80087879e4>] usb_gadget_unregister_driver+0x74/0xe8
[<ffffff80087850c0>] unregister_gadget+0x28/0x58
[<ffffff800878511c>] unregister_gadget_item+0x2c/0x40
[<ffffff8008790ea8>] ffs_data_clear+0xe8/0xf8
[<ffffff8008790ed8>] ffs_data_reset+0x20/0x58
[<ffffff8008793218>] ffs_data_closed+0x98/0xe8
[<ffffff80087932d8>] ffs_ep0_release+0x20/0x30

Then when dwc2_hsotg_ep_disable() is called, we call
kill_all_requests() which causes a bunch of the following
messages:

dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
dwc2 f72c0000.usb: Mode Mismatch Interrupt: currently in Host mode
init: Service 'adbd' (pid 1915) killed by signal 9
init: Sending signal 9 to service 'adbd' (pid 1915) process group...
init: Successfully killed process cgroup uid 0 pid 1915 in 0ms
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:15)
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 8 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 12 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 15 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 3 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_hc_chhltd_intr_dma: Channel 4 - ChHltd set, but reason is unknown
dwc2 f72c0000.usb: hcint 0x00000002, intsts 0x04200029
dwc2 f72c0000.usb: dwc2_update_urb_state_abn(): trimming xfer length

And the usb devices connected are basically hung at this point.

It seems like if we're in host mode, we probably shouldn't run
the dwc2_hostg_ep_disable logic, so this patch returns an error
in that case.

With this patch (along with the previous patch in this set), we avoid
the mismatched interrupts and connected usb devices continue to function.

I'm not sure if some other solution would be better here, but this seems
to work, so I wanted to send it out for input on what the right approach
should be.

Change-Id: Iabdcdd0e33dc2009bfa5127971b7c6097a69c98f
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: YongQin Liu <yongqin.liu@linaro.org>
Cc: John Youn <johnyoun@synopsys.com>
Cc: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Chen Yu <chenyu56@huawei.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Tested-by: Minas Harutyunyan <hminas@synopsys.com>
Reported-by: YongQin Liu <yongqin.liu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 9b481092c2)
2018-01-23 14:28:19 +08:00
Heiner Kallweit
3d7b42013a UPSTREAM: usb: dwc2: fix "iomem 0x00000000" message
Set the iomem parameters in the usb_hcd to fix this misleading
message during driver load:
dwc2 c9100000.usb: irq 22, io mem 0x00000000

Conflicts:
        drivers/usb/dwc2/hcd.c

Change-Id: I20cc185d05fe506321d8541ee6df728967d82482
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 348becdcc3)
2018-01-23 14:28:19 +08:00
Chen Yu
b769d292d6 UPSTREAM: usb: dwc2: Force port resume on switching to device mode
We've seen failures when switching between host and gadget mode,
which was diagnosed as being caused due to the bus being
auto-suspended when we switched.

So this patch forces a port resume when switching to device
mode if the bus is suspended.

Change-Id: I6e1023484d5cf7120b7b5836c1fd8476f47cef11
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: John Youn <johnyoun@synopsys.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Chen Yu <chenyu56@huawei.com>
Cc: Vardan Mikayelyan <mvardan@synopsys.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Chen Yu <chenyu56@huawei.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 9156a7ef1c)
2018-01-23 14:28:19 +08:00
John Stultz
17a558fa5e UPSTREAM: usb: dwc2: Workaround case where GOTGCTL state is wrong
When removing a USB-A to USB-otg adapter cable, we get a change status
irq, and then in dwc2_conn_id_status_change, we erroneously see the
GOTGCTL_CONID_B flag set. This causes us to get stuck in the
"while (!dwc2_is_device_mode(hsotg))" loop, spitting out "Waiting for
Peripheral Mode, Mode=Host" warnings until it fails out many seconds
later.

This patch works around the issue by re-reading the GOTGCTL state to
check if the GOTGCTL_CONID_B is still set and if not restarting the
change status logic.

Change-Id: If75fea4e81d40413dca696750873ba7e51d6b105
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: John Youn <johnyoun@synopsys.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Chen Yu <chenyu56@huawei.com>
Cc: Vardan Mikayelyan <mvardan@synopsys.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Reviewed-by: Vardan Mikayelyan <mvardan@synopsys.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit fc30c4bb44)
2018-01-23 14:28:19 +08:00
John Stultz
a875efed49 UPSTREAM: usb: dwc2: Avoid sleeping while holding hsotg->lock
Basically when plugging in various cables in different orders, I'm
occasionally seeing the following BUG splat:

[   86.215403] BUG: scheduling while atomic: kworker/u16:2/53/0x00000002
[   86.219164] usb 1-1: USB disconnect, device number 9
[   86.226845] Preemption disabled at:[   86.230218]
[<ffffff8008673558>] dwc2_conn_id_status_change+0x120/0x250
[   86.236894] CPU: 0 PID: 53 Comm: kworker/u16:2 Tainted: G        W
     4.9.0-rc8-00051-gd5a7979-dirty #1702
[   86.246836] Hardware name: HiKey Development Board (DT)
[   86.252100] Workqueue: dwc2 dwc2_conn_id_status_change
[   86.257279] Call trace:
[   86.259771] [<ffffff8008087c28>] dump_backtrace+0x0/0x1a0
[   86.265210] [<ffffff8008087ddc>] show_stack+0x14/0x20
[   86.270308] [<ffffff80084343f0>] dump_stack+0x90/0xb0
[   86.275401] [<ffffff80080d8d94>] __schedule_bug+0x6c/0xb8
[   86.280841] [<ffffff8008a07220>] __schedule+0x4f8/0x5b0
[   86.286099] [<ffffff8008a073e8>] schedule+0x38/0xa0
[   86.291017] [<ffffff8008a0a6cc>] schedule_hrtimeout_range_clock+0x8c/0xf0
[   86.297846] [<ffffff8008a0a740>] schedule_hrtimeout_range+0x10/0x18
[   86.304150] [<ffffff8008a0a4a0>] usleep_range+0x50/0x58
[   86.309418] [<ffffff800866d8dc>] dwc2_wait_for_mode.isra.4+0x54/0xd0
[   86.315815] [<ffffff800866f058>] dwc2_core_reset+0xe0/0x168
[   86.321431] [<ffffff800867e364>] dwc2_hsotg_core_init_disconnected+0x2c/0x310
[   86.328602] [<ffffff8008673568>] dwc2_conn_id_status_change+0x130/0x250
[   86.335254] [<ffffff80080ccd48>] process_one_work+0x118/0x370
[   86.341035] [<ffffff80080ccfe8>] worker_thread+0x48/0x498
[   86.346473] [<ffffff80080d2eb0>] kthread+0xd0/0xe8
[   86.351299] [<ffffff8008082e80>] ret_from_fork+0x10/0x50

This seems to be caused by the dwc2_wait_for_mode() calling
usleep_range() while the hstog->lock spinlock is held, since
we take that before calling dwc2_hsotg_core_init_disconnected().

This patch avoids the issue by adding an extra argument to
dwc2_core_reset(), as suggested by John Youn, which allows us to
skip the waiting, which should be unnecessary when calling from
dwc2_hsotg_core_init_disconnected().

Change-Id: Idd6ca776e7a503f3415cdaa8864ef05927b067dd
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: John Youn <johnyoun@synopsys.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Chen Yu <chenyu56@huawei.com>
Cc: Vardan Mikayelyan <mvardan@synopsys.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 6e6360b67d)
2018-01-23 14:28:19 +08:00
Nicholas Mc Guire
569e50e592 UPSTREAM: usb: dwc2: host: use msleep() for long delays
ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. Fix up the 20+ ms delays here passing the adjusted "min"
value to msleep(). This helps reduce the load on the hrtimer subsystem.

Change-Id: I11c79f5796c2ef86765cf724c95bdb717775e054
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 04a9db7992)
2018-01-23 14:28:19 +08:00
Nicholas Mc Guire
eeaee633c5 UPSTREAM: usb: dwc2: host: fix Wmaybe-uninitialized warning
Uninitialized char* causes a sparse build-warning, fix it up by
initializing it to NULL.

Change-Id: I1908e251c1af10ef5ec0a69988b6e9251d59006e
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit efe357f463)
2018-01-23 14:28:19 +08:00
Amelie Delaunay
ce2975094d UPSTREAM: usb: dwc2: gadget: Fix GUSBCFG.USBTRDTIM value
USBTrdTim must be programmed to 0x5 when phy has a UTMI+ 16-bit wide
interface or 0x9 when it has a 8-bit wide interface.
GUSBCFG reset value (Value After Reset: 0x1400) sets USBTrdTim to 0x5.
In case of 8-bit UTMI+, without clearing GUSBCFG.USBTRDTIM mask, USBTrdTim
results in 0xD (0x5 | 0x9).
That's why we need to clear GUSBCFG.USBTRDTIM mask before setting USBTrdTim
value, to ensure USBTrdTim is correctly set in case of 8-bit UTMI+.

Change-Id: If5a0c92b03fa51ead559fbf3be52cade404f5d25
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit ca02954ada)
2018-01-23 14:28:19 +08:00
John Stultz
e01a704ff2 UPSTREAM: usb: dwc2: Avoid suspending if we're in gadget mode
I've found when booting HiKey with the usb gadget cable attached
if I then try to connect via adb, I get an infinite spew of:

dwc2 f72c0000.usb: dwc2_hsotg_ep_sethalt(ep ffffffc0790ecb18 ep1out, 0)
dwc2 f72c0000.usb: dwc2_hsotg_ep_sethalt(ep ffffffc0790eca18 ep1in, 0)

It seems that the usb autosuspend is suspending the bus shortly
after bootup when the gadget cable is attached. So when adbd
then tries to use the device, it doesn't work and it then tries
to restart it over and over via the ep_sethalt calls (via
FUNCTIONFS_CLEAR_HALT ioctl).

Chen Yu suggested this patch to avoid suspending if we're
in device mode, and it avoids the problem.

Change-Id: I20086689c36fced465f348661a3c731c8c297899
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: John Youn <johnyoun@synopsys.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Chen Yu <chenyu56@huawei.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Suggested-by: Chen Yu <chenyu56@huawei.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 866932e277)
2018-01-23 14:28:19 +08:00
Sevak Arakelyan
361eb95bc3 UPSTREAM: usb: dwc2: Stop Complete Splits after Data PID == 0
Stop sending complete split requests in case of ISOC IN split transfers
after getting data with PID0. Otherwise we will get a NYET for each
additional IN token.

Change-Id: I2713509085f2c89f4d442584445547f87345c37d
Signed-off-by: Sevak Arakelyan <sevaka@synopsys.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 9d8da85798)
2018-01-23 14:28:19 +08:00
John Youn
231d1336b5 UPSTREAM: usb: dwc2: Remove unnecessary kfree
This shouldn't be freed by the HCD as it is owned by the core and
allocated with devm_kzalloc.

Change-Id: I269deb75e19e9a5eb27ace999c92c1ef22e361e4
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit cd4b1e3465)
2018-01-23 14:28:19 +08:00
Masahiro Yamada
ccc85416af UPSTREAM: usb: dwc2: cleanup with list_first_entry_or_null()
The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().

Change-Id: I562e6b5a1961c7003b2016c35b32fd56e1d36240
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit ffc4b4067e)
2018-01-23 14:28:19 +08:00
Nicholas Mc Guire
c9def7c856 UPSTREAM: usb: dwc2: host: use msleep() for long delay
ulseep_range() uses hrtimers and provides no advantage over msleep()
for larger delays. Fix up the 100ms delays here passing the adjusted "min"
value to msleep(). This helps reduce the load on the hrtimer subsystem.

Link: http://lkml.org/lkml/2017/1/11/377
Change-Id: I133f0126b8289c9844432e5cc21838216e63498b
Fixes: commit 2938fc63e0 ("usb: dwc2: Properly account for the force mode delays")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit d3fe81d2cc)
2018-01-23 14:28:19 +08:00
Heiko Stuebner
c456bcd090 UPSTREAM: usb: dwc2: Add msleep for host-only
Although a host-only controller should not have any associated delay,
some rockchip SOC platforms will not show the correct host-values of
registers until after a delay.

So add a 50 ms sleep when in host-only mode.

Change-Id: I3f4963b3ad00a49ed60fe9f27c83939ed5b4742a
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit a07ce8d34e)
2018-01-23 14:28:19 +08:00
John Youn
7d5c96662a UPSTREAM: usb: dwc2: Properly account for the force mode delays
When a force mode bit is set and the IDDIG debounce filter is enabled,
there is a delay for the forced mode to take effect. This delay is due
to the IDDIG debounce filter and is variable depending on the platform's
PHY clock speed. To account for this delay we can poll for the expected
mode.

On a clear force mode, since we don't know what mode to poll for, delay
for a fixed 100 ms. This is the maximum delay based on the slowest PHY
clock speed.

Change-Id: I73b1d8db9a1782f2b08647ceef08f3bffdf9c2b1
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 2938fc63e0)
2018-01-23 14:28:19 +08:00
John Youn
a4a76d0c39 UPSTREAM: usb: dwc2: Add delay to core soft reset
Add a delay to the core soft reset function to account for the IDDIG
debounce filter.

If the current mode is host, either due to the force mode bit being
set (which persists after core reset) or the connector id pin, a core
soft reset will temporarily reset the mode to device and a delay from
the IDDIG debounce filter will occur before going back to host mode.

Change-Id: I1c08c00b877b9fc330741469d0310fdfda834bbc
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit fef6bc37db)
2018-01-23 14:28:19 +08:00
John Youn
b71a018c06 UPSTREAM: usb: dwc2: gadget: Only initialize device if in device mode
In dwc2_hsotg_udc_start(), don't initialize the controller for device
mode unless we are actually in device mode.

Change-Id: I6cb115683fc172987928d3e0ea4c2c03cf2b0706
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit d0f0ac56b3)
2018-01-23 14:28:19 +08:00
Robert Baldyga
f773c373bc UPSTREAM: usb: dwc2: gadget: free TX FIFO after killing requests
As kill_all_requests() potentially flushes TX FIFO, we should should
free FIFO after calling it. Otherwise FIFO could stay unflushed properly.

Change-Id: I90e2add8abbc598f82856576ed222c7429b77b6b
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 1c07b20eaa)
2018-01-23 14:28:19 +08:00
Robert Baldyga
888093f2db UPSTREAM: usb: dwc2: gadget: remove dead code from dwc2_hsotg_ep_enable()
Since FIFO is always freed in dwc2_hsotg_ep_disable(), ep->fifo_index
is always 0 in dwc2_hsotg_ep_enable(), hence code inside if() block is
never executed.

Change-Id: Ib72163203bea5565209132ad7d4278ed7056049b
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 21f3bb5298)
2018-01-23 14:28:19 +08:00
Robert Baldyga
cf74f8dc0e UPSTREAM: usb: dwc2: gadget: use ep->fifo_index in context of FIFO registers
In context of FIFO registers we use ep->fifo_index instead of ep->index.

Change-Id: Iff6b518e286d095a8be50551e2caba52cedbfab7
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit ad674a1524)
2018-01-23 14:28:19 +08:00
Wolfram Sang
8fe85bac11 UPSTREAM: usb: dwc2: gadget: don't print on ENOMEM
All kmalloc-based functions print enough information on failures.

Change-Id: I2b79fb2db50d14641c628a1ea6f3994873f362e1
Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 8bae0f8c3a)
2018-01-23 14:28:19 +08:00
Dinh Nguyen
3c2830b35b UPSTREAM: usb: dwc2: Add reset control to dwc2
Allow for platforms that have a reset controller driver in place to bring
the USB IP out of reset.

Change-Id: I6ec420be0faf456b9bf40eb4ae3e214d9077b10c
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 83f8da562f)
2018-01-23 14:28:19 +08:00
Inki Dae
9f27154e19 UPSTREAM: drm/bridge: vga-dac: clean up drm_bridge_add call
This patch removes unnecessary checking of return value.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1499071350-25168-5-git-send-email-inki.dae@samsung.com
(cherry picked from commit 47e3427854)

Change-Id: Id7acd883d688ed187276f0a0d64009714cef82be
Signed-off-by: Jerry Xu <xbl@rock-chips.com>
2018-01-23 14:27:05 +08:00
Rob Herring
9bec06c238 UPSTREAM: drm: convert drivers to use of_graph_get_remote_node
Convert drivers to use the new of_graph_get_remote_node() helper
instead of parsing the endpoint node and then getting the remote device
node. Now drivers can just specify the device node and which
port/endpoint and get back the connected remote device node. The details
of the graph binding are nicely abstracted into the core OF graph code.

This changes some error messages to debug messages (in the graph core).
Graph connections are often "no connects" depending on the particular
board, so we want to avoid spurious messages. Plus the kernel is not a
DT validator.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Liviu Dudau <liviu.dudau@arm.com>
Tested-by: Eric Anholt <eric@anholt.net>
Tested-by: Jyri Sarha <jsarha@ti.com>
Tested by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
(cherry picked from commit 86418f90a4)

Conflicts:
  Only merge the file of drivers/gpu/drm/bridge/dumb-vga-dac.c

Change-Id: Ie8fd230f6d150ac8585e0b5418cbbca240b1d2f6
Signed-off-by: Jerry Xu <xbl@rock-chips.com>
2018-01-23 14:27:05 +08:00
Laurent Pinchart
33e24b5e17 UPSTREAM: drm: bridge: vga-dac: Add adi,adv7123 compatible string
The ADV7123 is a transparent VGA DAC. Unlike dumb VGA DACs it can be
controlled through a power save pin, and requires a power supply.
However, on most boards where the device is used neither the power save
signal nor the power supply are controllable.

To avoid developing a separate device-specific driver add an
"adi,adv7123" compatible entry to the dumb-vga-dac driver. This will
allow supporting most ADV7123-based boards easily, while allowing future
development of an adv7123 driver when needed without breaking backward
compatibility.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170302104728.7150-4-laurent.pinchart+renesas@ideasonboard.com
(cherry picked from commit d29ffab591)

Change-Id: I3447fa126b120911400fd9ec22a05dbb1598251e
Signed-off-by: Jerry Xu <xbl@rock-chips.com>
2018-01-23 14:27:05 +08:00
Bartosz Golaszewski
3fa2491295 UPSTREAM: drm: bridge: add support for TI ths8135
THS8135 is a configurable video DAC, but no configuration is actually
necessary to make it work.

For now use the dumb-vga-dac driver to support it.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1481623759-12786-4-git-send-email-bgolaszewski@baylibre.com
(cherry picked from commit a1f761a592)

Change-Id: I9273f5423cc5f6695bf87fba451340d472acf356
Signed-off-by: Jerry Xu <xbl@rock-chips.com>
2018-01-23 14:27:05 +08:00
Chen-Yu Tsai
438ccb3de4 UPSTREAM: drm/bridge: dumb-vga-dac: Support a VDD regulator supply
Some dumb VGA DACs are active components which require external power.
Add support for specifying a regulator as its power supply.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20161116154232.872-2-wens@csie.org
(cherry picked from commit af948a25ec)

Change-Id: I711e3b444f72e04ee09e8ca4bfa8c04c3640039b
Signed-off-by: Jerry Xu <xbl@rock-chips.com>
2018-01-23 14:27:05 +08:00
Maxime Ripard
beea87e387 UPSTREAM: drm/bridge: Add RGB to VGA bridge support
Some boards have an entirely passive RGB to VGA bridge, based on DACs
implemented by resistor ladders.

Those might or might not have an i2c bus routed to the VGA connector in
order to access the screen EDIDs.

Add a bridge that doesn't do anything but expose the modes available on the
screen, either based on the EDIDs if available, or based on the XGA
standards.

Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20160930143709.1388-3-maxime.ripard@free-electrons.com
(cherry picked from commit 56fe8b6f49)

Conflicts:
  drivers/gpu/drm/bridge/Kconfig
  drivers/gpu/drm/bridge/Makefile

Change-Id: I481b7115b0401c14d990a7574e41b6c76b7d48d6
Signed-off-by: Jerry Xu <xbl@rock-chips.com>
2018-01-23 14:27:05 +08:00
Boris Brezillon
416271c452 UPSTREAM: drm/atomic: Fix remaining places where !funcs->best_encoder is valid
Adapt drm_pick_crtcs() and update_connector_routing() to fallback to
drm_atomic_helper_best_encoder() if funcs->best_encoder() is NULL so
that DRM drivers can leave this hook unassigned if they know they want
to use drm_atomic_helper_best_encoder().

Update the vtables documentation accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465300095-16971-2-git-send-email-boris.brezillon@free-electrons.com
(cherry picked from commit c61b93fe51)

Conflicts:
      include/drm/drm_modeset_helper_vtables.h

Change-Id: If27c471552026da17d22ee0e77b28b65b2c811ef
Signed-off-by: Jerry Xu <xbl@rock-chips.com>
2018-01-23 14:27:05 +08:00
Noralf Trønnes
9728403491 UPSTREAM: drm/atomic: Add drm_atomic_helper_best_encoder()
Add (struct drm_connector_helper_funcs *)->best_encoder callback helper
for connectors that support exactly 1 encoder, statically determined at
driver init time.

Change-Id: Iddcf190e2a08a768dc8d5bb52a1e4572b1ce51d1
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1462982962-10530-6-git-send-email-noralf@tronnes.org
Signed-off-by: Jerry Xu <xbl@rock-chips.com>
(cherry picked from commit 9ecb549867)
2018-01-23 14:27:05 +08:00
Meng Dongyang
de69a67f15 usb: dwc_otg_310: remove warning
Remove check tool warning of jenkins, smatch and coccinelle in
the dwc_otg_310 driver.

[smatch] drivers/usb/dwc_otg_310/dwc_otg_attr.c:407
error: we previously assumed 'pdev' could be null (see line 404)
[smatch] drivers/usb/dwc_otg_310/dwc_otg_attr.c:415
error: we previously assumed 'pdev' could be null (see line 412)
[coccinelle] drivers/usb/dwc_otg_310/dwc_otg_attr.c:468
WARNING comparing pointer to 0
[coccinelle] drivers/usb/dwc_otg_310/dwc_otg_attr.c:501
WARNING comparing pointer to 0
[smatch] drivers/usb/dwc_otg_310/dwc_otg_cil.c:778
error: buffer overflow 'core_if->core_global_regs->dtxfsiz' 15 <= 15
[smatch] drivers/usb/dwc_otg_310/dwc_otg_cil.c:938
error: buffer overflow 'core_if->core_global_regs->dtxfsiz' 15 <= 15
[coccinelle] drivers/usb/dwc_otg_310/dwc_otg_cil.c:3687
WARNING: possible condition with no effect (if == else)
[smatch] drivers/usb/dwc_otg_310/dwc_otg_cil.c:4182
warn: impossible condition '(deptsiz.b.pktcnt > 1023) => (0-1023 > 1023)'
[smatch] drivers/usb/dwc_otg_310/dwc_otg_cil.c:4316
warn: impossible condition '(deptsiz.b.pktcnt > 1023) => (0-1023 > 1023)'
[coccinelle] drivers/usb/dwc_otg_310/dwc_otg_cil_intr.c:329
Unneeded semicolon
[smatch] drivers/usb/dwc_otg_310/dwc_otg_cil_intr.c:829
warn: was && intended here instead of ||?
[smatch] drivers/usb/dwc_otg_310/dwc_otg_cil_intr.c:949
error: uninitialized symbol 'retval'.
[smatch] drivers/usb/dwc_otg_310/dwc_otg_cil_intr.c:1344
warn: we tested 'core_if->otg_ver == 1' before and it was 'true'
[coccinelle] drivers/usb/dwc_otg_310/dwc_otg_driver.c:555
WARNING: possible condition with no effect (if == else)
[smatch] drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c:480
error: potential null dereference 'hcd'.  (usb_create_hcd returns null)
[smatch] drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c:484
warn: variable dereferenced before check 'hcd' (see line 480)
[smatch] drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c:571
error: potential null dereference 'hcd'.  (usb_create_hcd returns null)
[smatch] drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c:575
warn: variable dereferenced before check 'hcd' (see line 571)
[coccinelle] drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c:815
Unneeded semicolon
[smatch] drivers/usb/dwc_otg_310/dwc_otg_pcd.c:1490
warn: this array is probably non-NULL. 'desc->wMaxPacketSize'
[coccinelle] drivers/usb/dwc_otg_310/dwc_otg_pcd.c:2277
WARNING comparing pointer to 0
[coccinelle] drivers/usb/dwc_otg_310/dwc_otg_pcd.c:2277
WARNING comparing pointer to 0
[coccinelle] drivers/usb/dwc_otg_310/usbdev_bc.c:102
WARNING: casting value returned by memory allocation function to
(uoc_field_t *) is useless.
[smatch] drivers/usb/dwc_otg_310/usbdev_bc.c:105
error: potential null dereference 'pBC_UOC_FIELDS'.  (kzalloc returns null)
[coccinelle] drivers/usb/dwc_otg_310/usbdev_bc.c:
WARNING: casting value returned by memory allocation function to
(uoc_field_t *) is useless.
[smatch] drivers/usb/dwc_otg_310/usbdev_bc.c:126
error: potential null dereference 'pBC_UOC_FIELDS'.  (kzalloc returns null)
[coccinelle] drivers/usb/dwc_otg_310/usbdev_bc.c:137 uoc_init_inno()
WARNING: casting value returned by memory allocation function to
(uoc_field_t *) is useless.
[smatch] drivers/usb/dwc_otg_310/usbdev_bc.c:141
error: potential null dereference 'pBC_UOC_FIELDS'.  (kzalloc returns null)
CHECK: Avoid CamelCase: <pBC_UOC_FIELDS>
+	pBC_UOC_FIELDS = kzalloc(SYNOP_BC_MAX * sizeof(uoc_field_t),
WARNING: Prefer kcalloc over kzalloc with multiply
+	pBC_UOC_FIELDS = kzalloc(SYNOP_BC_MAX * sizeof(uoc_field_t),
+				 GFP_ATOMIC);

Change-Id: If4831151464eeaf0e399a4be3c179c4a56e28dde
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
2018-01-23 14:24:05 +08:00
Finley Xiao
db52b49619 clk: rockchip: px30: Fix parent clk for nand, sdio and emmc
Change-Id: I5723e114871d03d271a398a55af97474e08a61e1
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-01-23 14:22:18 +08:00
Finley Xiao
c5cb615df3 arm64: dts: rockchip: px30: Add qos node
Change-Id: I09401584f211d97c64f3c351cb54b6b1e184f1e2
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-01-23 14:21:46 +08:00
Rocky Hao
4fd2924a2b ARM64: dts: rk3399: add dmc config for VOP
Change-Id: I1b07ca19c5f6529361630ac49ba8922ba0e32db2
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
2018-01-23 14:20:37 +08:00
Rocky Hao
33b1e41afd PM / devfreq: rockchip_dmc: pass a pointer to devfreq in bandwidth request/update actions
By passing a pointer to struct devfreq, we can fix global data abuse issue.

Change-Id: I17f6264b86549f67d61d03f38da0127e666eee3c
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
2018-01-23 14:18:50 +08:00
Sandy Huang
8228a831e1 drm/rockchip: lvds: add support RGB565 output mode
Change-Id: Ia1cea573d88d00b85564db4d8f2fb4f7c3ff1209
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-01-22 19:53:29 +08:00
Huibin Hong
34be2cf467 dmaengine: pl330: flush before first loop
This makes sure dma can get peripheral request.

Change-Id: I85feb4ade8796490e5d53cd4c9e610775cfd0175
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2018-01-22 19:38:40 +08:00