Skip to contentSkip to conversation

usb: dwc: host: add xhci_plat_priv quirk XHCI_SKIP_PHY_INIT

PATCH In review Sandeep Maheswaram 2 participants 3 messages Oct 11, 2021 – Oct 14, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc: host: add xhci_plat_priv quirk XHCI_SKIP_PHY_INIT

dwc3 manages PHY by own DRD driver, so skip the management by HCD core.
During runtime suspend phy was not getting suspend because runtime_usage value is 2.

---
 drivers/usb/dwc3/host.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/usb/dwc3/host.c +12 -0
index f29a264..0921f05 100644
@@ -11,6 +11,11 @@
 #include <linux/platform_device.h>
 
 #include "core.h"
+#include "../host/xhci-plat.h"
+
+static const struct xhci_plat_priv xhci_plat_dwc3_xhci = {
+	.quirks = XHCI_SKIP_PHY_INIT,
+};
 
 static int dwc3_host_get_irq(struct dwc3 *dwc)
 {
@@ -115,6 +120,13 @@ int dwc3_host_init(struct dwc3 *dwc)
 		}
 	}
 
+	ret = platform_device_add_data(xhci, &xhci_plat_dwc3_xhci,
+			sizeof(struct xhci_plat_priv));
+	if (ret) {
+		dev_err(dwc->dev, "failed to add data to xHCI\n");
+		goto err;
+	}
+
 	ret = platform_device_add(xhci);
 	if (ret) {
 		dev_err(dwc->dev, "failed to register xHCI device\n");
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw
Quoted 15 lines · Sandeep Maheswaram

dwc3 manages PHY by own DRD driver, so skip the management by HCD core.
During runtime suspend phy was not getting suspend because runtime_usage value is 2.

---
 drivers/usb/dwc3/host.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/usb/dwc3/host.c +0 -0
index f29a264..0921f05 100644

drivers/usb/dwc3/host.c line 14

Quoted 4 lines
drivers/usb/dwc3/host.c +1 -0
@@ -11,6 +11,11 @@
 #include <linux/platform_device.h>
 
 #include "core.h"
+#include "../host/xhci-plat.h"

Why are you tying the dwc3 driver to the xhci driver?

drivers/usb/dwc3/host.c line 17

Quoted 3 lines
drivers/usb/dwc3/host.c +3 -0
+
+static const struct xhci_plat_priv xhci_plat_dwc3_xhci = {
+	.quirks = XHCI_SKIP_PHY_INIT,

If these quirks are now "global", they should go into a include/linux/usb/ .h file, right?

thanks,

greg k-h

#2 lore raw

Hi,

Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Sandeep Maheswaram

dwc3 manages PHY by own DRD driver, so skip the management by HCD core.
During runtime suspend phy was not getting suspend because runtime_usage value is 2.

---
  drivers/usb/dwc3/host.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
drivers/usb/dwc3/host.c +0 -0
index f29a264..0921f05 100644
@@ -11,6 +11,11 @@
  #include <linux/platform_device.h>
 
Quoted 4 lines

drivers/usb/dwc3/host.c line 14

Quoted 2 lines
drivers/usb/dwc3/host.c +1 -0
  #include "core.h"
+#include "../host/xhci-plat.h"

Why are you tying the dwc3 driver to the xhci driver?

Can we add a  property usb-skip-phy-init  in drivers/usb/dwc3/host.c

props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb-skip-phy-init");

and set the quirk like this in xhci-plat.c

if (device_property_read_bool(tmpdev, "usb-skip-phy-init")) xhci->quirks |= XHCI_SKIP_PHY_INIT;

as below

if (device_property_read_bool(tmpdev, "usb2-lpm-disable")) xhci->quirks |= XHCI_HW_LPM_DISABLE;

 if (device_property_read_bool(tmpdev, "usb3-lpm-capable")) xhci->quirks |= XHCI_LPM_SUPPORT;

Quoted 9 lines

drivers/usb/dwc3/host.c line 17

Quoted 3 lines
drivers/usb/dwc3/host.c +3 -0
+
+static const struct xhci_plat_priv xhci_plat_dwc3_xhci = {
+	.quirks = XHCI_SKIP_PHY_INIT,

If these quirks are now "global", they should go into a include/linux/usb/ .h file, right?

thanks,

greg k-h