It does not make sense to allow disable of a regulator that is defined always on.
I found this because the new mmc code that tests if the mmc power can be switched off. That results in the rk3288 firefly board to die since the regulator, which is always-on, is shared with more than just mmc. Signed-off-by: Richard Röjfors <rich...@puffinpack.se> --- 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 4da8e43259..d5be6ef424 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 (uc_pdata->always_on && !enable) + return -EINVAL; + return ops->set_enable(dev, enable); } -- 2.19.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot