Commit Graph

840075 Commits

Author SHA1 Message Date
Finley Xiao
d368d1acda clk: rockchip: rk3288: Add 420MHz for PLL
Change-Id: Ic722bdf5d467a64cdf093f8bdabb6dab533cd230
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-12 09:38:43 +08:00
Finley Xiao
ca81bf09a6 soc: rockchip: opp_select: Disable rate scaling when fail to get clk
Change-Id: I1d9f8fcb6cda53bca6d7f63603322a80fcc88e7d
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-12 09:38:43 +08:00
Finley Xiao
43b189a712 soc: rockchip: Change the parameter of power model for cpu and npu
Change-Id: I73724946fce82311d29de4538b8446e87d67dc92
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-12 09:38:43 +08:00
Finley Xiao
f536573bf6 thermal: trace: Add trace for staitc power
Change-Id: I65fa7e60c606d414e6f5941c5a73347db9874c27
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-12 09:38:43 +08:00
Finley Xiao
93a75af425 soc: rockchip: Add support to change static power according to leakage
Change-Id: Ie25e42ab14a46676819711957afa8aef8dfd0785
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-12 09:38:43 +08:00
Finley Xiao
8da9fcee28 soc: rockchip: Implement rockchip_of_get_leakage()
Change-Id: I6d1bf9ee6957455c2cb6623aa112d918a9fea4d4
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-12 09:38:43 +08:00
Sandy Huang
3967d5965f drm/rockchip: delete some unused define
Change-Id: Idca65b6d16414213ad438e04224a53189b33daef
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-12 09:28:33 +08:00
Elaine Zhang
c086bce5d9 arm64: dts: rockchip: fix up the rk805 dts node error
Change-Id: I6a8e02e2418c1ffa4741ccb73a8373e8be088d11
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-06-11 15:14:22 +08:00
Elaine Zhang
47e16176e1 ARM: dts: rockchip: fix up the rk805 dts node error
Change-Id: Ic39000c5fa4bbd9ecc68f0184c9385536ddeb882
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-06-11 15:13:34 +08:00
Sandy Huang
8dc3d77ba5 drm/rockchip: vop: move plane calculate to atomic_check
Change-Id: Icb5ff0ae4290720e8b288f839df4c010eed72d18
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-06 19:16:53 +08:00
Sandy Huang
1a798a8e5b drm/rockchip: vop: remove unused device
Change-Id: I4315e17c0c6c2c9e2528072e330af9309df96ea3
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-06 19:15:50 +08:00
Sandy Huang
16018dd3fd drm/rockchip: fix fbdev crash when not use DRM_FBDEV_EMULATION
[    1.162571] Unable to handle kernel NULL pointer dereference at virtual address 00000200
[    1.165656] Modules linked in:
[    1.165941] CPU: 5 PID: 143 Comm: kworker/5:2 Not tainted 4.4.15 #237
[    1.166506] Hardware name: Rockchip RK3399 Evaluation Board v1 (Android) (DT)
[    1.167153] Workqueue: events output_poll_execute
[    1.168231] PC is at mutex_lock+0x14/0x44
[    1.168586] LR is at drm_fb_helper_hotplug_event+0x28/0xcc
[    1.172192] [<ffffff8008982110>] mutex_lock+0x14/0x44
[    1.172196] [<ffffff80084025a4>] drm_fb_helper_hotplug_event+0x28/0xcc
[    1.172201] [<ffffff8008427ae4>] rockchip_drm_output_poll_changed+0x14/0x1c
[    1.172204] [<ffffff80083f7c4c>] drm_kms_helper_hotplug_event+0x28/0x34
[    1.172207] [<ffffff80083f7ddc>] output_poll_execute+0x150/0x198
[    1.172212] [<ffffff80080b0ea8>] process_one_work+0x218/0x3dc
[    1.172215] [<ffffff80080b1578>] worker_thread+0x24c/0x374
[    1.172217] [<ffffff80080b5bcc>] kthread+0xdc/0xe4
[    1.172222] [<ffffff8008084cd0>] ret_from_fork+0x10/0x40

