linux/drivers
Douglas Anderson 96cb061468 FROMLIST: phy: rockchip-typec: Try to turn the PHY on several times
Bind / unbind stress testing of the USB controller on rk3399 found
that we'd often end up with lots of failures that looked like this:

  phy phy-ff800000.phy.9: phy poweron failed --> -110
  dwc3 fe900000.dwc3: failed to initialize core
  dwc3: probe of fe900000.dwc3 failed with error -110

Those errors were sometimes seen at bootup too, in which case USB
peripherals wouldn't work until unplugged and re-plugged in.

I spent some time trying to figure out why the PHY was failing to
power on but I wasn't able to.  Possibly this has to do with the fact
that the PHY docs say that the USB controller "needs to be held in
reset to hold pipe power state in P2 before initializing the Type C
PHY" but that doesn't appear to be easy to do with the dwc3 driver
today.  Messing around with the ordering of the reset vs. the PHY
initialization in the dwc3 driver didn't seem to fix things.

I did, however, find that if I simply retry the power on it seems to
have a good chance of working.  So let's add some retries.  I ran a
pretty tight bind/unbind loop overnight.  When I did so, I found that
I need to retry between 1% and 2% of the time.  Overnight I found only
a small handful of times where I needed 2 retries.  I never found a
case where I needed 3 retries.

I'm completely aware of the fact that this is quite an ugly hack and I
wish I didn't have to resort to it, but I have no other real idea how
to make this hardware reliable.  If Rockchip in the future can come up
with a solution we can always revert this hack.  Until then, let's at
least have something that works.

This patch is tested atop Enric's latest dwc3 patch series ending at:
  https://patchwork.kernel.org/patch/10095527/
...but it could be applied independently of that series without any
bad effects.

For some more details on this bug, you can refer to:
  https://bugs.chromium.org/p/chromium/issues/detail?id=783464

