
From: Siva Durga Prasad Paladugu siva.durga.paladugu@xilinx.com
Don't relocate fdt in case of CONFIG_OF EMBED as the fdt is already embedded with u-boot image. Also update the fdt_blob correctly in this case
Signed-off-by: Siva Durga Prasad Paladugu sivadur@xilinx.com Signed-off-by: Michal Simek michal.simek@xilinx.com Reviewed-by: Alexey Brodkin abrodkin@synopsys.com Reviewed-by: Bin Meng bmeng.cn@gmail.com Tested-by: Bin Meng bmeng.cn@gmail.com (QEMU x86) Tested-by: Thomas Chou thomas@wytron.com.tw (Nios2) Acked-by: Thomas Chou thomas@wytron.com.tw ---
Changes in v3: - Remove maybe unused and move ifdefs to functions directly - reported by Simon
Changes in v2: - Fix commit message reported by Alexey
common/board_f.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/common/board_f.c b/common/board_f.c index b035c90ff3b7..706232e9381b 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -510,6 +510,7 @@ 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 @@ -523,6 +524,7 @@ static int reserve_fdt(void) debug("Reserving %lu Bytes for FDT at: %08lx\n", gd->fdt_size, gd->start_addr_sp); } +#endif
return 0; } @@ -660,12 +662,14 @@ static int setup_dram_config(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, gd->fdt_size); gd->fdt_blob = gd->new_fdt; } +#endif
return 0; } @@ -687,6 +691,9 @@ static int setup_reloc(void) gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400); #endif #endif +#ifdef CONFIG_OF_EMBED + gd->fdt_blob += gd->reloc_off; +#endif memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
debug("Relocation Offset is: %08lx\n", gd->reloc_off);