aboutsummaryrefslogtreecommitdiff
path: root/board/sunxi
diff options
context:
space:
mode:
authorSamuel Holland2020-10-24 10:21:54 -0500
committerAndre Przywara2020-11-17 00:42:20 +0000
commit20f3ee31c396aac6b227d6203c5875ed140f9423 (patch)
tree62647ae9a30d8080c87bc3da66b5c6972db2eb13 /board/sunxi
parent41530cf6819cc1f454fb87934a7f4523548bfc91 (diff)
sunxi: board: Set fdtfile to match the DT chosen by SPL
Previously, fdtfile was always the value in CONFIG_DEFAULT_DEVICE_TREE. This meant that, regardless of the DT chosen by SPL (either by changing the header in the image or by the selection code at runtime), Linux always used the default DT. By using the name from the SPL header (which, because of the previous commit, always matches the DT used by U-Boot proper), Linux also sees the same board as U-Boot/SPL, even if the boot script later loads a DT from disk. Acked-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com> [Andre: remove no longer needed CONFIG_SPL_LOAD_FIT guards] Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'board/sunxi')
-rw-r--r--board/sunxi/board.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 42fc6024d39..e94139d6a88 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -320,7 +320,6 @@ static struct boot_file_head * get_spl_header(uint8_t req_version)
return spl;
}
-#ifdef CONFIG_SPL_LOAD_FIT
static const char *get_spl_dt_name(void)
{
struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION);
@@ -331,7 +330,6 @@ static const char *get_spl_dt_name(void)
return NULL;
}
-#endif
int dram_init(void)
{
@@ -857,6 +855,7 @@ static void setup_environment(const void *fdt)
int misc_init_r(void)
{
+ const char *spl_dt_name;
uint boot;
env_set("fel_booted", NULL);
@@ -875,6 +874,16 @@ int misc_init_r(void)
env_set("mmc_bootdev", "1");
}
+ /* Set fdtfile to match the FIT configuration chosen in SPL. */
+ spl_dt_name = get_spl_dt_name();
+ if (spl_dt_name) {
+ char *prefix = IS_ENABLED(CONFIG_ARM64) ? "allwinner/" : "";
+ char str[64];
+
+ snprintf(str, sizeof(str), "%s%s.dtb", prefix, spl_dt_name);
+ env_set("fdtfile", str);
+ }
+
setup_environment(gd->fdt_blob);
#ifdef CONFIG_USB_ETHER