• Mathias Nyman's avatar
    usb: xhci: Prevent bus suspend if a port connect change or polling state is detected · cf0f464f
    Mathias Nyman authored
    commit 2f31a67f01a8beb22cae754c53522cb61a005750 upstream.
    USB3 roothub might autosuspend before a plugged USB3 device is detected,
    causing USB3 device enumeration failure.
    USB3 devices don't show up as connected and enabled until USB3 link trainig
    completes. On a fast booting platform with a slow USB3 link training the
    link might reach the connected enabled state just as the bus is suspending.
    If this device is discovered first time by the xhci_bus_suspend() routine
    it will be put to U3 suspended state like the other ports which failed to
    suspend earlier.
    The hub thread will notice the connect change and resume the bus,
    moving the port back to U0
    This U0 -> U3 -> U0 transition right after being connected seems to be
    too much for some devices, causing them to first go to SS.Inactive state,
    and finally end up stuck in a polling state with reset asserted
    Fix this by failing the bus suspend if a port has a connect change or is
    in a polling state in xhci_bus_suspend().
    Don't do any port changes until all ports are checked, buffer all port
    changes and only write them in the end if suspend can proceed
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
xhci-hub.c 44.3 KB