summaryrefslogtreecommitdiff
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-12-16 20:59:33 -0700
committerTom Rini <trini@konsulko.com>2021-12-23 10:24:40 -0500
commit39605c6ec3618a848a4a1c4063d474270deab442 (patch)
tree76ee12b767057ed463c64455085f88d3e73b2e1f /lib/fdtdec.c
parent6476c4d9818beac88610f18ff3c3cb05c7a1f33b (diff)
downloadu-boot-39605c6ec3618a848a4a1c4063d474270deab442.tar.gz
fdt: Record where the devicetree came from
Keep track of where the devicetree came from, so we can report this later. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 31a509bc22..8cfa958fb9 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1618,6 +1618,7 @@ static void setup_multi_dtb_fit(void)
if (blob) {
gd_set_multi_dtb_fit(gd->fdt_blob);
gd->fdt_blob = blob;
+ gd->fdt_src = FDTSRC_FIT;
}
}
@@ -1626,22 +1627,31 @@ int fdtdec_setup(void)
int ret;
/* The devicetree is typically appended to U-Boot */
- if (IS_ENABLED(CONFIG_OF_SEPARATE))
+ if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
gd->fdt_blob = fdt_find_separate();
- else /* embed dtb in ELF file for testing / development */
+ gd->fdt_src = FDTSRC_SEPARATE;
+ } else { /* embed dtb in ELF file for testing / development */
gd->fdt_blob = dtb_dt_embedded();
+ gd->fdt_src = FDTSRC_EMBED;
+ }
/* Allow the board to override the fdt address. */
if (IS_ENABLED(CONFIG_OF_BOARD)) {
gd->fdt_blob = board_fdt_blob_setup(&ret);
if (ret)
return ret;
+ gd->fdt_src = FDTSRC_BOARD;
}
+ /* Allow the early environment to override the fdt address */
if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
- /* Allow the early environment to override the fdt address */
- gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,
- (unsigned long)map_to_sysmem(gd->fdt_blob)), 0);
+ ulong addr;
+
+ addr = env_get_hex("fdtcontroladdr", 0);
+ if (addr) {
+ gd->fdt_blob = map_sysmem(addr, 0);
+ gd->fdt_src = FDTSRC_ENV;
+ }
}
if (CONFIG_IS_ENABLED(MULTI_DTB_FIT))