]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xhci: Fix port resume done detection for SS ports with LPM enabled
authorMathias Nyman <mathias.nyman@linux.intel.com>
Fri, 22 Mar 2019 15:50:15 +0000 (17:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2019 04:23:28 +0000 (06:23 +0200)
commit 6cbcf596934c8e16d6288c7cc62dfb7ad8eadf15 upstream.

A suspended SS port in U3 link state will go to U0 when resumed, but
can almost immediately after that enter U1 or U2 link power save
states before host controller driver reads the port status.

Host controller driver only checks for U0 state, and might miss
the finished resume, leaving flags unclear and skip notifying usb
code of the wake.

Add U1 and U2 to the possible link states when checking for finished
port resume.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.h

index 845fa426fa0dec61e7fd6496efe0117a0f8eeab8..80192698df8746b9dd6e71fa5b4aec4a00593301 100644 (file)
@@ -1642,10 +1642,13 @@ static void handle_port_status(struct xhci_hcd *xhci,
                }
        }
 
-       if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_U0 &&
-                       DEV_SUPERSPEED_ANY(temp)) {
+       if ((temp & PORT_PLC) &&
+           DEV_SUPERSPEED_ANY(temp) &&
+           ((temp & PORT_PLS_MASK) == XDEV_U0 ||
+            (temp & PORT_PLS_MASK) == XDEV_U1 ||
+            (temp & PORT_PLS_MASK) == XDEV_U2)) {
                xhci_dbg(xhci, "resume SS port %d finished\n", port_id);
-               /* We've just brought the device into U0 through either the
+               /* We've just brought the device into U0/1/2 through either the
                 * Resume state after a device remote wakeup, or through the
                 * U3Exit state after a host-initiated resume.  If it's a device
                 * initiated remote wake, don't pass up the link state change,
index 0635cea42e6f944a97e4fd2df510f1f48a665d31..b57bee70cdef26f360e22f9d4aca467cc9658143 100644 (file)
@@ -309,6 +309,7 @@ struct xhci_op_regs {
  */
 #define PORT_PLS_MASK  (0xf << 5)
 #define XDEV_U0                (0x0 << 5)
+#define XDEV_U1                (0x1 << 5)
 #define XDEV_U2                (0x2 << 5)
 #define XDEV_U3                (0x3 << 5)
 #define XDEV_INACTIVE  (0x6 << 5)