diff options
author | Ovidiu Panait <ovidiu.panait@windriver.com> | 2020-11-28 10:43:07 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-01-15 14:36:11 -0500 |
commit | 19b18daa29b093d7d255190f75b2accac8f4057d (patch) | |
tree | 322558abee723e51a24464cccf50690457d2bc42 /common | |
parent | 36716686767dc3e31ad0076d3661d607d66f80c6 (diff) | |
download | u-boot-19b18daa29b093d7d255190f75b2accac8f4057d.tar.gz u-boot-19b18daa29b093d7d255190f75b2accac8f4057d.tar.bz2 u-boot-19b18daa29b093d7d255190f75b2accac8f4057d.zip |
common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt
Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/board_f.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/common/board_f.c b/common/board_f.c index fbf622e0f0..ae3001bed1 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -514,21 +514,21 @@ static int reserve_global_data(void) static int reserve_fdt(void) { -#ifndef CONFIG_OF_EMBED - /* - * If the device tree is sitting immediately above our image then we - * must relocate it. If it is embedded in the data section, then it - * will be relocated with other data. - */ - if (gd->fdt_blob) { - gd->fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob), 32); + if (!IS_ENABLED(CONFIG_OF_EMBED)) { + /* + * If the device tree is sitting immediately above our image + * then we must relocate it. If it is embedded in the data + * section, then it will be relocated with other data. + */ + if (gd->fdt_blob) { + gd->fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob), 32); - gd->start_addr_sp = reserve_stack_aligned(gd->fdt_size); - gd->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size); - debug("Reserving %lu Bytes for FDT at: %08lx\n", - gd->fdt_size, gd->start_addr_sp); + gd->start_addr_sp = reserve_stack_aligned(gd->fdt_size); + gd->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size); + debug("Reserving %lu Bytes for FDT at: %08lx\n", + gd->fdt_size, gd->start_addr_sp); + } } -#endif return 0; } @@ -616,14 +616,15 @@ static int init_post(void) static int reloc_fdt(void) { -#ifndef CONFIG_OF_EMBED - if (gd->flags & GD_FLG_SKIP_RELOC) - return 0; - if (gd->new_fdt) { - memcpy(gd->new_fdt, gd->fdt_blob, fdt_totalsize(gd->fdt_blob)); - gd->fdt_blob = gd->new_fdt; + if (!IS_ENABLED(CONFIG_OF_EMBED)) { + if (gd->flags & GD_FLG_SKIP_RELOC) + return 0; + if (gd->new_fdt) { + memcpy(gd->new_fdt, gd->fdt_blob, + fdt_totalsize(gd->fdt_blob)); + gd->fdt_blob = gd->new_fdt; + } } -#endif return 0; } |