patch "usb: xhci: only set D3hot for pci device" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usb: xhci: only set D3hot for pci device
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From f2c710f7dca8457e88b4ac9de2060f011254f9dd Mon Sep 17 00:00:00 2001
From: Henry Lin <[email protected]>
Date: Wed, 11 Dec 2019 16:20:04 +0200
Subject: usb: xhci: only set D3hot for pci device
Xhci driver cannot call pci_set_power_state() on non-pci xhci host controllers. For example, NVIDIA Tegra XHCI host controller which acts as platform device with XHCI_SPURIOUS_WAKEUP quirk set in some platform hits this issue during shutdown.
--- drivers/usb/host/xhci-pci.c | 13 +++++++++++++ drivers/usb/host/xhci.c | 7 ++----- drivers/usb/host/xhci.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-pci.c +13 -0
@@ -521,6 +521,18 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) }#endif /* CONFIG_PM */ +static void xhci_pci_shutdown (struct usb_hcd *hcd) +{ +struct xhci_hcd *xhci =hcd_to_xhci (hcd); +struct pci_dev *pdev =to_pci_dev (hcd->self.controller); + +xhci_shutdown (hcd); + +/* Yet another workaround for spurious wakeups at shutdown with HSW */ +if (xhci->quirks &XHCI_SPURIOUS_WAKEUP ) +pci_set_power_state (pdev, PCI_D3hot); +} +/*-------------------------------------------------------------------------*/ /* PCI driver selection metadata; PCI hotplugging uses this */
@@ -556,6 +568,7 @@ static int __init xhci_pci_init(void)#ifdef CONFIG_PM xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend; xhci_pci_hc_driver.pci_resume = xhci_pci_resume; + xhci_pci_hc_driver.shutdown = xhci_pci_shutdown;#endif return pci_register_driver (&xhci_pci_driver); }
drivers/usb/host/xhci.c +2 -5
@@ -770,7 +770,7 @@ static void xhci_stop(struct usb_hcd *hcd)* * This will only ever be called with the main usb_hcd (the USB3 roothub). */ -static void xhci_shutdown (struct usb_hcd *hcd) +void xhci_shutdown (struct usb_hcd *hcd) {struct xhci_hcd *xhci =hcd_to_xhci (hcd);
@@ -789,11 +789,8 @@ static void xhci_shutdown(struct usb_hcd *hcd)xhci_dbg_trace (xhci, trace_xhci_dbg_init,"xhci_shutdown completed - status = %x" ,readl (&xhci->op_regs->status)); - -/* Yet another workaround for spurious wakeups at shutdown with HSW */ -if (xhci->quirks &XHCI_SPURIOUS_WAKEUP ) -pci_set_power_state (to_pci_dev (hcd->self.sysdev), PCI_D3hot); } +EXPORT_SYMBOL_GPL (xhci_shutdown);#ifdef CONFIG_PM static void xhci_save_registers (struct xhci_hcd *xhci)
drivers/usb/host/xhci.h +1 -0
@@ -2050,6 +2050,7 @@ int xhci_start(struct xhci_hcd *xhci);int xhci_reset (struct xhci_hcd *xhci);int xhci_run (struct usb_hcd *hcd);int xhci_gen_setup (struct usb_hcd *hcd,xhci_get_quirks_t get_quirks); +void xhci_shutdown (struct usb_hcd *hcd);void xhci_init_driver (struct hc_driver *drv,const struct xhci_driver_overrides *over);int xhci_disable_slot (struct xhci_hcd *xhci,u32 slot_id);
Signature · 1 line
2.24.1