From 8bf2c6841d42095a8d157b192460128e874a6972 Mon Sep 17 00:00:00 2001 From: Wu Liang feng Date: Mon, 16 May 2016 18:06:03 +0800 Subject: [PATCH] usb: host: xhci-plat: set xhci suspend quirk based on platform data If an xhci platform need an extraordinary delay to wait for xHCI enter the Halted state after the Run/Stop (R/S) bit is cleared to '0', then enable XHCI_SLOW_SUSPEND quirk flag. Change-Id: If37fe7b7b37cc3c573361f4ef522404ebe39991e Signed-off-by: Wu Liang feng --- drivers/usb/host/xhci-plat.c | 10 ++++++++++ include/linux/usb/xhci_pdriver.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 05647e6753cd..9fe957a1b10c 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -38,12 +38,22 @@ static const struct xhci_driver_overrides xhci_plat_overrides __initconst = { static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) { + struct usb_xhci_pdata *pdata = dev_get_platdata(dev); + /* * As of now platform drivers don't provide MSI support so we ensure * here that the generic code does not try to make a pci_dev from our * dev struct in order to setup MSI */ xhci->quirks |= XHCI_PLAT; + + /* + * On some xHCI controllers (e.g. Rockchip SoCs), it need an + * extraordinary delay to wait for xHCI enter the Halted state + * after the Run/Stop (R/S) bit is cleared to '0'. + */ + if (pdata && pdata->xhci_slow_suspend) + xhci->quirks |= XHCI_SLOW_SUSPEND; } /* called during probe() after chip reset completes */ diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h index 376654b5b0f7..6b3c1046b8e0 100644 --- a/include/linux/usb/xhci_pdriver.h +++ b/include/linux/usb/xhci_pdriver.h @@ -18,10 +18,14 @@ * * @usb3_lpm_capable: determines if this xhci platform supports USB3 * LPM capability + * @xhci_slow_suspend: set if this xhci platform need an extraordinary + * delay to wait for xHC enter the Halted state + * after the Run/Stop (R/S) bit is cleared to '0'. * */ struct usb_xhci_pdata { unsigned usb3_lpm_capable:1; + unsigned xhci_slow_suspend:1; }; #endif /* __USB_CORE_XHCI_PDRIVER_H */ -- 2.34.1