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

Xavier Drudis Ferran xdrudis at tinet.cat
Mon Jul 18 10:34:54 CEST 2022


Hello, and thanks for you work 

El Fri, Jul 15, 2022 at 05:14:25PM +0200, Quentin Schulz deia:
> 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>
> Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
> ---
> 
>  - RFC because only tested on Puma Haikou RK3399
> 
>  common/spl/spl.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index c8c463f80b..762e9918c7 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -37,6 +37,9 @@
>  #include <fdt_support.h>
>  #include <bootcount.h>
>  #include <wdt.h>
> +#if CONFIG_IS_ENABLED(DM_REGULATOR)
> +#include <power/regulator.h>
> +#endif
>

Can we remove the #if ? 
Otherwise I get 2 compilation warnings in tpl,
because I miss the dummy regulators_enable_boot_on (and _off)
  in include/power/regulator.h 

When compiling tpl for Rock-pi-4 
I have CONFIG_DM_REGULATOR=y, but not CONFIG_TPL_DM_REGULATOR or
CONFIG_SPL_DM_REGULATOR.

>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -766,6 +769,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__);
> +	}
> +

This still introduces a warning for me. 

warning: implicit declaration of function 'regulators_enable_boot_off'

So maybe the dummy function must be added to include/power/regulator.h
 commit 16cc5ad0b439 ("power: regulator: add dummy helper")
introduced the dummy  regulators_enable_boot_on but missed 
the regulators_enable_boot_off.

Alternatively one could replace the if with an #if, but I think that'd 
be against U-Boot policy. 



More information about the U-Boot mailing list