aboutsummaryrefslogtreecommitdiff
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-12-16 20:59:30 -0700
committerTom Rini <trini@konsulko.com>2021-12-23 10:24:40 -0500
commitba83d8593bde7aec6055ea5fe200b8db6f1b0810 (patch)
tree7ce911e8358eb094b7be5f287bd1ff4ab287bcdd /lib/fdtdec.c
parentb5199380fc993174a795994f00ef3d67e60142c1 (diff)
downloadu-boot-ba83d8593bde7aec6055ea5fe200b8db6f1b0810.zip
u-boot-ba83d8593bde7aec6055ea5fe200b8db6f1b0810.tar.gz
u-boot-ba83d8593bde7aec6055ea5fe200b8db6f1b0810.tar.bz2
fdt: Drop remaining preprocessor macros in fdtdec_setup()
We only have two choices for obtaining the devicetree. Simplify the code to make that clear. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 5b31064..a7f6212 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -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,