[PATCH 0/3] powerpc: p2020: Allow to compile it without env support

This patch series allows to compile SPL for P2020 without env support when proper U-Boot has env support enabled.
Pali Rohár (3): hwconfig: Allow to compile it without env support ddr: fsl: Allow to compile it without env support board: freescale: p1_p2_rdb_pc: Allow to compile it without env support
board/freescale/p1_p2_rdb_pc/spl.c | 4 ++++ common/hwconfig.c | 2 ++ drivers/ddr/fsl/options.c | 4 ++++ 3 files changed, 10 insertions(+)

When env support is disabled then usage of env_get() generates linker errors. So do not compile env_get() when env support is disabled (for example when disabled only in SPL).
Signed-off-by: Pali Rohár pali@kernel.org --- common/hwconfig.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/common/hwconfig.c b/common/hwconfig.c index 63b3ccaf84e2..43566b81bd48 100644 --- a/common/hwconfig.c +++ b/common/hwconfig.c @@ -83,7 +83,9 @@ static const char *__hwconfig(const char *opt, size_t *arglen, "and before environment is ready\n"); return NULL; } +#if CONFIG_IS_ENABLED(ENV_SUPPORT) env_hwconfig = env_get("hwconfig"); +#endif }
if (env_hwconfig) {

When env support is disabled then usage of env_get_f() generates linker errors. So do not compile env_get_f() when env support is disabled (for example when disabled only in SPL).
Signed-off-by: Pali Rohár pali@kernel.org --- drivers/ddr/fsl/options.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c index c000a45f8ea8..9555b9a29d45 100644 --- a/drivers/ddr/fsl/options.c +++ b/drivers/ddr/fsl/options.c @@ -761,7 +761,9 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm, * Extract hwconfig from environment since we have not properly setup * the environment but need it for ddr config params */ +#if CONFIG_IS_ENABLED(ENV_SUPPORT) if (env_get_f("hwconfig", buf, sizeof(buf)) < 0) +#endif buf[0] = '\0';
#if defined(CONFIG_SYS_FSL_DDR3) || \ @@ -1408,7 +1410,9 @@ int fsl_use_spd(void) * Extract hwconfig from environment since we have not properly setup * the environment but need it for ddr config params */ +#if CONFIG_IS_ENABLED(ENV_SUPPORT) if (env_get_f("hwconfig", buf, sizeof(buf)) < 0) +#endif buf[0] = '\0';
/* if hwconfig is not enabled, or "sdram" is not defined, use spd */

When env support is disabled then usage of env_init() or env_relocate() generates linker errors. So do not compile env_init() or env_relocate() in SPL code when env support is disabled in SPL.
Signed-off-by: Pali Rohár pali@kernel.org --- board/freescale/p1_p2_rdb_pc/spl.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c index f855f3a81c3d..22156f2824ec 100644 --- a/board/freescale/p1_p2_rdb_pc/spl.c +++ b/board/freescale/p1_p2_rdb_pc/spl.c @@ -83,12 +83,15 @@ void board_init_r(gd_t *gd, ulong dest_addr) CONFIG_SPL_RELOC_MALLOC_SIZE); gd->flags |= GD_FLG_FULL_MALLOC_INIT;
+#ifdef CONFIG_SPL_ENV_SUPPORT #ifndef CONFIG_SPL_NAND_BOOT env_init(); #endif +#endif #ifdef CONFIG_SPL_MMC_BOOT mmc_initialize(bd); #endif +#ifdef CONFIG_SPL_ENV_SUPPORT /* relocate environment function pointers etc. */ #ifdef CONFIG_SPL_NAND_BOOT nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, @@ -98,6 +101,7 @@ void board_init_r(gd_t *gd, ulong dest_addr) #else env_relocate(); #endif +#endif
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) i2c_init_all();
participants (1)
-
Pali Rohár