Add an option to receive the FDT using standard passage from a previous
phase. Rename the FDT source to 'passage' to match the old terminology,
which was only partially added.

Signed-off-by: Simon Glass <s...@chromium.org>
---

(no changes since v1)

 env/common.c     |  2 +-
 include/fdtdec.h |  4 ++--
 lib/fdtdec.c     | 16 ++++++++++++----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/env/common.c b/env/common.c
index 86122582bc1..272a86b4dfc 100644
--- a/env/common.c
+++ b/env/common.c
@@ -375,7 +375,7 @@ static int env_update_fdt_addr_from_bloblist(void)
         * fdt_addr is by default used by booti, bootm and bootefi,
         * thus set it to point to the fdt embedded in a bloblist if it exists.
         */
-       if (!CONFIG_IS_ENABLED(BLOBLIST) || gd->fdt_src != FDTSRC_BLOBLIST)
+       if (!CONFIG_IS_ENABLED(BLOBLIST) || gd->fdt_src != FDTSRC_PASSAGE)
                return 0;
 
        return env_set_hex("fdt_addr", (uintptr_t)map_to_sysmem(gd->fdt_blob));
diff --git a/include/fdtdec.h b/include/fdtdec.h
index d9fcd037ed2..7f7e13cb904 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -72,7 +72,7 @@ struct bd_info;
  *     U-Boot is packaged as an ELF file, e.g. for debugging purposes
  * @FDTSRC_ENV: Provided by the fdtcontroladdr environment variable. This 
should
  *     be used for debugging/development only
- * @FDTSRC_BLOBLIST: Provided by a bloblist from an earlier phase
+ * @FDTSRC_PASSAGE: Provided by a bloblist from an earlier phase
  */
 enum fdt_source_t {
        FDTSRC_SEPARATE,
@@ -80,7 +80,7 @@ enum fdt_source_t {
        FDTSRC_BOARD,
        FDTSRC_EMBED,
        FDTSRC_ENV,
-       FDTSRC_BLOBLIST,
+       FDTSRC_PASSAGE,
 };
 
 /*
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 8559616873b..178b1b1247d 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -19,6 +19,7 @@
 #include <log.h>
 #include <malloc.h>
 #include <net.h>
+#include <passage.h>
 #include <spl.h>
 #include <env.h>
 #include <errno.h>
@@ -90,7 +91,7 @@ static const char *const fdt_src_name[] = {
        [FDTSRC_BOARD] = "board",
        [FDTSRC_EMBED] = "embed",
        [FDTSRC_ENV] = "env",
-       [FDTSRC_BLOBLIST] = "bloblist",
+       [FDTSRC_PASSAGE] = "passage",
 };
 
 extern u8 __dtb_dt_begin[];    /* embedded device tree blob */
@@ -1691,9 +1692,16 @@ int fdtdec_setup(void)
 {
        int ret;
 
-       if (CONFIG_IS_ENABLED(OF_BLOBLIST)) {
-               printf("Previous phase failed to provide standard passage\n");
-               return -ENOENT;
+       /* The devicetree is typically appended to U-Boot */
+       if (CONFIG_IS_ENABLED(OF_PASSAGE)) {
+               if (!passage_valid()) {
+                       printf("Previous phase failed to provide standard 
passage\n");
+                       bloblist_show_list();
+                       return -ENOENT;
+               }
+               gd->fdt_blob = map_sysmem(gd_passage_dtb(), 0);
+               gd->fdt_src = FDTSRC_PASSAGE;
+               log_debug("Devicetree is in bloblist at %p\n", gd->fdt_blob);
        } else {
                /* The devicetree is typically appended to U-Boot */
                if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
-- 
2.43.0

Reply via email to