Change-Id: I7909731247739694f56bf89ab3064889f2b34d3c
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(am from https://patchwork.kernel.org/patch/10105833/)
2021-06-17 09:09:54 +08:00
..
accessibility
acpi Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
amba Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
android ANDROID: vendor_hooks: Add hook for binder 2021-04-27 19:18:56 +00:00
ata rk: revert to v4.19 2021-03-17 18:05:39 +08:00
atm atm: idt77252: fix null-ptr-dereference 2021-03-30 14:31:50 +02:00
auxdisplay rk: revert to v4.19 2021-03-17 18:05:39 +08:00
base Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
bcma rk: revert to v4.19 2021-03-17 18:05:39 +08:00
block Merge 5.10.31 into android12-5.10 2021-04-16 16:01:44 +02:00
bluetooth Bluetooth: hci_ldisc: fix race between open, close and send data 2021-05-12 17:10:00 +08:00
bus bus: ti-sysc: Fix warning on unbind if reset is not deasserted 2021-04-10 13:36:07 +02:00
cdrom rk: revert to v4.19 2021-03-17 18:05:39 +08:00
char Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
clk UPSTREAM: clk: rockchip: Optimize PLL table memory usage 2021-06-09 16:18:49 +08:00
clocksource FROMLIST: drivers/clocksource/timer-of: Remove __init markings 2021-04-17 08:41:37 +00:00
connector rk: revert to v4.19 2021-03-17 18:05:39 +08:00
counter counter: stm32-timer-cnt: fix ceiling miss-alignment with reload register 2021-03-25 09:04:16 +01:00
cpufreq Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
cpuidle ANDROID: cpuidle: Move vendor hook to enter proper state 2021-03-25 19:14:33 +00:00
crypto Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-04-25 18:33:22 +08:00
dax rk: revert to v4.19 2021-03-17 18:05:39 +08:00
dca
devfreq Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-03-17 18:07:51 +08:00
dio
dma This is the 5.10.32 stable release 2021-04-22 11:12:08 +02:00
dma-buf UPSTREAM: dma-fence: allow signaling drivers to set fence timestamp 2021-04-07 14:17:51 +00:00
edac rk: revert to v4.19 2021-03-17 18:05:39 +08:00
eisa
extcon extcon: Add EXTCON_USB_VBUS_EN for USB Type-C 2021-05-31 14:54:40 +08:00
firewire firewire: nosy: Fix a use-after-free bug in nosy_ioctl() 2021-04-07 15:00:11 +02:00
firmware Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-04-25 18:33:22 +08:00
fpga rk: revert to v4.19 2021-03-17 18:05:39 +08:00
fsi rk: revert to v4.19 2021-03-17 18:05:39 +08:00
gnss rk: revert to v4.19 2021-03-17 18:05:39 +08:00
gpio gpio: add gpio-rockchip driver 2021-05-10 18:00:30 +08:00
gpu drm/rockchip: gem: reorder pages if page chunk less than 8 2021-06-07 17:49:29 +08:00
greybus
headset_observe treewide: replace '---help---' in Kconfig files with 'help' (rk) 2021-04-08 18:57:03 +08:00
hid hid: usbhid: enable hid to wakeup system if it supports remote wakeup 2021-05-25 16:29:12 +08:00
hsi rk: revert to v4.19 2021-03-17 18:05:39 +08:00
hv rk: revert to v4.19 2021-03-17 18:05:39 +08:00
hwmon rk: revert to v4.19 2021-03-17 18:05:39 +08:00
hwspinlock Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-03-17 18:07:51 +08:00
hwtracing ANDROID: arm64: coresight: Fix a sparse warning 2021-04-09 18:38:38 +00:00
i2c Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
i3c
ide rk: revert to v4.19 2021-03-17 18:05:39 +08:00
idle rk: revert to v4.19 2021-03-17 18:05:39 +08:00
iio Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-04-25 18:33:22 +08:00
infiniband RDMA/addr: Be strict with gid size 2021-04-14 08:42:12 +02:00
input Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
interconnect interconnect: core: fix error return code of icc_link_destroy() 2021-04-16 11:43:19 +02:00
iommu Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
ipack rk: revert to v4.19 2021-03-17 18:05:39 +08:00
irqchip Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
isdn mISDN: fix crash in fritzpci 2021-04-10 13:36:08 +02:00
leds Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-03-17 18:07:51 +08:00
lightnvm rk: revert to v4.19 2021-03-17 18:05:39 +08:00
macintosh rk: revert to v4.19 2021-03-17 18:05:39 +08:00
mailbox mailbox: rockchip: code optimization 2021-06-11 14:34:06 +08:00
mcb
md dm verity fec: fix misaligned RS roots IO 2021-04-21 13:00:54 +02:00
media Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
memory UPSTREAM: memory: mtk-smi: Allow building as module 2021-03-24 12:45:16 -07:00
memstick rk: revert to v4.19 2021-03-17 18:05:39 +08:00
message rk: revert to v4.19 2021-03-17 18:05:39 +08:00
mfd mfd: rk808: Call rk808_i2c_driver_init() early when CONFIG_ROCKCHIP_THUNDER_BOOT=y 2021-05-17 14:49:07 +08:00
misc Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
mmc mmc: sdhci-of-dwcmshc: Set default tx delay to 16 2021-06-15 11:18:36 +08:00
most
mtd Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
mux
net net: can: rockchip: fix up the CAN bus off 2021-06-09 16:19:36 +08:00
nfc Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-03-17 18:07:51 +08:00
ntb rk: revert to v4.19 2021-03-17 18:05:39 +08:00
nubus
nvdimm libnvdimm/region: Fix nvdimm_has_flush() to handle ND_REGION_ASYNC 2021-04-21 13:00:55 +02:00
nvme nvmet-tcp: fix kmap leak when data digest in use 2021-04-07 15:00:06 +02:00
nvmem Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-04-25 18:33:22 +08:00
of Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
opp rk: revert to v4.19 2021-03-17 18:05:39 +08:00
oprofile
parisc rk: revert to v4.19 2021-03-17 18:05:39 +08:00
parport rk: revert to v4.19 2021-03-17 18:05:39 +08:00
pci PCI: rockchip: Add support for PCIe dma transfer function 2021-06-07 17:41:54 +08:00
pcmcia rk: revert to v4.19 2021-03-17 18:05:39 +08:00
perf rk: revert to v4.19 2021-03-17 18:05:39 +08:00
phy FROMLIST: phy: rockchip-typec: Try to turn the PHY on several times 2021-06-17 09:09:54 +08:00
pinctrl pinctrl: rk805: add rk816 support 2021-05-12 14:18:10 +08:00
platform Merge 5.10.29 into android12-5.10 2021-04-11 09:11:53 +02:00
pnp
power Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-04-25 18:33:22 +08:00
powercap UPSTREAM: powercap/drivers/dtpm: Add the experimental label to the option description 2021-03-22 15:24:47 +00:00
pps rk: revert to v4.19 2021-03-17 18:05:39 +08:00
ps3 rk: revert to v4.19 2021-03-17 18:05:39 +08:00
ptp ptp_qoriq: fix overflow in ptp_qoriq_adjfine() u64 calcalation 2021-04-10 13:36:09 +02:00
pwm Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-04-25 18:33:22 +08:00
rapidio rk: revert to v4.19 2021-03-17 18:05:39 +08:00
ras RAS/CEC: Correct ce_add_elem()'s returned values 2021-04-14 08:42:12 +02:00
regulator regulator: rk808: Call rk808_regulator_driver_init() early when CONFIG_ROCKCHIP_THUNDER_BOOT=y 2021-05-17 14:22:42 +08:00
remoteproc FROMLIST: remoteproc: core: Move cdev add before device add 2021-04-23 18:42:39 -07:00
reset rk: revert to v4.19 2021-03-17 18:05:39 +08:00
rk_nand drivers: rk_nand: fix the problem of clang compilate error 2021-04-08 09:35:17 +08:00
rkflash drivers: rkflash: Change to select CRYPTO_LIB_ARC4 and CRYPTO for sfc_nor 2021-06-16 17:13:06 +08:00
rpmsg rk: revert to v4.19 2021-03-17 18:05:39 +08:00
rtc rtc: hym8563: set init time 2021-05-20 20:43:43 +08:00
s390 Merge 5.10.26 into android12-5.10-lts 2021-03-25 17:15:27 +01:00
sbus rk: revert to v4.19 2021-03-17 18:05:39 +08:00
scsi This is the 5.10.32 stable release 2021-04-22 11:12:08 +02:00
sfi
sh
siox
slimbus rk: revert to v4.19 2021-03-17 18:05:39 +08:00
soc soc: rockchip: Add ROCKCHIP_THUNDER_BOOT config 2021-05-17 14:16:00 +08:00
soundwire rk: revert to v4.19 2021-03-17 18:05:39 +08:00
spi Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-04-25 18:33:22 +08:00
spmi spmi: spmi-pmic-arb: Fix hw_irq overflow 2021-03-04 11:38:40 +01:00
ssb rk: revert to v4.19 2021-03-17 18:05:39 +08:00
staging Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
switch
target scsi: target: iscsi: Fix zero tag inside a trace event 2021-04-14 08:42:03 +02:00
tc rk: revert to v4.19 2021-03-17 18:05:39 +08:00
tee rk: revert to v4.19 2021-03-17 18:05:39 +08:00
testcode
thermal thermal: rockchip: Support RK3568 SoCs in the thermal driver 2021-05-20 18:41:43 +08:00
thunderbolt thunderbolt: Fix off by one in tb_port_find_retimer() 2021-04-14 08:42:03 +02:00
tty Merge 5.10.28 into android12-5.10 2021-04-09 09:29:17 +02:00
uio rk: revert to v4.19 2021-03-17 18:05:39 +08:00
usb usb: gadget: f_uvc: disallow the CPU to enter deeper sleep when streamon 2021-06-16 19:16:52 +08:00
vdpa vdpa/mlx5: Fix wrong use of bit numbers 2021-04-14 08:42:12 +02:00
vfio This is the 5.10.32 stable release 2021-04-22 11:12:08 +02:00
vhost vhost: Fix vhost_vq_reset() 2021-04-07 15:00:05 +02:00
video Merge remote branch 'android12-5.10' of https://android.googlesource.com/kernel/common 2021-05-03 19:52:23 +08:00
virt rk: revert to v4.19 2021-03-17 18:05:39 +08:00
virtio FROMGIT: mm, page_poison: remove CONFIG_PAGE_POISONING_NO_SANITY 2021-03-24 15:09:17 -07:00
visorbus rk: revert to v4.19 2021-03-17 18:05:39 +08:00
vlynq
vme rk: revert to v4.19 2021-03-17 18:05:39 +08:00
w1 rk: revert to v4.19 2021-03-17 18:05:39 +08:00
watchdog rk: revert to v4.19 2021-03-17 18:05:39 +08:00
xen xen/events: fix setting irq affinity 2021-04-16 11:43:22 +02:00
zorro
Kconfig drivers: rkflash: Including rkflash source files 2021-06-16 17:28:09 +08:00
Makefile drivers: rkflash: Including rkflash source files 2021-06-16 17:28:09 +08:00
OWNERS ANDROID: Add OWNERS files referring to the respective android-mainline OWNERS 2021-04-03 14:11:30 +00:00