diff mbox series

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

Message ID 20230411083145.2214105-1-hhhuuu@google.com
State New
Headers show
Series usb: core: hub: Disable autosuspend for VIA VL813 USB3.0 hub | expand

Commit Message

Jimmy Hu April 11, 2023, 8:31 a.m. UTC
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@google.com>
Cc: stable@vger.kernel.org
---
 drivers/usb/core/hub.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Alan Stern April 11, 2023, 1:55 p.m. UTC | #1
On Tue, Apr 11, 2023 at 08:31:45AM +0000, Jimmy Hu wrote:
> 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

This status value indicates that the port is in the U3 suspend state.  
Maybe the port needs to be put back into U0 before it can be reset.

> [  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.

It may be possible to fix the problem.  You should try that before 
giving up.

Alan Stern
Alan Stern April 12, 2023, 12:35 p.m. UTC | #2
On Wed, Apr 12, 2023 at 09:55:02AM +0800, Jimmy Hu wrote:
> On Tue, Apr 11, 2023 at 9:55 PM Alan Stern <stern@rowland.harvard.edu> wrote:
> >
> > On Tue, Apr 11, 2023 at 08:31:45AM +0000, Jimmy Hu wrote:
> > > 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
> >
> > This status value indicates that the port is in the U3 suspend state.
> > Maybe the port needs to be put back into U0 before it can be reset.
> >
> > > [  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.
> >
> > It may be possible to fix the problem.  You should try that before
> > giving up.
> >
> > Alan Stern
> 
> [  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
> When a USB3 device is connected to the hub,  it did finish the resume
> and should be put back into U0, but it seems to have failed.

Those messages mean the hub's upstream port (the port on the hub which 
connects to the computer) is back in U0.  But I was talking about the 
downstream port (the port on the hub which connects to the device that 
was just plugged in).  That port is in U3.

Alan Stern
diff mbox series

Patch

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,