On 8/20/26 5:10 PM, Bruno Banelli wrote:
Since commit 4fcba5d556b4 ("regulator: implement basic reference
counter") regulator_set_enable() returns -EALREADY when a fixed or
GPIO regulator has already been enabled. On boards whose VBUS
regulator carries regulator-always-on or regulator-boot-on -
armada-8040-mcbin.dts is one - regulator_autoset() enables it during
the regulator's own probe, so the subsequent enable in xhci_usb_probe()
fails and the controller is never registered:

   starting USB...
   Failed to turn ON the VBUS regulator
   Bus usb3@500000: probe failed, error -114
   No USB controllers found

Use regulator_set_enable_if_allowed(), which tolerates -EALREADY, in
the same way as commit 0830333c4743 ("usb: ehci-generic: Use
regulator_set_enable_if_allowed") and the other drivers converted
after the reference counter was introduced.

Tested on a SolidRun MACCHIATObin (Armada 8040), where USB mass
storage now enumerates.

Fixes: 4fcba5d556b4 ("regulator: implement basic reference counter")
Signed-off-by: Bruno Banelli <[email protected]>
---
  drivers/usb/host/xhci-mvebu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
index c294a56b3c..53b3e82b66 100644
--- a/drivers/usb/host/xhci-mvebu.c
+++ b/drivers/usb/host/xhci-mvebu.c
@@ -51,7 +51,7 @@ static int xhci_usb_probe(struct udevice *dev)
ret = device_get_supply_regulator(dev, "vbus-supply", &regulator);
        if (!ret) {
-               ret = regulator_set_enable(regulator, true);
+               ret = regulator_set_enable_if_allowed(regulator, true);
                if (ret) {
                        printf("Failed to turn ON the VBUS regulator\n");
Do you need to handle -ENOSYS return value here ?

Reply via email to