Skip to content

Commit 34cd2db

Browse files
matnymangregkh
authored andcommitted
xhci: Add quirk to reset host back to default state at shutdown
Systems based on Alder Lake P see significant boot time delay if boot firmware tries to control usb ports in unexpected link states. This is seen with self-powered usb devices that survive in U3 link suspended state over S5. A more generic solution to power off ports at shutdown was attempted in commit 83810f8 ("xhci: turn off port power in shutdown") but it caused regression. Add host specific XHCI_RESET_TO_DEFAULT quirk which will reset host and ports back to default state in shutdown. Cc: stable@vger.kernel.org Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20221024142720.4122053-3-mathias.nyman@intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4f54747 commit 34cd2db

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

drivers/usb/host/xhci-pci.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
257257
pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI))
258258
xhci->quirks |= XHCI_MISSING_CAS;
259259

260+
if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
261+
pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)
262+
xhci->quirks |= XHCI_RESET_TO_DEFAULT;
263+
260264
if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
261265
(pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI ||
262266
pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI ||

drivers/usb/host/xhci.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,15 @@ void xhci_shutdown(struct usb_hcd *hcd)
810810

811811
spin_lock_irq(&xhci->lock);
812812
xhci_halt(xhci);
813-
/* Workaround for spurious wakeups at shutdown with HSW */
814-
if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
813+
814+
/*
815+
* Workaround for spurious wakeps at shutdown with HSW, and for boot
816+
* firmware delay in ADL-P PCH if port are left in U3 at shutdown
817+
*/
818+
if (xhci->quirks & XHCI_SPURIOUS_WAKEUP ||
819+
xhci->quirks & XHCI_RESET_TO_DEFAULT)
815820
xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
821+
816822
spin_unlock_irq(&xhci->lock);
817823

818824
xhci_cleanup_msix(xhci);

drivers/usb/host/xhci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,7 @@ struct xhci_hcd {
18971897
#define XHCI_BROKEN_D3COLD BIT_ULL(41)
18981898
#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42)
18991899
#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43)
1900+
#define XHCI_RESET_TO_DEFAULT BIT_ULL(44)
19001901

19011902
unsigned int num_active_eps;
19021903
unsigned int limit_active_eps;

0 commit comments

Comments
 (0)