[PATCH] usb: core: hub: Disable autosuspend for VIA VL813 USB3.0 hub

From: Jimmy Hu
Date: Tue Apr 11 2023 - 04:31:58 EST


The VIA VL813 USB3.0 hub appears to have an issue with autosuspend and
detecting USB3 devices. This can be reproduced by connecting a USB3
device to the hub after the hub enters autosuspend mode.

//connect the hub
[ 106.854204] usb 2-1: new SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[ 107.084993] usb 2-1: New USB device found, idVendor=2109, idProduct=0813, bcdDevice=90.15
[ 107.094520] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 107.111836] usb 2-1: Product: USB3.0 Hub
[ 107.116835] usb 2-1: Manufacturer: VIA Labs, Inc.
[ 107.314230] hub 2-1:1.0: USB hub found
[ 107.321356] hub 2-1:1.0: 4 ports detected

//the hub enters autosuspend mode
[ 107.738873] hub 2-1:1.0: hub_suspend
[ 107.922097] usb 2-1: usb auto-suspend, wakeup 1

//connect a USB3 device
[ 133.120060] usb 2-1: usb wakeup-resume
[ 133.160033] usb 2-1: Waited 0ms for CONNECT
[ 133.165423] usb 2-1: finish resume
[ 133.176919] hub 2-1:1.0: hub_resume
[ 133.188026] usb 2-1-port3: status 0263 change 0041
[ 133.323585] hub 2-1:1.0: state 7 ports 4 chg 0008 evt 0008
[ 133.342423] usb 2-1-port3: link state change
[ 133.358154] usb 2-1-port3: status 0263, change 0040, 5.0 Gb/s
[ 133.875150] usb 2-1-port3: not reset yet, waiting 10ms
[ 133.895502] usb 2-1-port3: not reset yet, waiting 10ms
[ 133.918239] usb 2-1-port3: not reset yet, waiting 200ms
[ 134.139529] usb 2-1-port3: not reset yet, waiting 200ms
[ 134.365296] usb 2-1-port3: not reset yet, waiting 200ms
[ 134.590185] usb 2-1-port3: not reset yet, waiting 200ms
[ 134.641330] hub 2-1:1.0: state 7 ports 4 chg 0000 evt 0008
[ 134.658880] hub 2-1:1.0: hub_suspend
[ 134.792908] usb 2-1: usb auto-suspend, wakeup 1

Disabling autosuspend for this hub resolves the issue.

Signed-off-by: Jimmy Hu <hhhuuu@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
drivers/usb/core/hub.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 97a0f8faea6e..5c6455224d9d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -47,6 +47,8 @@
#define USB_VENDOR_TEXAS_INSTRUMENTS 0x0451
#define USB_PRODUCT_TUSB8041_USB3 0x8140
#define USB_PRODUCT_TUSB8041_USB2 0x8142
+#define USB_VENDOR_VIA 0x2109
+#define USB_PRODUCT_VL813_USB3 0x0813
#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01
#define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02

@@ -5866,6 +5868,11 @@ static const struct usb_device_id hub_id_table[] = {
.idVendor = USB_VENDOR_TEXAS_INSTRUMENTS,
.idProduct = USB_PRODUCT_TUSB8041_USB3,
.driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
+ { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
+ | USB_DEVICE_ID_MATCH_PRODUCT,
+ .idVendor = USB_VENDOR_VIA,
+ .idProduct = USB_PRODUCT_VL813_USB3,
+ .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
{ .match_flags = USB_DEVICE_ID_MATCH_DEV_CLASS,
.bDeviceClass = USB_CLASS_HUB},
{ .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS,
--
2.40.0.577.gac1e443424-goog