Change-Id: I681b9260ad7f2e3cae5cd08a109dad89b3575c2c
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-06 19:15:23 +08:00
Sandy Huang
11f3f8261c drm/rockchip: support loader display
Change-Id: Ia3708d4dff638380aa03f83e38248840454e2b70
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-06 19:15:10 +08:00
Sandy Huang
8b9e68c433 drm/rockchip: support add fb from dev resource
Change-Id: I980af965d83de25c433ba5424bab2ad063534bcb
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-06 17:41:36 +08:00
Sandy Huang
98b8b428b8 drm/rockchip: add DRM_RENDER_ALLOW
This is required by android hwc.

Change-Id: Ia0159b877f7d8b2bb5cecf3b352b67d9c76c7c97
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-06 17:40:31 +08:00
Sandy Huang
e3e37b885e drm/rockchip: vop: support plane zpos property
Change-Id: Idd0265020a591ce5b34d117442104f625e331119
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-05 19:49:08 +08:00
Sandy Huang
23503761c7 drm/rockchip: vop full: add area plane
add rk3288/rk3368/rk3399 vop area plane

Change-Id: Ia6f77353363e25423ac29129372bc510565682f8
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-05 19:47:40 +08:00
Sandy Huang
8ba5fa48e5 drm/rockchip: vop: support multi area plane
The series vop of VOP_FULL framework support area plane, such as
RK3288 and RK3399, one group of area planes share same hardware,
reuse the hardware on different scanout time, this design is
useful to support mulit planes with low hardware consume.

Change-Id: Ie53211ce9ed22d03f7668637efbb7c95d9a8eb5b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-05 19:46:37 +08:00
Mark Yao
8b19e980a6 drm: introduce share plane
The plane hardware is used when the display scanout run into plane active
scanout, that means we can reuse the plane hardware resources on plane
non-active scanout.

Because resource share, There are some limit on share plane: one group
of share planes need use same zpos, can't not overlap, etc.

We assume share plane is a universal plane with some limit flags.
people who use the share plane need know the limit, should call the ioctl
DRM_CLIENT_CAP_SHARE_PLANES, and judge the planes limit before use it.

Change-Id: Iecc3d8e7f1ce29d567cdbad689ba4dbad3d594e1
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-05 19:46:20 +08:00
Sandy Huang
28fb9688e8 drm/rockchip: set rgb overlay mode as default config
Change-Id: I8e1aafe5375862c34fa73aff16565a81bd12145d
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-06-04 16:06:40 +08:00
Algea Cao
eba5371ae9 arm: dts: rk322x: Change inno hdmi phy name
DTS hdmi phy name have to be the same with dt-binding document and
hdmi driver code.

Change-Id: Ib2142607e0792f430f05a972206e608f79a46132
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-05-30 11:54:24 +08:00
Algea Cao
5d4ad96662 arm64: dts: rockchip: rk3328: Change inno hdmi phy name
DTS hdmi phy name have to be the same with dt-binding document and
hdmi driver code.

Change-Id: I00edde5b5745832f123b98f41a2fdb52434ce386
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-05-30 11:54:24 +08:00
Algea Cao
75c146178e phy/rockchip: inno-hdmi: Support inno hdmi phy
When cherry-pick from develop-4.4, inno hdmi phy config entry
was lost (commit-id: 0b56e9a7e8).
So we must add inno hdmi phy config entry again.

Change-Id: I8a17c75359869896f5f110cf268c3c2469781537
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2019-05-30 11:50:10 +08:00
Tao Huang
6b16065afa regulator: debugfs: Adding debugfs functions into regulator framework
This change allows the user to read and edit regulator information
in user space through the debugfs file system.

Base on msm work.

Change-Id: I4b40d4fd662e3d3d0856127e8e030fa60e938df9
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-05-28 19:42:42 +08:00
Jon Lin
aa21cdfe5c drivers: rkflash: fix build error
fix build without nand support.

