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)

 include/fdtdec.h |  4 ++--
 lib/fdtdec.c     | 16 ++++++++++++----
 2 files changed, 14 insertions(+), 6 deletions(-)

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