[PATCH v5 8/8] fdt: get FDT from bloblist

Raymond Mao raymond.mao at linaro.org
Fri Jan 12 22:33:34 CET 2024


Get device tree from a bloblist if it exists.
If not, fallback to traditional way.

Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
---
Changes in v2
- Refactor of board_fdt_blob_setup().
Changes in v4
- Move the logics from board custom function to fdt library.
Changes in V5
- Rebase the changes on top of master.

 lib/fdtdec.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index b2c59ab381..647459c1b0 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1685,8 +1685,8 @@ int fdtdec_setup(void)
 		}
 	}
 
-	/* Otherwise, the devicetree is typically appended to U-Boot */
 	if (ret) {
+		/* Otherwise, the devicetree is typically appended to U-Boot */
 		if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
 			gd->fdt_blob = fdt_find_separate();
 			gd->fdt_src = FDTSRC_SEPARATE;
@@ -1694,15 +1694,15 @@ int fdtdec_setup(void)
 			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)
-			gd->fdt_src = FDTSRC_BOARD;
-		else if (ret != -EEXIST)
-			return ret;
+		/* Allow the board to override the fdt address. */
+		if (IS_ENABLED(CONFIG_OF_BOARD)) {
+			gd->fdt_blob = board_fdt_blob_setup(&ret);
+			if (!ret)
+				gd->fdt_src = FDTSRC_BOARD;
+			else if (ret != -EEXIST)
+				return ret;
+		}
 	}
 
 	/* Allow the early environment to override the fdt address */
-- 
2.25.1



More information about the U-Boot mailing list