Commit 99afef5cf9baffd4c4893f97c86a2eeb93a56dbb

Authored by Pratyush Anand
Committed by Sekhar Nori
1 parent f49a8f271b

dwc3: host: Enable USB3 LPM capability

All dwc3 based xhci host controller supports USB3.0 LPM functionality.
Therefore enable it in platform data for all dwc3 based xhci device if
DWC3_HOST_USB3_LPM_ENABLE is selected in Kconfig.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Showing 2 changed files with 21 additions and 0 deletions Side-by-side Diff

drivers/usb/dwc3/Kconfig
... ... @@ -92,5 +92,12 @@
92 92 help
93 93 Say Y here to enable verbose debugging messages on DWC3 Driver.
94 94  
  95 +config DWC3_HOST_USB3_LPM_ENABLE
  96 + bool "Enable USB3 LPM Capability"
  97 + depends on USB_DWC3_HOST=y || USB_DWC3_DUAL_ROLE=y
  98 + default n
  99 + help
  100 + Select this when you want to enable USB3 LPM with dwc3 xhci host.
  101 +
95 102 endif
drivers/usb/dwc3/host.c
... ... @@ -16,12 +16,14 @@
16 16 */
17 17  
18 18 #include <linux/platform_device.h>
  19 +#include <linux/usb/xhci_pdriver.h>
19 20  
20 21 #include "core.h"
21 22  
22 23 int dwc3_host_init(struct dwc3 *dwc)
23 24 {
24 25 struct platform_device *xhci;
  26 + struct usb_xhci_pdata pdata;
25 27 int ret;
26 28  
27 29 xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO);
... ... @@ -43,6 +45,18 @@
43 45 DWC3_XHCI_RESOURCES_NUM);
44 46 if (ret) {
45 47 dev_err(dwc->dev, "couldn't add resources to xHCI device\n");
  48 + goto err1;
  49 + }
  50 +
  51 + memset(&pdata, 0, sizeof(pdata));
  52 +
  53 +#ifdef CONFIG_DWC3_HOST_USB3_LPM_ENABLE
  54 + pdata.usb3_lpm_capable = 1;
  55 +#endif
  56 +
  57 + ret = platform_device_add_data(xhci, &pdata, sizeof(pdata));
  58 + if (ret) {
  59 + dev_err(dwc->dev, "couldn't add platform data to xHCI device\n");
46 60 goto err1;
47 61 }
48 62