linux-stable/drivers
Jean-Francois Le Fillatre 354d768e31 usb: add quirks for Lenovo OneLink+ Dock
commit 37d49519b4 upstream.

The Lenovo OneLink+ Dock contains two VL812 USB3.0 controllers:
17ef:1018 upstream
17ef:1019 downstream

These hubs suffer from two separate problems:

1) After the host system was suspended and woken up, the hubs appear to
   be in a random state. Some downstream ports (both internal to the
   built-in audio and network controllers, and external to USB sockets)
   may no longer be functional. The exact list of disabled ports (if
   any) changes from wakeup to wakeup. Ports remain in that state until
   the dock is power-cycled, or until the laptop is rebooted.

   Wakeup sources connected to the hubs (keyboard, WoL on the integrated
   gigabit controller) will wake the system up from suspend, but they
   may no longer work after wakeup (and in that case will no longer work
   as wakeup source in a subsequent suspend-wakeup cycle).

   This issue appears in the logs with messages such as:

     usb 1-6.1-port4: cannot disable (err = -71)
     usb 1-6-port2: cannot disable (err = -71)
     usb 1-6.1: clear tt 1 (80c0) error -71
     usb 1-6-port4: cannot disable (err = -71)
     usb 1-6.4: PM: dpm_run_callback(): usb_dev_resume+0x0/0x10 [usbcore] returns -71
     usb 1-6.4: PM: failed to resume async: error -71
     usb 1-7: reset full-speed USB device number 5 using xhci_hcd
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: Cannot enable. Maybe the USB cable is bad?
     usb 1-6.1-port1: cannot disable (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: cannot reset (err = -71)
     usb 1-6.1-port1: Cannot enable. Maybe the USB cable is bad?
     usb 1-6.1-port1: cannot disable (err = -71)

2) Some USB devices cannot be enumerated properly. So far I have only
   seen the issue with USB 3.0 devices. The same devices work without
   problem directly connected to the host system, to other systems or to
   other hubs (even when those hubs are connected to the OneLink+ dock).

   One very reliable reproducer is this USB 3.0 HDD enclosure:
   152d:9561 JMicron Technology Corp. / JMicron USA Technology Corp. Mobius

   I have seen it happen sporadically with other USB 3.0 enclosures,
   with controllers from different manufacturers, all self-powered.

   Typical messages in the logs:

     xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
     xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
     usb 2-1.4: device not accepting address 6, error -62
     xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
     xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
     usb 2-1.4: device not accepting address 7, error -62
     usb 2-1-port4: attempt power cycle
     xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
     xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
     usb 2-1.4: device not accepting address 8, error -62
     xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
     xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
     usb 2-1.4: device not accepting address 9, error -62
     usb 2-1-port4: unable to enumerate USB device

Through trial and error, I found that the USB_QUIRK_RESET_RESUME solved
the second issue. Further testing then uncovered the first issue. Test
results are summarized in this table:

=======================================================================================
Settings                        USB2 hotplug    USB3 hotplug    State after waking up
---------------------------------------------------------------------------------------

power/control=auto              works           fails           broken

usbcore.autosuspend=-1          works           works           broken
OR power/control=on

power/control=auto              works (1)       works (1)       works
and USB_QUIRK_RESET_RESUME

power/control=on                works           works           works
and USB_QUIRK_RESET_RESUME

HUB_QUIRK_DISABLE_AUTOSUSPEND   works           works           works
and USB_QUIRK_RESET_RESUME

=======================================================================================

In those results, the power/control settings are applied to both hubs,
both on the USB2 and USB3 side, before each test.

From those results, USB_QUIRK_RESET_RESUME is required to reset the hubs
properly after a suspend-wakeup cycle, and the hubs must not autosuspend
to work around the USB3 issue.

A secondary effect of USB_QUIRK_RESET_RESUME is to prevent the hubs'
upstream links from suspending (the downstream ports can still suspend).
This secondary effect is used in results (1). It is enough to solve the
USB3 problem.

Setting USB_QUIRK_RESET_RESUME on those hubs is the smallest patch that
solves both issues.

Prior to creating this patch, I have used the USB_QUIRK_RESET_RESUME via
the kernel command line for over a year without noticing any side
effect.

Thanks to Oliver Neukum @Suse for explanations of the operations of
USB_QUIRK_RESET_RESUME, and requesting more testing.

