[PATCH 06/11] mach-snapdragon: populate fallback FDT

Caleb Connolly caleb.connolly at linaro.org
Fri Aug 9 01:59:29 CEST 2024


Set the fdt_addr_r environment variable to a region of LMB allocated
memory, and populate it by default with a copy of U-Boots FDT. This will
be used for Linux if no other DT is provided.

Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
---
 arch/arm/mach-snapdragon/board.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
index 37925c40f36f..8c0c7394698b 100644
--- a/arch/arm/mach-snapdragon/board.c
+++ b/arch/arm/mach-snapdragon/board.c
@@ -423,8 +423,9 @@ void __weak qcom_late_init(void)
 int board_late_init(void)
 {
 	struct lmb lmb;
 	u32 status = 0;
+	phys_addr_t fdt_addr;
 
 	lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
 
 	/* We need to be fairly conservative here as we support boards with just 1G of TOTAL RAM */
@@ -435,13 +436,17 @@ int board_late_init(void)
 	if (IS_ENABLED(CONFIG_FASTBOOT))
 		status |= env_set_hex("fastboot_addr_r", addr_alloc(&lmb, FASTBOOT_BUF_SIZE));
 	status |= env_set_hex("scriptaddr", addr_alloc(&lmb, SZ_4M));
 	status |= env_set_hex("pxefile_addr_r", addr_alloc(&lmb, SZ_4M));
-	status |= env_set_hex("fdt_addr_r", addr_alloc(&lmb, SZ_2M));
+	fdt_addr = addr_alloc(&lmb, SZ_2M);
+	status |= env_set_hex("fdt_addr_r", fdt_addr);
 
 	if (status)
 		log_warning("%s: Failed to set run time variables\n", __func__);
 
+	/* By default copy U-Boots FDT, it will be used as a fallback */
+	memcpy((void *)fdt_addr, (void *)gd->fdt_blob, gd->fdt_size);
+
 	configure_env();
 	qcom_late_init();
 
 	return 0;

-- 
2.46.0



More information about the U-Boot mailing list