[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <2006cf6c5662f70ca3348b683551bae4a8e4a0e2.1633343547.git.schowdhu@codeaurora.org>
Date: Mon, 4 Oct 2021 16:46:21 +0530
From: Souradeep Chowdhury <schowdhu@...eaurora.org>
To: linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org,
devicetree@...r.kernel.org,
Bryan O'Donoghue <pure.logic@...us-software.ie>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Greg KH <greg@...ah.com>
Cc: linux-kernel@...r.kernel.org, ckadabi@...eaurora.org,
tsoni@...eaurora.org, bryanh@...eaurora.org,
psodagud@...eaurora.org, satyap@...eaurora.org,
pheragu@...eaurora.org, Rajendra Nayak <rnayak@...eaurora.org>,
Sibi Sankar <sibis@...eaurora.org>,
Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>,
Souradeep Chowdhury <schowdhu@...eaurora.org>
Subject: [PATCH V0 3/7] usb: dwc3: drd: Register the eud connector child node for dwc3
Register the child node for dwc3 which is the "eud_usb_connector".
The eud driver will be able to switch the usb role from device to
host and vice versa using the role switch property of dwc3 node.
Signed-off-by: Souradeep Chowdhury <schowdhu@...eaurora.org>
---
drivers/usb/dwc3/drd.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index d7f7683..f55e473 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -11,6 +11,7 @@
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/property.h>
+#include <linux/of_platform.h>
#include "debug.h"
#include "core.h"
@@ -164,6 +165,27 @@ static int dwc3_otg_get_irq(struct dwc3 *dwc)
return irq;
}
+static int dwc3_register_eud(struct dwc3 *dwc)
+{
+ struct device *dev = dwc->dev;
+ struct device_node *np = dev->of_node, *con_np;
+ int ret;
+
+ con_np = of_get_child_by_name(np, "eud_usb_connector");
+ if (!np) {
+ dev_dbg(dev, "no usb_connector child node specified\n");
+ return 0;
+ }
+
+ ret = of_platform_populate(np, NULL, NULL, dev);
+ if (ret) {
+ dev_err(dev, "failed to register usb_connector - %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
void dwc3_otg_init(struct dwc3 *dwc)
{
u32 reg;
@@ -580,6 +602,9 @@ int dwc3_drd_init(struct dwc3 *dwc)
ret = dwc3_setup_role_switch(dwc);
if (ret < 0)
return ret;
+ ret = dwc3_register_eud(dwc);
+ if (ret < 0)
+ return ret;
} else if (dwc->edev) {
dwc->edev_nb.notifier_call = dwc3_drd_notifier;
ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
Powered by blists - more mailing lists