El Fri, Jul 15, 2022 at 05:09:48PM +0200, Quentin Schulz deia:
> From: Quentin Schulz <quentin.sch...@theobroma-systems.com>
> 
> The check to perform is on CONFIG_SPL_DM_REGULATOR and not
> SPL_DM_REGULATOR. Also switch to in-code check instead of ifdefs.
>

Tested it on a Rock-Pi-4 with the patch below on top.
So with the small correction: 

Tested-by: Xavier Drudis Ferran <xdru...@tinet.cat>
 
> Fixes: 07586ee4322a ("rockchip: rk3399: Support common spl_board_init")
> Cc: Quentin Schulz <foss+ub...@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.sch...@theobroma-systems.com>
> ---
> 
> v2:
>  - use IS_ENABLED checks,
> 
>  arch/arm/mach-rockchip/rk3399/rk3399.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c 
> b/arch/arm/mach-rockchip/rk3399/rk3399.c
> index de11a3fa30..920da22307 100644
> --- a/arch/arm/mach-rockchip/rk3399/rk3399.c
> +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
> @@ -275,13 +275,14 @@ void spl_board_init(void)
>               rk3399_force_power_on_reset();
>  #endif
>  
> -#if defined(SPL_DM_REGULATOR)
> -     /*
> -      * Turning the eMMC and SPI back on (if disabled via the Qseven
> -      * BIOS_ENABLE) signal is done through a always-on regulator).
> -      */
> -     if (regulators_enable_boot_on(false))
> -             debug("%s: Cannot enable boot on regulator\n", __func__);
> -#endif
> +     if (IS_ENABLED(CONFIG_SPL_DM_REGULATOR)) {
> +             /*
> +              * Turning the eMMC and SPI back on (if disabled via the Qseven
> +              * BIOS_ENABLE) signal is done through a always-on regulator).
> +              */
> +             if (regulators_enable_boot_on(false))
> +                     debug("%s: Cannot enable boot on regulator\n",
> +                           __func__);
> +     }
>  }
>  #endif
> -- 
> 2.36.1
> 

The small correction:

---
 common/spl/spl.c          | 2 --
 include/power/regulator.h | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 70c11aa275..6ab997279d 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -39,9 +39,7 @@
 #include <fdt_support.h>
 #include <bootcount.h>
 #include <wdt.h>
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
 #include <power/regulator.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 DECLARE_BINMAN_MAGIC_SYM;
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;
-- 
2.20.1

Reply via email to