]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
USB: core: Disable LPM only for non-suspended ports
authorKai-Heng Feng <kaihengf@nvidia.com>
Fri, 6 Dec 2024 07:48:17 +0000 (15:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2025 12:34:45 +0000 (13:34 +0100)
commit 59bfeaf5454b7e764288d84802577f4a99bf0819 upstream.

There's USB error when tegra board is shutting down:
[  180.919315] usb 2-3: Failed to set U1 timeout to 0x0,error code -113
[  180.919995] usb 2-3: Failed to set U1 timeout to 0xa,error code -113
[  180.920512] usb 2-3: Failed to set U2 timeout to 0x4,error code -113
[  186.157172] tegra-xusb 3610000.usb: xHCI host controller not responding, assume dead
[  186.157858] tegra-xusb 3610000.usb: HC died; cleaning up
[  186.317280] tegra-xusb 3610000.usb: Timeout while waiting for evaluate context command

The issue is caused by disabling LPM on already suspended ports.

For USB2 LPM, the LPM is already disabled during port suspend. For USB3
LPM, port won't transit to U1/U2 when it's already suspended in U3,
hence disabling LPM is only needed for ports that are not suspended.

Cc: Wayne Chang <waynec@nvidia.com>
Cc: stable <stable@kernel.org>
Fixes: d920a2ed8620 ("usb: Disable USB3 LPM at shutdown")
Signed-off-by: Kai-Heng Feng <kaihengf@nvidia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20241206074817.89189-1-kaihengf@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/port.c

index 0007031fad0de15f563ffd1676035d9b463a35b6..0c97f15adfc8a2c9966f09e528fe80187215a76e 100644 (file)
@@ -412,10 +412,11 @@ static int usb_port_runtime_suspend(struct device *dev)
 static void usb_port_shutdown(struct device *dev)
 {
        struct usb_port *port_dev = to_usb_port(dev);
+       struct usb_device *udev = port_dev->child;
 
-       if (port_dev->child) {
-               usb_disable_usb2_hardware_lpm(port_dev->child);
-               usb_unlocked_disable_lpm(port_dev->child);
+       if (udev && !udev->port_is_suspended) {
+               usb_disable_usb2_hardware_lpm(udev);
+               usb_unlocked_disable_lpm(udev);
        }
 }