diff mbox series

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

Message ID 20240809-b4-snapdragon-improvements-v1-6-7c353f3e8f74@linaro.org
State New
Headers show
Series mach-snapdragon: various improvements for newer boards | expand

Commit Message

Caleb Connolly Aug. 8, 2024, 11:59 p.m. UTC
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@linaro.org>
---
 arch/arm/mach-snapdragon/board.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

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;