summaryrefslogtreecommitdiff
path: root/arch/powerpc
diff options
context:
space:
mode:
authorDirk Eibach <dirk.eibach@gdsys.cc>2016-08-01 16:34:49 +0200
committerStefan Roese <sr@denx.de>2016-08-09 09:25:36 +0200
commit54a0eb7a18b5120d609188e46a1b71e98d6af44b (patch)
treea1ab7e069724bb4373b1f670a319c2c01bcc1f97 /arch/powerpc
parent5405817a6e7a6538c4bcb1c3076ddc83fe5d03f9 (diff)
downloadu-boot-imx-54a0eb7a18b5120d609188e46a1b71e98d6af44b.zip
u-boot-imx-54a0eb7a18b5120d609188e46a1b71e98d6af44b.tar.gz
u-boot-imx-54a0eb7a18b5120d609188e46a1b71e98d6af44b.tar.bz2
ppc4xx: Fix platform support
Commit "ecc3066 Fix board init code to respect the C runtime environment" broke platform support for ppc4xx. start.S prepares a stackframe that is later rendered unusable by appending the reserved space for global data. Instead the reserved space has to be put first. Then the stackframe can be pushed. I can only test the 405EP OCM case. At least all other ppc4xx boards still build. Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/cpu/ppc4xx/start.S66
1 files changed, 45 insertions, 21 deletions
diff --git a/arch/powerpc/cpu/ppc4xx/start.S b/arch/powerpc/cpu/ppc4xx/start.S
index 5647d71..7633abc 100644
--- a/arch/powerpc/cpu/ppc4xx/start.S
+++ b/arch/powerpc/cpu/ppc4xx/start.S
@@ -743,8 +743,16 @@ _start:
/*----------------------------------------------------------------*/
/* Setup the stack in internal SRAM */
/*----------------------------------------------------------------*/
- lis r1,CONFIG_SYS_INIT_RAM_ADDR@h
- ori r1,r1,CONFIG_SYS_INIT_SP_OFFSET@l
+ lis r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@h
+ ori r1, r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@l
+ /*
+ * Reserve space for globals and store address for initialization
+ * with board_init_f_init_reserve() in r14
+ */
+ mr r3, r1
+ bl board_init_f_alloc_reserve
+ mr r1, r3
+ mr r14, r3
li r0,0
stwu r0,-4(r1)
stwu r0,-4(r1) /* Terminate call chain */
@@ -760,13 +768,9 @@ _start:
#endif
bl cpu_init_f /* run low-level CPU init code (from Flash) */
- mr r3, r1
- bl board_init_f_alloc_reserve
- mr r1, r3
+ /* address for globals was stored in r14 */
+ mr r3, r14
bl board_init_f_init_reserve
- li r0,0
- stwu r0, -4(r1)
- stwu r0, -4(r1)
li r3, 0
bl board_init_f
/* NOTREACHED - board_init_f() does not return */
@@ -831,8 +835,16 @@ _start:
* for their primordial stack, setup stack here directly after the
* SDRAM is initialized in ext_bus_cntlr_init.
*/
- lis r1, CONFIG_SYS_INIT_RAM_ADDR@h
- ori r1,r1,CONFIG_SYS_INIT_SP_OFFSET /* set up the stack in SDRAM */
+ lis r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@h
+ ori r1, r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@l
+ /*
+ * Reserve space for globals and store address for initialization
+ * with board_init_f_init_reserve() in r14
+ */
+ mr r3, r1
+ bl board_init_f_alloc_reserve
+ mr r1, r3
+ mr r14, r3
li r0, 0 /* Make room for stack frame header and */
stwu r0, -4(r1) /* clear final stack frame so that */
@@ -972,8 +984,16 @@ _start:
* Load the initial stack pointer and data area and convert the size,
* in bytes, to the number of words to initialize to a known value.
*/
- lis r1, CONFIG_SYS_INIT_RAM_ADDR@h
- ori r1, r1, CONFIG_SYS_INIT_SP_OFFSET@l
+ lis r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@h
+ ori r1, r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@l
+ /*
+ * Reserve space for globals and store address for initialization
+ * with board_init_f_init_reserve() in r14
+ */
+ mr r3, r1
+ bl board_init_f_alloc_reserve
+ mr r1, r3
+ mr r14, r3
lis r4, (CONFIG_SYS_INIT_RAM_SIZE >> 2)@h
ori r4, r4, (CONFIG_SYS_INIT_RAM_SIZE >> 2)@l
@@ -993,6 +1013,7 @@ _start:
* Make room for stack frame header and clear final stack frame so
* that stack backtraces terminate cleanly.
*/
+ li r0, 0
stwu r0, -4(r1)
stwu r0, -4(r1)
@@ -1011,10 +1032,16 @@ _start:
/*
* Stack in OCM.
*/
-
- /* Set up Stack at top of OCM */
- lis r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)@h
- ori r1, r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)@l
+ lis r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@h
+ ori r1, r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)@l
+ /*
+ * Reserve space for globals and store address for initialization
+ * with board_init_f_init_reserve() in r14
+ */
+ mr r3, r1
+ bl board_init_f_alloc_reserve
+ mr r1, r3
+ mr r14, r3
/* Set up a zeroized stack frame so that backtrace works right */
li r0, 0
@@ -1035,12 +1062,9 @@ _start:
GET_GOT /* initialize GOT access */
bl cpu_init_f /* run low-level CPU init code (from Flash) */
- mr r3, r1
- bl board_init_f_alloc_reserve
- mr r1, r3
+ /* address for globals was stored in r14 */
+ mr r3, r14
bl board_init_f_init_reserve
- stwu r0, -4(r1)
- stwu r0, -4(r1)
li r3, 0
bl board_init_f /* run first part of init code (from Flash) */
/* NOTREACHED - board_init_f() does not return */