Change-Id: I9a5a2d63b335c42bcff99853b790796dd35355de
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-05-24 20:59:43 +08:00
Zheng Yang
8d4a22b562 drm: bridge: dw-hdmi: support workaround to clear the overflow condition on rockchip platform
Under some circumstances the Frame Composer arithmetic unit can miss
an FC register write due to being busy processing the previous one.

The issue can be worked around by issuing a TMDS software reset and
then write one of the FC registers several times. After tested, the
number of iterations of RK3399/RK3328(v2.11a), RK3368(v2.01a),
RK3288(v2.00a) is one.

Change-Id: Iba209e25d56aff84a8cc90b4d8dcb87369c9ae52
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-05-22 17:16:22 +08:00
Jianhui Wang
87213ab49a arm64: dts: rockchip: rk3399-sapphire-excavator-edp: modify sound adapter
HDMI sound use i2s2 & dp sound use spdif

Change-Id: Id4ee15d3eb67dad1372f733ecf16182cc6488835
Signed-off-by: Jianhui Wang <wjh@rock-chips.com>
2019-05-20 15:49:21 +08:00
Liang Chen
1b748cc28e arm64: dts: rockchip: add vcc5v0_sys fixed regulator for rk3399-sapphire
Change-Id: Icf015684178c2d535264cea8f13c7ed2a7156a06
Signed-off-by: Liang Chen <cl@rock-chips.com>
2019-05-20 15:46:03 +08:00
Zorro Liu
8203845153 arm64: dts: rockchip: enable typec0 for Sapphire board
Change-Id: I9a32472307329ed6d7121359f77aa1aaba501821
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
2019-05-20 15:43:39 +08:00
WeiYong Bi
06ee063e36 arm64: dts: rockchip: rk3399: add dsi1 node
Change-Id: I964f047b0cf9f6355d61630d03181f229fdd8c15
Signed-off-by: WeiYong Bi <bivvy.bi@rock-chips.com>
2019-05-20 14:59:45 +08:00
WeiYong Bi
cf89c2a24b arm64: dts: rockchip: rename mipi to dsi for rk3399
Change-Id: I6c6fb4e0399b805dfa012cc5562ad71103aa85e9
Signed-off-by: WeiYong Bi <bivvy.bi@rock-chips.com>
2019-05-20 14:46:19 +08:00
Thinh Nguyen
7372c68b37 UPSTREAM: usb: dwc3: Rename DWC3_DCTL_LPM_ERRATA
The macro name DWC3_DCTL_LPM_ERRATA is uninformative and does not do
masking. Remove DWC3_DCTL_LPM_ERRATA_MASK and rename
DWC3_DCTL_LPM_ERRATA to DWC3_DCTL_NYET_THRES with proper masking.

Change-Id: I74a86306c10a5d03e8d772a86f04ffe9048ad990
Signed-off-by: Thinh Nguyen <thinhn@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 2e487d2805)
2019-05-16 19:19:54 +08:00
Thinh Nguyen
8280260e37 UPSTREAM: usb: dwc3: Fix default lpm_nyet_threshold value
The max possible value for DCTL.LPM_NYET_THRES is 15 and not 255. Change
the default value to 15.

Change-Id: Ib59799b4df8de9de1ea53362b55c7b822b02cbba
Cc: stable@vger.kernel.org
Fixes: 80caf7d21a ("usb: dwc3: add lpm erratum support")
Signed-off-by: Thinh Nguyen <thinhn@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 8d791929b2)
2019-05-16 19:19:54 +08:00
Thinh Nguyen
680fc34908 UPSTREAM: usb: dwc3: debug: Print GET_STATUS(device) tracepoint
DWC3 is missing the printing of control request GET_STATUS(device)
tracepoint. This patch prints that.

Change-Id: I22b523a236a7afe913f7d7f52791f26a8a007847
Signed-off-by: Thinh Nguyen <thinhn@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 dd24f9b604)
2019-05-16 19:19:54 +08:00
Thinh Nguyen
3a23345224 UPSTREAM: usb: dwc3: Do core validation early on probe
The setting of the dr_mode may need to check the controller's revision.
The revision is set in the dwc3_core_is_valid(), which comes after
dr_mode setting. Let's move it closer to the start of the dwc3_probe()
function and before calling dwc3_get_dr_mode().

