Thread (11 messages) 11 messages, 3 authors, 2020-08-13

RE: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

From: Jun Li <hidden>
Date: 2020-07-22 14:33:56
Also in: linux-arm-kernel, linux-usb

quoted hunk ↗ jump to hunk
-----Original Message-----
From: Jun Li <redacted>
Sent: Monday, July 6, 2020 5:45 PM
To: balbi@kernel.org; shawnguo@kernel.org; robh+dt@kernel.org
Cc: gregkh@linuxfoundation.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
festevam@gmail.com; dl-linux-imx [off-list ref]; linux-usb@vger.kernel.org;
linux-arm-kernel@lists.infradead.org; devicetree@vger.kernel.org; Peter Chen
[off-list ref]; Anson Huang [off-list ref]; Peng Fan
[off-list ref]; Horia Geanta [off-list ref]
Subject: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass
data

In case dwc3 has SoC specific customizations, dwc3 glue driver can base on compatible
string and pass it via platform data to dwc3 core driver; and pass xhci private
data further to xhci-plat like quirks.

Signed-off-by: Li Jun <redacted>
---
 drivers/usb/dwc3/core.h | 5 +++++
 drivers/usb/dwc3/host.c | 9 +++++++++
 2 files changed, 14 insertions(+)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index
0b8ea8c..3146697 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -29,6 +29,7 @@
 #include <linux/ulpi/interface.h>

 #include <linux/phy/phy.h>
+#include "../host/xhci-plat.h"

 #define DWC3_MSG_MAX	500
@@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
 	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
 };

+struct dwc3_platform_data {
+	struct xhci_plat_priv *xhci_priv;
+};
+
 /**
  * struct dwc3 - representation of our controller
  * @drd_work: workqueue used for role swapping diff --git a/drivers/usb/dwc3/host.c
b/drivers/usb/dwc3/host.c index bef1c1a..4f8514a 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -46,6 +46,7 @@ int dwc3_host_init(struct dwc3 *dwc)  {
 	struct property_entry	props[4];
 	struct platform_device	*xhci;
+	struct dwc3_platform_data *dwc3_pdata;
 	int			ret, irq;
 	struct resource		*res;
 	struct platform_device	*dwc3_pdev = to_platform_device(dwc->dev);
@@ -115,6 +116,14 @@ int dwc3_host_init(struct dwc3 *dwc)
 		}
 	}

+	dwc3_pdata = (struct dwc3_platform_data *)dev_get_platdata(dwc->dev);
+	if (dwc3_pdata && dwc3_pdata->xhci_priv) {
+		ret = platform_device_add_data(xhci, dwc3_pdata->xhci_priv,
+					       sizeof(struct xhci_plat_priv));
+		if (ret)
+			goto err;
+	}
+
 	ret = platform_device_add(xhci);
 	if (ret) {
 		dev_err(dwc->dev, "failed to register xHCI device\n");
--
2.7.4
A gentle ping...

Thanks
Li Jun
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help