summaryrefslogtreecommitdiff
path: root/arch/arm/lib
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2012-10-19 18:23:38 -0700
committerTom Rini <trini@ti.com>2012-10-19 18:23:38 -0700
commit99070db0dc0b0e881841a0091f06d53351244a34 (patch)
treef54a53d89cf1125c8fe433bc51539144de43074c /arch/arm/lib
parent7f14f30a6d6c80f9fbe3fd8d5b0c294575e3094e (diff)
parent39826f09978a0a7070999acc15babf88f03e4051 (diff)
downloadu-boot-imx-99070db0dc0b0e881841a0091f06d53351244a34.zip
u-boot-imx-99070db0dc0b0e881841a0091f06d53351244a34.tar.gz
u-boot-imx-99070db0dc0b0e881841a0091f06d53351244a34.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-arm
Conflicts: drivers/serial/serial_lh7a40x.c Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r--arch/arm/lib/board.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 0b47ab3..99cb54b 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -274,6 +274,8 @@ void board_init_f(ulong bootflag)
#ifdef CONFIG_PRAM
ulong reg;
#endif
+ void *new_fdt = NULL;
+ size_t fdt_size = 0;
bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
@@ -409,6 +411,22 @@ void board_init_f(ulong bootflag)
debug("Reserving %zu Bytes for Global Data at: %08lx\n",
sizeof (gd_t), addr_sp);
+#if defined(CONFIG_OF_SEPARATE) && defined(CONFIG_OF_CONTROL)
+ /*
+ * If the device tree is sitting immediate 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) {
+ fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob) + 0x1000, 32);
+
+ addr_sp -= fdt_size;
+ new_fdt = (void *)addr_sp;
+ debug("Reserving %zu Bytes for FDT at: %08lx\n",
+ fdt_size, addr_sp);
+ }
+#endif
+
/* setup stackpointer for exeptions */
gd->irq_sp = addr_sp;
#ifdef CONFIG_USE_IRQ
@@ -442,6 +460,10 @@ void board_init_f(ulong bootflag)
gd->start_addr_sp = addr_sp;
gd->reloc_off = addr - _TEXT_BASE;
debug("relocation Offset is: %08lx\n", gd->reloc_off);
+ if (new_fdt) {
+ memcpy(new_fdt, gd->fdt_blob, fdt_size);
+ gd->fdt_blob = new_fdt;
+ }
memcpy(id, (void *)gd, sizeof(gd_t));
relocate_code(addr_sp, id, addr);