]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fdt: Drop remaining preprocessor macros in fdtdec_setup()
authorSimon Glass <sjg@chromium.org>
Fri, 17 Dec 2021 03:59:30 +0000 (20:59 -0700)
committerTom Rini <trini@konsulko.com>
Thu, 23 Dec 2021 15:24:40 +0000 (10:24 -0500)
We only have two choices for obtaining the devicetree. Simplify the code
to make that clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
lib/fdtdec.c

index 5b31064cee26a6aa4a4ef6964ea25e433e1d39bd..a7f62123a94384656351be74bfab0231f3caeea2 100644 (file)
@@ -1624,15 +1624,17 @@ static void setup_multi_dtb_fit(void)
 int fdtdec_setup(void)
 {
        int ret;
-#ifdef CONFIG_OF_EMBED
-       /* Get a pointer to the FDT */
-       gd->fdt_blob = dtb_dt_embedded();
-#elif defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE)
-       /* Allow the board to override the fdt address. */
-       gd->fdt_blob = board_fdt_blob_setup(&ret);
-       if (ret)
-               return ret;
-#endif
+
+       /* The devicetree is typically appended to U-Boot */
+       if (IS_ENABLED(CONFIG_OF_SEPARATE) || IS_ENABLED(CONFIG_OF_BOARD)) {
+               /* Allow the board to override the fdt address. */
+               gd->fdt_blob = board_fdt_blob_setup(&ret);
+               if (ret)
+                       return ret;
+       } else { /* embed dtb in ELF file for testing / development */
+               gd->fdt_blob = dtb_dt_embedded();
+       }
+
        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,