From 5f0ebd9dfcbee86dbab30f66a79deb862f6ee595 Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Wed, 15 Aug 2018 14:59:55 +0800 Subject: [PATCH] MLK-18794-1 usb: host: xhci: add .bus_suspend override Some platforms (eg: Cadence USB3) have special requirements to add platform USB register setting between xhci_bus_suspend and platform USB controller suspend routine. Eg, The Cadence USB3 needs RX detect clock switch from 24Mhz to 32Khz within 100ms after set port to U3, but sometimes, for USB3 HUB connection, the USB2 bus suspend will cost more than 100ms, and introduce the disconnection before the PHY enters low power mode, then the state is in mess from controller side. So in this commit, we introduce .bus_suspend for xhci_driver_overrides for above use cases. Signed-off-by: Peter Chen (cherry picked from commit f6baa57913ceb40da14a945820cb87e8d6ceb7c7) --- drivers/usb/host/xhci.c | 2 ++ drivers/usb/host/xhci.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 22724f245dd95f..2a5d71374855e1 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -5372,6 +5372,8 @@ void xhci_init_driver(struct hc_driver *drv, drv->reset = over->reset; if (over->start) drv->start = over->start; + if (over->bus_suspend) + drv->bus_suspend = over->bus_suspend; } } EXPORT_SYMBOL_GPL(xhci_init_driver); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 123e728f7750dd..321cf42f50d95c 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1902,6 +1902,7 @@ struct xhci_driver_overrides { size_t extra_priv_size; int (*reset)(struct usb_hcd *hcd); int (*start)(struct usb_hcd *hcd); + int (*bus_suspend)(struct usb_hcd *hcd); }; #define XHCI_CFC_DELAY 10