[PATCH] usb: ehci-mx6: replace regulator_set_enable with *_if_allowed

Eugen Hristev eugen.hristev at collabora.com
Tue May 2 12:41:11 CEST 2023


On 5/2/23 12:18, Marek Vasut wrote:
> On 5/2/23 08:51, Eugen Hristev wrote:
>> regulator_set_enable_if_allowed already handles cases when the
>> regulator is already enabled, or already disabled, and does not
>> treat these as errors.
>> With this change, the driver can work correctly even if the regulator
>> is already taken or already disabled by another consumer.
> 
> Can that ever happen for Vbus supply (the 5V coming out of USB port) ?
> Can you elaborate how ?


Hi Marek,

Recently I developed a series of patches to add a reference counter for 
regulators :

https://marc.info/?l=u-boot&m=168191189309879&w=2

But with this series, having a regulator already enabled or already 
disabled results in an error returned by regulator_set_enable

Hence, one option is to replace calls with regulator_set_enable_if_allowed

There is a discussion ongoing here:

https://marc.info/?l=u-boot&m=168295920316621&w=2


Eugen


More information about the U-Boot mailing list