]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
MIPS: add possibility to setup initial stack and global data in SRAM
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Sat, 4 Jun 2016 14:13:21 +0000 (16:13 +0200)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Wed, 30 Nov 2016 15:11:46 +0000 (16:11 +0100)
This adds a new Kconfig option CONFIG_MIPS_INIT_STACK_IN_SRAM which
a SoC can select if it supports some kind of SRAM. Together with
CONFIG_SYS_INIT_SP_ADDR the initial stack and global data can be
set up in that SRAM. This can be used to provide a C environment
also for lowlevel_init().

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
arch/mips/Kconfig
arch/mips/cpu/start.S

index 709ac5c0b3454cd67bc3933cefc594bbb849bc8d..d97930e577bb057a45ce62249871244440c9bdcf 100644 (file)
@@ -302,6 +302,17 @@ config SWAP_IO_SPACE
 config SYS_MIPS_CACHE_INIT_RAM_LOAD
        bool
 
+config MIPS_INIT_STACK_IN_SRAM
+       bool
+       default n
+       help
+         Select this if the initial stack frame could be setup in SRAM.
+         Normally the initial stack frame is set up in DRAM which is often
+         only available after lowlevel_init. With this option the initial
+         stack frame and the early C environment is set up before
+         lowlevel_init. Thus lowlevel_init does not need to be implemented
+         in assembler.
+
 config SYS_DCACHE_SIZE
        int
        default 0
index f1040c27b609b87fb176b659fc9a3a1ed954ae2e..6740fdf9ed272eda6bc7213ad02db57fc68f7d7b 100644 (file)
@@ -234,6 +234,11 @@ wr_done:
         nop
 #endif
 
+#ifdef CONFIG_MIPS_INIT_STACK_IN_SRAM
+       /* Set up initial stack and global data */
+       setup_stack_gd
+#endif
+
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
 # ifdef CONFIG_SYS_MIPS_CACHE_INIT_RAM_LOAD
        /* Initialize any external memory */
@@ -255,8 +260,10 @@ wr_done:
 # endif
 #endif
 
+#ifndef CONFIG_MIPS_INIT_STACK_IN_SRAM
        /* Set up initial stack and global data */
        setup_stack_gd
+#endif
 
        move    a0, zero                # a0 <-- boot_flags = 0
        PTR_LA  t9, board_init_f