usb: ehci-mx6: Use regulator_set_enable_if_allowed

With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter") the return value of regulator_set_enable may be EALREADY or
EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to
continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
This commit is contained in:
Marek Vasut 2025-01-07 23:56:08 +01:00
parent b20c51bc45
commit addcb09fd5

View File

@ -479,9 +479,9 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
#if CONFIG_IS_ENABLED(DM_REGULATOR) #if CONFIG_IS_ENABLED(DM_REGULATOR)
if (priv->vbus_supply) { if (priv->vbus_supply) {
int ret; int ret;
ret = regulator_set_enable(priv->vbus_supply, ret = regulator_set_enable_if_allowed(priv->vbus_supply,
(type == USB_INIT_DEVICE) ? (type == USB_INIT_DEVICE) ?
false : true); false : true);
if (ret && ret != -ENOSYS) { if (ret && ret != -ENOSYS) {
printf("Error enabling VBUS supply (ret=%i)\n", ret); printf("Error enabling VBUS supply (ret=%i)\n", ret);
return ret; return ret;