Change-Id: I400f22c66cd03abebfed2c8791c88baafb581b39
Signed-off-by: Thinh Nguyen <thinhn@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 b873e2d0ea)
2019-05-16 19:19:54 +08:00
Thinh Nguyen
150cb8ab0c UPSTREAM: usb: dwc3: gadget: Set lpm_capable
All DWC3 controllers are LPM capable. Report that in the
usb_gadget.lpm_capable for the gadget driver to properly output the
bcdUSB value in the descriptor.

Change-Id: Ib40247fb4145a683ce84a0358eddfeb69b5a868c
Signed-off-by: Thinh Nguyen <thinhn@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 c729969b2b)
2019-05-16 19:19:54 +08:00
Marek Szyprowski
b3223e74f6 UPSTREAM: usb: dwc3: move synchronize_irq() out of the spinlock protected block
dwc3_gadget_suspend() is called under dwc->lock spinlock. In such context
calling synchronize_irq() is not allowed. Move the problematic call out
of the protected block to fix the following kernel BUG during system
suspend:

BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
in_atomic(): 1, irqs_disabled(): 128, pid: 1601, name: rtcwake
6 locks held by rtcwake/1601:
 #0: f70ac2a2 (sb_writers#7){.+.+}, at: vfs_write+0x130/0x16c
 #1: b5fe1270 (&of->mutex){+.+.}, at: kernfs_fop_write+0xc0/0x1e4
 #2: 7e597705 (kn->count#60){.+.+}, at: kernfs_fop_write+0xc8/0x1e4
 #3: 8b3527d0 (system_transition_mutex){+.+.}, at: pm_suspend+0xc4/0xc04
 #4: fc7f1c42 (&dev->mutex){....}, at: __device_suspend+0xd8/0x74c
 #5: 4b36507e (&(&dwc->lock)->rlock){....}, at: dwc3_gadget_suspend+0x24/0x3c
irq event stamp: 11252
hardirqs last  enabled at (11251): [<c09c54a4>] _raw_spin_unlock_irqrestore+0x6c/0x74
hardirqs last disabled at (11252): [<c09c4d44>] _raw_spin_lock_irqsave+0x1c/0x5c
softirqs last  enabled at (9744): [<c0102564>] __do_softirq+0x3a4/0x66c
softirqs last disabled at (9737): [<c0128528>] irq_exit+0x140/0x168
Preemption disabled at:
[<00000000>]   (null)
CPU: 7 PID: 1601 Comm: rtcwake Not tainted
5.0.0-rc3-next-20190122-00039-ga3f4ee4f8a52 #5252
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c01110f0>] (unwind_backtrace) from [<c010d120>] (show_stack+0x10/0x14)
[<c010d120>] (show_stack) from [<c09a4d04>] (dump_stack+0x90/0xc8)
[<c09a4d04>] (dump_stack) from [<c014c700>] (___might_sleep+0x22c/0x2c8)
[<c014c700>] (___might_sleep) from [<c0189d68>] (synchronize_irq+0x28/0x84)
[<c0189d68>] (synchronize_irq) from [<c05cbbf8>] (dwc3_gadget_suspend+0x34/0x3c)
[<c05cbbf8>] (dwc3_gadget_suspend) from [<c05bd020>] (dwc3_suspend_common+0x154/0x410)
[<c05bd020>] (dwc3_suspend_common) from [<c05bd34c>] (dwc3_suspend+0x14/0x2c)
[<c05bd34c>] (dwc3_suspend) from [<c051c730>] (platform_pm_suspend+0x2c/0x54)
[<c051c730>] (platform_pm_suspend) from [<c05285d4>] (dpm_run_callback+0xa4/0x3dc)
[<c05285d4>] (dpm_run_callback) from [<c0528a40>] (__device_suspend+0x134/0x74c)
[<c0528a40>] (__device_suspend) from [<c052c508>] (dpm_suspend+0x174/0x588)
[<c052c508>] (dpm_suspend) from [<c0182134>] (suspend_devices_and_enter+0xc0/0xe74)
[<c0182134>] (suspend_devices_and_enter) from [<c0183658>] (pm_suspend+0x770/0xc04)
[<c0183658>] (pm_suspend) from [<c0180ddc>] (state_store+0x6c/0xcc)
[<c0180ddc>] (state_store) from [<c09a9a70>] (kobj_attr_store+0x14/0x20)
[<c09a9a70>] (kobj_attr_store) from [<c02d6800>] (sysfs_kf_write+0x4c/0x50)
[<c02d6800>] (sysfs_kf_write) from [<c02d594c>] (kernfs_fop_write+0xfc/0x1e4)
[<c02d594c>] (kernfs_fop_write) from [<c02593d8>] (__vfs_write+0x2c/0x160)
[<c02593d8>] (__vfs_write) from [<c0259694>] (vfs_write+0xa4/0x16c)
[<c0259694>] (vfs_write) from [<c0259870>] (ksys_write+0x40/0x8c)
[<c0259870>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
Exception stack(0xed55ffa8 to 0xed55fff0)
...

Change-Id: I90fa927b1b5d428a7114d2a7a40915cf04837fbb
Fixes: 01c10880d2 ("usb: dwc3: gadget: synchronize_irq dwc irq in suspend")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.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 41a91c606e)
2019-05-16 19:19:54 +08:00
Andy Shevchenko
02def3c12e UPSTREAM: usb: dwc3: Free resource immediately after use
When we read an array of integers from device properties,
the temporary buffer is allocated.

