qcom: ipq: disable relocation
Relocation is disabled as u-boot is loaded already in DDR
Change-Id: I087daf6e9a93b4ae3ff0236915474599359f3373
Signed-off-by: Manoharan Vijaya Raghavan <mraghava@codeaurora.org>
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index 80548eb..fa486e9 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -86,6 +86,28 @@
bl board_init_f_mem
mov sp, r0
+#ifdef CONFIG_ARCH_IPQ807x
+ ldr r0, =__bss_start /* this is auto-relocated! */
+
+#ifdef CONFIG_USE_ARCH_MEMSET
+ ldr r3, =__bss_end /* this is auto-relocated! */
+ mov r1, #0x00000000 /* prepare zero to clear BSS */
+
+ subs r2, r3, r0 /* r2 = memset len */
+ bl memset
+#else
+ ldr r1, =__bss_end /* this is auto-relocated! */
+ mov r2, #0x00000000 /* prepare zero to clear BSS */
+
+clbss_l:cmp r0, r1 /* while not at end of BSS */
+#if defined(CONFIG_CPU_V7M)
+ itt lo
+#endif
+ strlo r2, [r0] /* clear 32-bit BSS word */
+ addlo r0, r0, #4 /* move to next */
+ blo clbss_l
+#endif
+#endif /* CONFIG_ARCH_IPQ807x clear bss */
mov r0, #0
bl board_init_f
@@ -134,6 +156,7 @@
cmp r0, #0
movne sp, r0
# endif
+#ifndef CONFIG_ARCH_IPQ807x
ldr r0, =__bss_start /* this is auto-relocated! */
#ifdef CONFIG_USE_ARCH_MEMSET
@@ -154,6 +177,7 @@
addlo r0, r0, #4 /* move to next */
blo clbss_l
#endif
+#endif /* CONFIG_ARCH_IPQ807x bss is already cleared */
#if ! defined(CONFIG_SPL_BUILD)
bl coloured_LED_init
diff --git a/common/board_f.c b/common/board_f.c
index 8094ac4..7e4352e 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -423,14 +423,26 @@
defined(CONFIG_ARM)
static int reserve_mmu(void)
{
- /* reserve TLB table */
- gd->arch.tlb_size = PGTABLE_SIZE;
- gd->relocaddr -= gd->arch.tlb_size;
+ /* If relocation is skipped, there is no need to use relocaddr
+ * as base for tlb
+ */
+ if (gd->flags & GD_FLG_SKIP_RELOC) {
+ /* reserve TLB table */
+ gd->arch.tlb_size = PGTABLE_SIZE;
+ gd->arch.tlb_addr = CONFIG_SYS_TEXT_BASE + gd->mon_len;
+ gd->arch.tlb_addr += (0x10000 - 1);
+ gd->arch.tlb_addr &= ~(0x10000 - 1);
+ } else {
+ /* reserve TLB table */
+ gd->arch.tlb_size = PGTABLE_SIZE;
+ gd->relocaddr -= gd->arch.tlb_size;
- /* round down to next 64 kB limit */
- gd->relocaddr &= ~(0x10000 - 1);
+ /* round down to next 64 kB limit */
+ gd->relocaddr &= ~(0x10000 - 1);
- gd->arch.tlb_addr = gd->relocaddr;
+ gd->arch.tlb_addr = gd->relocaddr;
+ }
+
debug("TLB table from %08lx to %08lx\n", gd->arch.tlb_addr,
gd->arch.tlb_addr + gd->arch.tlb_size);
return 0;
@@ -478,6 +490,12 @@
static int reserve_uboot(void)
{
+ /* If relocation is disabled then no need to relocate stack too */
+ if (gd->flags & GD_FLG_SKIP_RELOC) {
+ gd->start_addr_sp = CONFIG_SYS_TEXT_BASE;
+ return 0;
+ }
+
/*
* reserve memory for U-Boot code, data & bss
* round down to next 4 kB limit
@@ -511,6 +529,9 @@
static int reserve_board(void)
{
if (!gd->bd) {
+ if (gd->flags & GD_FLG_SKIP_RELOC)
+ gd->start_addr_sp -= 0x40;
+
gd->start_addr_sp -= sizeof(bd_t);
gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
memset(gd->bd, '\0', sizeof(bd_t));
@@ -535,12 +556,19 @@
gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t));
debug("Reserving %zu Bytes for Global Data at: %08lx\n",
sizeof(gd_t), gd->start_addr_sp);
+
+ if (gd->flags & GD_FLG_SKIP_RELOC)
+ gd->start_addr_sp -= CONFIG_SYS_MALLOC_F_LEN;
+
return 0;
}
static int reserve_fdt(void)
{
#ifndef CONFIG_OF_EMBED
+ /* If relocation is disabled, lets not relocate FDT too */
+ if (gd->flags & GD_FLG_SKIP_RELOC)
+ return 0;
/*
* 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
@@ -707,6 +735,9 @@
static int setup_reloc(void)
{
if (gd->flags & GD_FLG_SKIP_RELOC) {
+ gd->relocaddr = CONFIG_SYS_TEXT_BASE;
+ gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
+
debug("Skipping relocation due to flag\n");
return 0;
}
@@ -1030,6 +1061,10 @@
gd->flags = boot_flags;
gd->have_console = 0;
+#ifdef CONFIG_ARCH_IPQ807x
+ gd->flags |= GD_FLG_SKIP_RELOC;
+#endif
+
if (initcall_run_list(init_sequence_f))
hang();
diff --git a/common/init/board_init.c b/common/init/board_init.c
index 1c6126d..28291b1 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -10,6 +10,7 @@
#include <common.h>
DECLARE_GLOBAL_DATA_PTR;
+#define STACK_MARKER_LEN 32
/*
* It isn't trivial to figure out whether memcpy() exists. The arch-specific
@@ -55,5 +56,7 @@
gd->malloc_base = top;
#endif
+ top -= STACK_MARKER_LEN;
+
return top;
}