On 31/05/2018 08:57, Patrice Chotard wrote:
> From: Patrick Delaunay <patrick.delau...@st.com>
> 
> Don't disable regulator which are tagged as "regulator-always-on" in DT.
> 
> Signed-off-by: Patrick Delaunay <patrick.delau...@st.com>
> Signed-off-by: Patrice Chotard <patrice.chot...@st.com>
> ---
> 
>  drivers/power/regulator/regulator-uclass.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/power/regulator/regulator-uclass.c 
> b/drivers/power/regulator/regulator-uclass.c
> index 4da8e43259fc..4511625ff251 100644
> --- a/drivers/power/regulator/regulator-uclass.c
> +++ b/drivers/power/regulator/regulator-uclass.c
> @@ -106,10 +106,15 @@ int regulator_get_enable(struct udevice *dev)
>  int regulator_set_enable(struct udevice *dev, bool enable)
>  {
>       const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
> +     struct dm_regulator_uclass_platdata *uc_pdata;
>  
>       if (!ops || !ops->set_enable)
>               return -ENOSYS;
>  
> +     uc_pdata = dev_get_uclass_platdata(dev);
> +     if (!enable && uc_pdata->always_on)
> +             return -EACCES;
> +
>       return ops->set_enable(dev, enable);
>  }
>  
> 

Another ping for this, I've just spent a few hours this morning
debugging the firefly-rk3288 failing to boot due to a required regulator
being disabled in the emmc reset routine. I came up with almost the
exact same patch, so

Reviewed-by: Jack Mitchell <j...@embed.me.uk>
Tested-by: Jack Mitchell <j...@embed.me.uk>
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to