From: Caleb Connolly Date: Thu, 8 Aug 2024 23:59:29 +0000 (+0200) Subject: mach-snapdragon: populate fallback FDT X-Git-Url: http://git.dujemihanovic.xyz/img/%7B%7B%20.RelPermalink%20%7D%7D?a=commitdiff_plain;h=f05b69e1c4a843d36706b79aad2e508ca9dc0938;p=u-boot.git mach-snapdragon: populate fallback FDT 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. Reviewed-by: Neil Armstrong Signed-off-by: Caleb Connolly --- diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c index 6dd39a6fbf..05664acb76 100644 --- a/arch/arm/mach-snapdragon/board.c +++ b/arch/arm/mach-snapdragon/board.c @@ -423,6 +423,8 @@ void __weak qcom_late_init(void) int board_late_init(void) { u32 status = 0; + phys_addr_t fdt_addr; + struct fdt_header *fdt_blob = (struct fdt_header *)gd->fdt_blob; /* We need to be fairly conservative here as we support boards with just 1G of TOTAL RAM */ status |= env_set_hex("kernel_addr_r", addr_alloc(SZ_128M)); @@ -433,11 +435,15 @@ int board_late_init(void) status |= env_set_hex("fastboot_addr_r", addr_alloc(FASTBOOT_BUF_SIZE)); status |= env_set_hex("scriptaddr", addr_alloc(SZ_4M)); status |= env_set_hex("pxefile_addr_r", addr_alloc(SZ_4M)); - status |= env_set_hex("fdt_addr_r", addr_alloc(SZ_2M)); + fdt_addr = addr_alloc(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, fdt32_to_cpu(fdt_blob->totalsize)); + configure_env(); qcom_late_init();