Skip to contentSkip to conversation

usb: dwc3: Fix non-usb3 configurations

PATCH In review Jan Kiszka 2 participants 2 messages Apr 25, 2022

Subsystems (2)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 usb: dwc3: Fix non-usb3 configurations

From: Jan Kiszka <[email protected]>

Missing nodes may also be signaled via -ENODATA. We need to check for that to prevent failing in non-usb3 setups.

Furthermore, dev.phy must be NULL'ed in case usb3-phy was not found.

Fixes 142d50fbce7c ("usb: dwc3: Add support for usb3-phy PHY configuration")
---
 drivers/usb/dwc3/dwc3-generic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-generic.c +3 -1
index 6e1a1d066b4..c5310e465cb 100644
@@ -468,9 +468,11 @@ static int dwc3_glue_probe(struct udevice *dev)
 		ret = generic_phy_init(&phy);
 		if (ret)
 			return ret;
-	} else if (ret != -ENOENT) {
+	} else if (ret != -ENOENT && ret != -ENODATA) {
 		debug("could not get phy (err %d)\n", ret);
 		return ret;
+	} else {
+		phy.dev = NULL;
 	}
 
 	glue->regs = dev_read_addr(dev);
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Missing nodes may also be signaled via -ENODATA. We need to check for that to prevent failing in non-usb3 setups.

Furthermore, dev.phy must be NULL'ed in case usb3-phy was not found.

Fixes 142d50fbce7c ("usb: dwc3: Add support for usb3-phy PHY configuration")
---
  drivers/usb/dwc3/dwc3-generic.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-generic.c +0 -0
index 6e1a1d066b4..c5310e465cb 100644
@@ -468,9 +468,11 @@ static int dwc3_glue_probe(struct udevice *dev)
  		ret = generic_phy_init(&phy);
  		if (ret)

drivers/usb/dwc3/dwc3-generic.c static int dwc3_glue_probe(struct udevice *dev) · line 478

Quoted 10 lines
drivers/usb/dwc3/dwc3-generic.c +3 -1
  			return ret;
-	} else if (ret != -ENOENT) {
+	} else if (ret != -ENOENT && ret != -ENODATA) {
  		debug("could not get phy (err %d)\n", ret);
  		return ret;
+	} else {
+		phy.dev = NULL;
  	}
 
  	glue->regs = dev_read_addr(dev);

Thanks,
Michal