[PATCH v2 1/2] spl: enable regulator-boot-on and disable regulator-force-boot-off

Quentin Schulz quentin.schulz at theobroma-systems.com
Wed Nov 9 16:03:50 CET 2022


Hi all,

Ping on the patch series. I don't need it for my boards anymore but I 
still think this is a nice to have for everybody. I won't ping again if 
there's no interest/feedback.

Cheers,
Quentin

On 7/22/22 12:09, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz at theobroma-systems.com>
> 
> This makes sure regulators that need to be turned on or off at boot are
> turned on or off in the SPL.
> 
> This may be required for the SPL to do some operations, such as finding
> possible loading media for U-Boot proper.
> 
> Cc: Quentin Schulz <foss+uboot at 0leil.net>
> Tested-by: Xavier Drudis Ferran <xdrudis at tinet.cat>
> Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
> ---
> 
> v2:
>   - added Tested-by,
>   - fixed build for boards with SPL_DM_REGULATOR disabled by always
>   included power/regulator.h and defining a dummy implementation for
>   regulators_enable_boot_off,
> 
>   common/spl/spl.c          | 10 ++++++++++
>   include/power/regulator.h |  5 +++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 29e0898f03..6ab997279d 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -39,6 +39,7 @@
>   #include <fdt_support.h>
>   #include <bootcount.h>
>   #include <wdt.h>
> +#include <power/regulator.h>
>   
>   DECLARE_GLOBAL_DATA_PTR;
>   DECLARE_BINMAN_MAGIC_SYM;
> @@ -773,6 +774,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>   	if (CONFIG_IS_ENABLED(GPIO_HOG))
>   		gpio_hog_probe_all();
>   
> +	if (CONFIG_IS_ENABLED(DM_REGULATOR)) {
> +		if (regulators_enable_boot_on(false))
> +			debug("%s: Cannot enable boot on regulator\n",
> +			      __func__);
> +		if (regulators_enable_boot_off(false))
> +			debug("%s: Cannot enable boot off regulator\n",
> +			      __func__);
> +	}
> +
>   #if CONFIG_IS_ENABLED(BOARD_INIT)
>   	spl_board_init();
>   #endif
> diff --git a/include/power/regulator.h b/include/power/regulator.h
> index ff1bfc2435..4bce61dd9f 100644
> --- a/include/power/regulator.h
> +++ b/include/power/regulator.h
> @@ -631,6 +631,11 @@ static inline int regulators_enable_boot_on(bool verbose)
>   	return -ENOSYS;
>   }
>   
> +static inline int regulators_enable_boot_off(bool verbose)
> +{
> +	return -ENOSYS;
> +}
> +
>   static inline int regulator_autoset(struct udevice *dev)
>   {
>   	return -ENOSYS;


More information about the U-Boot mailing list