However, in case of dwc3_set_incr_burst_type() it's not freed.
Free allocated buffer immediately after use.

Change-Id: I19353b4b74fb09543a91b2927f5166cecaa9d94b
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.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 75ecb9dd56)
2019-05-16 19:19:54 +08:00
Felipe Balbi
8f90b1802e UPSTREAM: usb: dwc3: pci: add support for Comet Lake PCH ID
This patch simply adds a new PCI Device ID

Change-Id: If7b865284b5fa4c61eb3962a0b2d150ca9ad3208
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 7ae622c978)
2019-05-16 19:19:54 +08:00
Andy Shevchenko
e980094b89 UPSTREAM: usb: dwc3: drd: Defer probe if extcon device is not found
In case the "linux,extcon-name" property is defined but device itself
is not ready, defer the probe.

Change-Id: I66ec092bb74d92aaf6ef687156713a15224a5caf
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 98bba546e8)
2019-05-16 19:19:54 +08:00
Thinh Nguyen
6933711403 UPSTREAM: usb: dwc3: Reset num_trbs after skipping
Currently req->num_trbs is not reset after the TRBs are skipped and
processed from the cancelled list. The gadget driver may reuse the
request with an invalid req->num_trbs, and DWC3 will incorrectly skip
trbs. To fix this, simply reset req->num_trbs to 0 after skipping
through all of them.

Change-Id: I3baf95ab4513f54f65ed2c79ff6bf1e0655006fc
Fixes: c3acd59014 ("usb: dwc3: gadget: use num_trbs when skipping TRBs on ->dequeue()")
Signed-off-by: Thinh Nguyen <thinhn@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 c7152763f0)
2019-05-16 19:19:54 +08:00
Felipe Balbi
33df63a34f UPSTREAM: usb: dwc3: gadget: don't enable interrupt when disabling endpoint
Since we're disabling the endpoint anyway, we don't worry about
getting endpoint command completion interrupt.

Change-Id: Ibd8b9f362b88da6bc7e60e19156dcf0a816ae42a
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit c5353b225d)
2019-05-16 19:19:54 +08:00
Thinh Nguyen
2f95fd9d50 UPSTREAM: usb: dwc3: haps: Workaround matching VID PID
i.MX6QP and i.MX7D platform use a PCIe controller with the same VID and
PID as this USB controller. The system may incorrectly match this driver
to that PCIe controller. To workaround this, specifically use class type
USB with PCI device ID to prevent incorrect driver matching.

Change-Id: Ie0b9d6ebe4eaa2209af0c098b9ae120b576a94da
Signed-off-by: Thinh Nguyen <thinhn@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 9c7ebc99b3)
2019-05-16 19:19:54 +08:00
Felipe Balbi
595b54c4c9 UPSTREAM: usb: dwc3: debug: purge usage of strcat
Now that buffer size is always passed around, we don't need to rely on
strcat anymore.

Change-Id: If24ef7da4630e04f5fd75ae4621ae11785bce15f
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 1381a5113c)
2019-05-16 19:19:54 +08:00
Felipe Balbi
3e27811320 UPSTREAM: usb: dwc3: trace: pass trace buffer size to decoding functions
Instead of assuming that our buffer is big enough, let's pass the
buffer size around so printing functions can make sure they won't
overflow the buffer.

Change-Id: I8d2bbbdabf6247f69ac7a3132b199938486c7193
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 7790b3556f)
2019-05-16 19:19:54 +08:00
Felipe Balbi
4c46be5dc6 UPSTREAM: usb: dwc3: gadget: remove DWC3_EP_END_TRANSFER_PENDING
Now that we modified the code to fix a race condition, it's clear that
DWC3_EP_END_TRANSFER_PENDING is unnecessary, considering that
DWC3_EP_TRANSFER_STARTED will remain set until End Transfer completes.

Change-Id: Ifbbd5c961a2e757cc3e39f8ba0d0a27bb3d18897
Tested-by: Thinh Nguyen <thinhn@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 3aec99154d)
2019-05-16 19:19:54 +08:00
Felipe Balbi
28ebe01430 UPSTREAM: usb: dwc3: gadget: early giveback if End Transfer already completed
There is a rare race condition that may happen during a Disconnect
Interrupt if we have a started request that happens to be
dequeued *after* completion of End Transfer command. If that happens,
that request will be left waiting for completion of an End Transfer
command that will never happen.

If End Transfer command has already completed before, we are safe to
giveback the request straight away.

Change-Id: I98d4f8a42459d752be969cf3aabc9b01d5bcd212
Tested-by: Thinh Nguyen <thinhn@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 9f45581f5e)
2019-05-16 19:19:54 +08:00
Felipe Balbi
d8a4511ad1 UPSTREAM: usb: dwc3: gadget: don't use resource_index as a flag
We have a proper flag for testing that we have a valid transfer in
flight, let's use that instead.

This patch is in preparation to fix a rare race condition that happens
upon Disconnect Interrupt.

Change-Id: I475cd17ef21acd268b326c4896e973d9f4437b5b
Tested-by: Thinh Nguyen <thinhn@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 974a1368c3)
2019-05-16 19:19:54 +08:00
Felipe Balbi
fbabe66636 UPSTREAM: usb: dwc3: gadget: clear DWC3_EP_TRANSFER_STARTED on cmd complete
We must wait until End Transfer completes in order to clear
DWC3_EP_TRANSFER_STARTED, otherwise we may confuse the driver.

This patch is in preparation to fix a rare race condition that happens
upon Disconnect Interrupt.

Change-Id: I2f36f240dc0917715d0eeacde14b22043e19eee7
Tested-by: Thinh Nguyen <thinhn@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 acbfa6c26f)
2019-05-16 19:19:54 +08:00
Tejas Joglekar
b0073d70ef UPSTREAM: usb: dwc3: gadget: Handle 0 xfer length for OUT EP
For OUT endpoints, zero-length transfers require MaxPacketSize buffer as
per the DWC_usb3 programming guide 3.30a section 4.2.3.3.

This patch fixes this by explicitly checking zero length
transfer to correctly pad up to MaxPacketSize.

Change-Id: I9dff2dabdbe1c5cd86ef213356bcbefe90d0e1be
Fixes: c6267a5163 ("usb: dwc3: gadget: align transfers to wMaxPacketSize")
Cc: stable@vger.kernel.org
Signed-off-by: Tejas Joglekar <joglekar@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 1e19cdc806)
2019-05-16 19:19:54 +08:00