[PATCH 1/2] Revert "usb: dwc3: dwc3-generic: check the parent nodes"

Alban Bedel alban.bedel at aerq.com
Wed Apr 20 11:17:40 CEST 2022


This reverts commit c08db05455bcb2259849a096acf2e90cce258849.

All the devices supported by this driver use a top glue node with DWC3
devices a subnodes. The imx8mq has no glue device, the DWC3 is
directly on the parent bus. But the DWC3 node might have `port`
subnode to define the connection to type C connectors.

The code added by commit c08db05455bc ("usb: dwc3: dwc3-generic:
check the parent nodes") would let the driver interpret the `port`
subnode as DWC3 nodes, which lead to the need to add code to lookup
properties in the parent node. As this code is base on a
missunderstanding of the binding let's just revert it, a following
commit will add support for standalone DWC3 devices.

Signed-off-by: Alban Bedel <alban.bedel at aerq.com>
---
 drivers/usb/dwc3/dwc3-generic.c | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 01bd0ca190e3..8d53ba779024 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -110,12 +110,7 @@ static int dwc3_generic_of_to_plat(struct udevice *dev)
 	struct dwc3_generic_plat *plat = dev_get_plat(dev);
 	ofnode node = dev_ofnode(dev);
 
-	if (!strncmp(dev->name, "port", 4) || !strncmp(dev->name, "hub", 3)) {
-		/* This is a leaf so check the parent */
-		plat->base = dev_read_addr(dev->parent);
-	} else {
-		plat->base = dev_read_addr(dev);
-	}
+	plat->base = dev_read_addr(dev);
 
 	plat->maximum_speed = usb_get_maximum_speed(node);
 	if (plat->maximum_speed == USB_SPEED_UNKNOWN) {
@@ -125,13 +120,8 @@ static int dwc3_generic_of_to_plat(struct udevice *dev)
 
 	plat->dr_mode = usb_get_dr_mode(node);
 	if (plat->dr_mode == USB_DR_MODE_UNKNOWN) {
-		/* might be a leaf so check the parent for mode */
-		node = dev_ofnode(dev->parent);
-		plat->dr_mode = usb_get_dr_mode(node);
-		if (plat->dr_mode == USB_DR_MODE_UNKNOWN) {
-			pr_err("Invalid usb mode setup\n");
-			return -ENODEV;
-		}
+		pr_err("Invalid usb mode setup\n");
+		return -ENODEV;
 	}
 
 	return 0;
@@ -311,20 +301,16 @@ static int dwc3_glue_bind(struct udevice *parent)
 {
 	ofnode node;
 	int ret;
-	enum usb_dr_mode dr_mode;
-
-	dr_mode = usb_get_dr_mode(dev_ofnode(parent));
 
 	ofnode_for_each_subnode(node, dev_ofnode(parent)) {
 		const char *name = ofnode_get_name(node);
+		enum usb_dr_mode dr_mode;
 		struct udevice *dev;
 		const char *driver = NULL;
 
 		debug("%s: subnode name: %s\n", __func__, name);
 
-		/* if the parent node doesn't have a mode check the leaf */
-		if (!dr_mode)
-			dr_mode = usb_get_dr_mode(node);
+		dr_mode = usb_get_dr_mode(node);
 
 		switch (dr_mode) {
 		case USB_DR_MODE_PERIPHERAL:
@@ -464,7 +450,6 @@ static const struct udevice_id dwc3_glue_ids[] = {
 	{ .compatible = "rockchip,rk3328-dwc3" },
 	{ .compatible = "rockchip,rk3399-dwc3" },
 	{ .compatible = "qcom,dwc3" },
-	{ .compatible = "fsl,imx8mq-dwc3" },
 	{ .compatible = "intel,tangier-dwc3" },
 	{ }
 };
-- 
2.32.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3627 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220420/246a64fc/attachment.bin>


More information about the U-Boot mailing list