Skip to contentSkip to conversation

usb: ehci-mx6: Handle fixed regulators correctly

PATCH New Marek Vasut 1 participant 2 messages May 21, 2020

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

PATCH 1/2 usb: ehci-mx6: Handle fixed regulators correctly

The regulator-fixed would return -ENOSYS when enabled/disabled, because this operation is not supported, but this is not an error e.g. on systems where the VBUS cannot be controlled, so if this is the error code reported by the regulator core, consider it a success and continue.

---
 drivers/usb/host/ehci-mx6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-mx6.c +2 -2
index 24f8ad7af8..470eddd0c9 100644
@@ -447,7 +447,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
 		ret = regulator_set_enable(priv->vbus_supply,
 					   (type == USB_INIT_DEVICE) ?
 					   false : true);
-		if (ret) {
+		if (ret && ret != -ENOSYS) {
 			puts("Error enabling VBUS supply\n");
 			return ret;
 		}
@@ -614,7 +614,7 @@ static int ehci_usb_probe(struct udevice *dev)
 		ret = regulator_set_enable(priv->vbus_supply,
 					   (type == USB_INIT_DEVICE) ?
 					   false : true);
-		if (ret) {
+		if (ret && ret != -ENOSYS) {
 			puts("Error enabling VBUS supply\n");
 			return ret;
 		}
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 usb: ehci-mx6: Print error code on failure

Print the error code if the regulator enable fails, otherwise the error message is rather useless and confusing.

---
 drivers/usb/host/ehci-mx6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-mx6.c +2 -2
index 470eddd0c9..5f84c7b91d 100644
@@ -448,7 +448,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
 					   (type == USB_INIT_DEVICE) ?
 					   false : true);
 		if (ret && ret != -ENOSYS) {
-			puts("Error enabling VBUS supply\n");
+			printf("Error enabling VBUS supply (ret=%i)\n", ret);
 			return ret;
 		}
 	}
@@ -615,7 +615,7 @@ static int ehci_usb_probe(struct udevice *dev)
 					   (type == USB_INIT_DEVICE) ?
 					   false : true);
 		if (ret && ret != -ENOSYS) {
-			puts("Error enabling VBUS supply\n");
+			printf("Error enabling VBUS supply (ret=%i)\n", ret);
 			return ret;
 		}
 	}
Signature · 1 line
2.25.1