diff mbox series

usb: ehci-mx6: remove unnecessary regulator enable from probe

Message ID 20230519185854.1013521-1-tharvey@gateworks.com
State Accepted
Commit a6a74ce09b4aded73151049bc8083a580fc1cf55
Delegated to: Stefano Babic
Headers show
Series usb: ehci-mx6: remove unnecessary regulator enable from probe | expand

Commit Message

Tim Harvey May 19, 2023, 6:58 p.m. UTC
Remove the regulator_set_enable() call from device probe which
resolves a regulator imbalance. This is unnecessary as
regulator_set_enable() will be called when ehci_register calls the
init_after_reset hook.

Suggested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/usb/host/ehci-mx6.c | 16 ----------------
 1 file changed, 16 deletions(-)

Comments

Tim Harvey July 13, 2023, 5:14 p.m. UTC | #1
On Fri, May 19, 2023 at 11:59 AM Tim Harvey <tharvey@gateworks.com> wrote:
>
> Remove the regulator_set_enable() call from device probe which
> resolves a regulator imbalance. This is unnecessary as
> regulator_set_enable() will be called when ehci_register calls the
> init_after_reset hook.
>
> Suggested-by: Marek Vasut <marex@denx.de>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  drivers/usb/host/ehci-mx6.c | 16 ----------------
>  1 file changed, 16 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> index fae20838c60a..a9ed5e7a0d53 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -709,18 +709,6 @@ static int ehci_usb_probe(struct udevice *dev)
>                 goto err_regulator;
>  #endif
>
> -#if CONFIG_IS_ENABLED(DM_REGULATOR)
> -       if (priv->vbus_supply) {
> -               ret = regulator_set_enable(priv->vbus_supply,
> -                                          (type == USB_INIT_DEVICE) ?
> -                                          false : true);
> -               if (ret && ret != -ENOSYS) {
> -                       printf("Error enabling VBUS supply (ret=%i)\n", ret);
> -                       goto err_clk;
> -               }
> -       }
> -#endif
> -
>         if (priv->init_type == USB_INIT_HOST) {
>                 setbits_le32(&ehci->usbmode, CM_HOST);
>                 writel(mx6_portsc(priv->phy_type), &ehci->portsc);
> @@ -744,10 +732,6 @@ err_phy:
>         generic_shutdown_phy(&priv->phy);
>  err_regulator:
>  #endif
> -#if CONFIG_IS_ENABLED(DM_REGULATOR)
> -       if (priv->vbus_supply)
> -               regulator_set_enable(priv->vbus_supply, false);
> -#endif
>  err_clk:
>  #if CONFIG_IS_ENABLED(CLK)
>         clk_disable(&priv->clk);
> --
> 2.25.1
>

Hi Marek,

I think this goes in your tree. It got delegated to Stefano in
patchwork but I'm not sure why as you maintain USB.

best regards,

Tim
Marek Vasut July 13, 2023, 5:53 p.m. UTC | #2
On 7/13/23 19:14, Tim Harvey wrote:
> On Fri, May 19, 2023 at 11:59 AM Tim Harvey <tharvey@gateworks.com> wrote:
>>
>> Remove the regulator_set_enable() call from device probe which
>> resolves a regulator imbalance. This is unnecessary as
>> regulator_set_enable() will be called when ehci_register calls the
>> init_after_reset hook.
>>
>> Suggested-by: Marek Vasut <marex@denx.de>
>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>> ---
>>   drivers/usb/host/ehci-mx6.c | 16 ----------------
>>   1 file changed, 16 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
>> index fae20838c60a..a9ed5e7a0d53 100644
>> --- a/drivers/usb/host/ehci-mx6.c
>> +++ b/drivers/usb/host/ehci-mx6.c
>> @@ -709,18 +709,6 @@ static int ehci_usb_probe(struct udevice *dev)
>>                  goto err_regulator;
>>   #endif
>>
>> -#if CONFIG_IS_ENABLED(DM_REGULATOR)
>> -       if (priv->vbus_supply) {
>> -               ret = regulator_set_enable(priv->vbus_supply,
>> -                                          (type == USB_INIT_DEVICE) ?
>> -                                          false : true);
>> -               if (ret && ret != -ENOSYS) {
>> -                       printf("Error enabling VBUS supply (ret=%i)\n", ret);
>> -                       goto err_clk;
>> -               }
>> -       }
>> -#endif
>> -
>>          if (priv->init_type == USB_INIT_HOST) {
>>                  setbits_le32(&ehci->usbmode, CM_HOST);
>>                  writel(mx6_portsc(priv->phy_type), &ehci->portsc);
>> @@ -744,10 +732,6 @@ err_phy:
>>          generic_shutdown_phy(&priv->phy);
>>   err_regulator:
>>   #endif
>> -#if CONFIG_IS_ENABLED(DM_REGULATOR)
>> -       if (priv->vbus_supply)
>> -               regulator_set_enable(priv->vbus_supply, false);
>> -#endif
>>   err_clk:
>>   #if CONFIG_IS_ENABLED(CLK)
>>          clk_disable(&priv->clk);
>> --
>> 2.25.1
>>
> 
> Hi Marek,
> 
> I think this goes in your tree. It got delegated to Stefano in
> patchwork but I'm not sure why as you maintain USB.

Applied to usb/master, thanks for the reminder (I really appreciate that)
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index fae20838c60a..a9ed5e7a0d53 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -709,18 +709,6 @@  static int ehci_usb_probe(struct udevice *dev)
 		goto err_regulator;
 #endif
 
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-	if (priv->vbus_supply) {
-		ret = regulator_set_enable(priv->vbus_supply,
-					   (type == USB_INIT_DEVICE) ?
-					   false : true);
-		if (ret && ret != -ENOSYS) {
-			printf("Error enabling VBUS supply (ret=%i)\n", ret);
-			goto err_clk;
-		}
-	}
-#endif
-
 	if (priv->init_type == USB_INIT_HOST) {
 		setbits_le32(&ehci->usbmode, CM_HOST);
 		writel(mx6_portsc(priv->phy_type), &ehci->portsc);
@@ -744,10 +732,6 @@  err_phy:
 	generic_shutdown_phy(&priv->phy);
 err_regulator:
 #endif
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-	if (priv->vbus_supply)
-		regulator_set_enable(priv->vbus_supply, false);
-#endif
 err_clk:
 #if CONFIG_IS_ENABLED(CLK)
 	clk_disable(&priv->clk);