Signed-off-by: Jean-Francois Le Fillatre <jflf_kernel@gmx.com>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/20220927073407.5672-1-jflf_kernel@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-26 12:34:19 +02:00
..
accessibility
acpi ACPI: resource: skip IRQ override on AMD Zen platforms 2022-09-20 12:39:42 +02:00
amba
android binder: remove inaccurate mmap_assert_locked() 2022-09-23 14:15:49 +02:00
ata libata: add ATA_HORKAGE_NOLPM for Pioneer BDR-207M and BDR-205 2022-10-05 10:39:38 +02:00
atm
auxdisplay
base driver core: Don't probe devices after bus_type.match() probe deferral 2022-09-08 12:28:07 +02:00
bcma
block xen-blkfront: Cache feature_persistent value before advertisement 2022-09-08 12:28:05 +02:00
bluetooth
bus
cdrom
char random: use expired timer rather than wq for mixing fast pool 2022-10-15 07:59:02 +02:00
clk Revert "clk: ti: Stop using legacy clkctrl names for omap4 and 5" 2022-10-12 09:53:28 +02:00
clocksource
comedi
connector
counter
cpufreq cpufreq: check only freq_table in __resolve_freq() 2022-09-15 11:30:01 +02:00
cpuidle
crypto Revert "crypto: qat - reduce size of mapped region" 2022-10-15 07:59:02 +02:00
cxl
dax devdax: Fix soft-reservation memory description 2022-09-28 11:11:57 +02:00
dca
devfreq
dio
dma dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure 2022-10-12 09:53:27 +02:00
dma-buf udmabuf: Set the DMA mask for the udmabuf device (v2) 2022-09-05 10:30:06 +02:00
edac
eisa
extcon
firewire
firmware firmware: arm_scmi: Add SCMI PM driver remove routine 2022-10-12 09:53:27 +02:00
fpga
fsi
gnss
gpio gpio: mvebu: Fix check for pwm support on non-A8K platforms 2022-10-05 10:39:42 +02:00
gpu drm/amd/display: skip audio setup when audio stream is enabled 2022-10-12 09:53:28 +02:00
greybus
hid hid: intel-ish-hid: ishtp: Fix ishtp client sending disordered message 2022-09-20 12:39:44 +02:00
hsi
hv Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region 2022-09-28 11:11:55 +02:00
hwmon hwmon: (mr75203) enable polling for all VM channels 2022-09-15 11:30:07 +02:00
hwspinlock
hwtracing coresight: etm4x: avoid build failure with unrolled loops 2022-08-25 11:40:35 +02:00
i2c i2c: mlxbf: Fix frequency calculation 2022-09-28 11:11:57 +02:00
i3c
idle
iio iio: pressure: dps310: Reset chip after timeout 2022-10-26 12:34:19 +02:00
infiniband RDMA/irdma: Use s/g array in post send only when its valid 2022-09-20 12:39:46 +02:00
input Input: xpad - fix wireless 360 controller breaking after suspend 2022-10-15 07:59:04 +02:00
interconnect
iommu iommu/vt-d: Check correct capability for sagaw determination 2022-09-28 11:11:42 +02:00
ipack
irqchip irqchip/tegra: Fix overflow implicit truncation warnings 2022-08-25 11:40:32 +02:00
isdn
leds
macintosh
mailbox
mcb
md md: Flush workqueue md_rdev_misc_wq in md_alloc() 2022-09-15 11:30:01 +02:00
media media: v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() 2022-10-05 10:39:40 +02:00
memory
memstick
message
mfd
misc misc: pci_endpoint_test: Fix pci_endpoint_test_{copy,write,read}() panic 2022-10-15 07:59:04 +02:00
mmc mmc: core: Terminate infinite loop in SD-UHS voltage switch 2022-10-12 09:53:28 +02:00
most
mtd mtd: rawnand: atmel: Unmap streaming DMA mappings 2022-10-26 12:34:18 +02:00
mux
net hv_netvsc: Fix race between VF offering and VF association message from host 2022-10-26 12:34:18 +02:00
nfc nfc: pn533: Fix use-after-free bugs caused by pn532_cmd_timeout 2022-08-31 17:16:38 +02:00
ntb
nubus
nvdimm
nvme nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices 2022-10-05 10:39:43 +02:00
nvmem
of of: fdt: fix off-by-one error in unflatten_dt_nodes() 2022-09-23 14:15:46 +02:00
opp
parisc parisc: ccio-dma: Add missing iounmap in error path in ccio_probe() 2022-09-23 14:15:48 +02:00
parport
pci Revert "PCI/portdrv: Don't disable AER reporting in get_port_device_capability()" 2022-09-05 10:30:06 +02:00
pcmcia
perf perf/arm_pmu_platform: fix tests for platform_get_irq() failure 2022-09-20 12:39:45 +02:00
phy phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks 2022-08-25 11:40:39 +02:00
pinctrl pinctrl: sunxi: Fix name for A100 R_PIO 2022-09-23 14:15:47 +02:00
platform platform/x86: acer-wmi: Acer Aspire One AOD270/Packard Bell Dot keymap fixes 2022-09-20 12:39:45 +02:00
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe() 2022-09-23 14:15:50 +02:00
remoteproc
reset reset: imx7: Fix the iMX8MP PCIe PHY PERST support 2022-10-05 10:39:40 +02:00
rpmsg rpmsg: qcom: glink: replace strncpy() with strscpy_pad() 2022-10-12 09:53:28 +02:00
rtc
s390 s390/dasd: fix Oops in dasd_alias_get_start_dev due to missing pavgroup 2022-09-28 11:11:54 +02:00
sbus
scsi scsi: stex: Properly zero out the passthrough command structure 2022-10-15 07:59:01 +02:00
sh
siox
slimbus
soc soc: sunxi: sram: Fix debugfs info for A64 SRAM C 2022-10-05 10:39:41 +02:00
soundwire soundwire: qcom: fix device status array range 2022-09-08 12:28:03 +02:00
spi
spmi
ssb
staging media: rkvdec: Disable H.264 error detection 2022-10-05 10:39:40 +02:00
target
tc
tee tee: fix compiler warning in tee_shm_register() 2022-09-15 11:30:03 +02:00
thermal
thunderbolt thunderbolt: Explicitly reset plug events delay back to USB4 spec value 2022-10-05 10:39:36 +02:00
tty serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting 2022-09-28 11:11:54 +02:00
uio
usb usb: add quirks for Lenovo OneLink+ Dock 2022-10-26 12:34:19 +02:00
vdpa vdpa/ifcvf: fix the calculation of queuepair 2022-10-05 10:39:43 +02:00
vfio vfio/type1: Unpin zero pages 2022-09-15 11:30:02 +02:00
vhost
video video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write 2022-09-23 14:15:51 +02:00
virt vboxguest: Do not use devm for irq 2022-08-25 11:40:33 +02:00
virtio
visorbus
vlynq
vme
w1
watchdog
xen xen/grants: prevent integer overflow in gnttab_dma_alloc_pages() 2022-09-08 12:28:05 +02:00
zorro
Kconfig
Makefile