Skip to contentSkip to conversation

powerpc: p2020: Allow to compile it without env support

PATCH New Pali Rohár 1 participant 4 messages Apr 2, 2022

lore
Share & tools
lore
#0 lore raw

cover 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(+)
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/3 ddr: fsl: Allow to compile it without env support

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).

---
 drivers/ddr/fsl/options.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/ddr/fsl/options.c +4 -0
index c000a45f8ea8..9555b9a29d45 100644
@@ -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 */
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 hwconfig: Allow to compile it without env support

In reply to Pali Rohár

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).

---
 common/hwconfig.c | 2 ++
 1 file changed, 2 insertions(+)
common/hwconfig.c +2 -0
index 63b3ccaf84e2..43566b81bd48 100644
@@ -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) {
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/3 board: freescale: p1_p2_rdb_pc: Allow to compile it without env support

In reply to Pali Rohár

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.

---
 board/freescale/p1_p2_rdb_pc/spl.c | 4 ++++
 1 file changed, 4 insertions(+)
board/freescale/p1_p2_rdb_pc/spl.c +4 -0
index f855f3a81c3d..22156f2824ec 100644
@@ -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();
Signature · 1 line
2.20.1