[PATCH] usb: dwc3-meson-g12a: Use regulator_set_enable_if_allowed

Jaehoon Chung jh80.chung at samsung.com
Wed Nov 1 12:04:09 CET 2023


Some meson targets are using a fixed regulator about usb.
It's always returning to EARLEADY, so driver doesn't init fine.
To prevent this problem, use the regulator_set_enable_if_allowed
instead of regulator_set_enable.

Fixes: 4fcba5d556b ("regulator: implement basic reference counter")

Signed-off-by: Jaehoon Chung <jh80.chung at samsung.com>
---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index e0356e653fcc..59276483c19d 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -291,7 +291,7 @@ int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
 
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (priv->vbus_supply) {
-		int ret = regulator_set_enable(priv->vbus_supply,
+		int ret = regulator_set_enable_if_allowed(priv->vbus_supply,
 					(mode == USB_DR_MODE_PERIPHERAL));
 		if (ret)
 			return ret;
@@ -420,7 +420,7 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
 	}
 
 	if (priv->vbus_supply) {
-		ret = regulator_set_enable(priv->vbus_supply, true);
+		ret = regulator_set_enable_if_allowed(priv->vbus_supply, true);
 		if (ret)
 			return ret;
 	}
-- 
2.25.1



More information about the U-Boot mailing list