Commit 7ae8350f67eea861280a4cbd2d067777a0e87153

Authored by Simon Glass
Committed by Tom Rini
1 parent 905949190d

ti: armv7: Move SPL SDRAM init to the right place, drop unused CONFIG_SPL_STACK

Currently in some cases SDRAM init requires global_data to be available
and soon this will not be available prior to board_init_f().  Adjust the
code paths in these cases to be correct.  In some cases we had the SPL
stack be in DDR as we might have large stacks (due to Falcon Mode +
Environment).  In these cases switch to CONFIG_SPL_STACK_R.  In other
cases we had simply been setting CONFIG_SPL_STACK into SRAM.  In these
cases we no longer need to (CONFIG_SYS_INIT_SP_ADDR is used and is also
in SRAM) so drop those lines.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested on Beagleboard, Beagleboard xM
Tested-by: Matt Porter <mporter@konsulko.com>
Tested on Beaglebone Black, AM43xx GP EVM, OMAP5 uEVM, OMAP4 Pandaboard
Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 23 changed files with 36 additions and 25 deletions Side-by-side Diff

arch/arm/cpu/armv7/am33xx/board.c
... ... @@ -275,6 +275,14 @@
275 275 ;
276 276 }
277 277  
  278 +#ifdef CONFIG_SPL_BUILD
  279 +void board_init_f(ulong dummy)
  280 +{
  281 + board_early_init_f();
  282 + sdram_init();
  283 +}
  284 +#endif
  285 +
278 286 void s_init(void)
279 287 {
280 288 /*
... ... @@ -290,6 +298,7 @@
290 298 setup_clocks_for_console();
291 299 uart_soft_reset();
292 300 #if defined(CONFIG_NOR_BOOT) || defined(CONFIG_QSPI_BOOT)
  301 + /* TODO: This does not work, gd is not available yet */
293 302 gd->baudrate = CONFIG_BAUDRATE;
294 303 serial_init();
295 304 gd->have_console = 1;
... ... @@ -297,10 +306,6 @@
297 306 #if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
298 307 /* Enable RTC32K clock */
299 308 rtc32k_enable();
300   -#endif
301   -#ifdef CONFIG_SPL_BUILD
302   - board_early_init_f();
303   - sdram_init();
304 309 #endif
305 310 }
306 311 #endif
arch/arm/cpu/armv7/omap-common/hwinit-common.c
... ... @@ -128,14 +128,18 @@
128 128 do_io_settings();
129 129 #endif
130 130 prcm_init();
  131 +}
  132 +
131 133 #ifdef CONFIG_SPL_BUILD
  134 +void board_init_f(ulong dummy)
  135 +{
132 136 #ifdef CONFIG_BOARD_EARLY_INIT_F
133 137 board_early_init_f();
134 138 #endif
135 139 /* For regular u-boot sdram_init() is called from dram_init() */
136 140 sdram_init();
137   -#endif
138 141 }
  142 +#endif
139 143  
140 144 /*
141 145 * Routine: wait_for_command_complete
arch/arm/cpu/armv7/omap3/board.c
... ... @@ -240,8 +240,6 @@
240 240 *****************************************************************************/
241 241 void s_init(void)
242 242 {
243   - int in_sdram = is_running_in_sdram();
244   -
245 243 watchdog_init();
246 244  
247 245 try_unlock_memory();
248 246  
249 247  
... ... @@ -264,10 +262,14 @@
264 262 #ifdef CONFIG_USB_EHCI_OMAP
265 263 ehci_clocks_enable();
266 264 #endif
  265 +}
267 266  
268   - if (!in_sdram)
269   - mem_init();
  267 +#ifdef CONFIG_SPL_BUILD
  268 +void board_init_f(ulong dummy)
  269 +{
  270 + mem_init();
270 271 }
  272 +#endif
271 273  
272 274 /*
273 275 * Routine: misc_init_r
configs/am335x_boneblack_defconfig
1 1 CONFIG_SPL=y
  2 +CONFIG_SPL_STACK_R=y
  3 +CONFIG_SPL_STACK_R_ADDR=0x82000000
2 4 CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT"
3 5 +S:CONFIG_ARM=y
4 6 +S:CONFIG_TARGET_AM335X_EVM=y
configs/am335x_boneblack_vboot_defconfig
1 1 CONFIG_SPL=y
  2 +CONFIG_SPL_STACK_R=y
  3 +CONFIG_SPL_STACK_R_ADDR=0x82000000
2 4 CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT,ENABLE_VBOOT"
3 5 +S:CONFIG_ARM=y
4 6 +S:CONFIG_TARGET_AM335X_EVM=y
configs/am335x_evm_defconfig
1 1 CONFIG_SPL=y
  2 +CONFIG_SPL_STACK_R=y
  3 +CONFIG_SPL_STACK_R_ADDR=0x82000000
2 4 CONFIG_SYS_EXTRA_OPTIONS="NAND"
3 5 CONFIG_CONS_INDEX=1
4 6 +S:CONFIG_ARM=y
configs/am335x_evm_nor_defconfig
1 1 CONFIG_SPL=y
  2 +CONFIG_SPL_STACK_R=y
  3 +CONFIG_SPL_STACK_R_ADDR=0x82000000
2 4 CONFIG_SYS_EXTRA_OPTIONS="NAND"
3 5 CONFIG_CONS_INDEX=1
4 6 +S:CONFIG_ARM=y
configs/am335x_evm_spiboot_defconfig
1 1 CONFIG_SPL=y
  2 +CONFIG_SPL_STACK_R=y
  3 +CONFIG_SPL_STACK_R_ADDR=0x82000000
2 4 CONFIG_SYS_EXTRA_OPTIONS="SPI_BOOT"
3 5 CONFIG_CONS_INDEX=1
4 6 +S:CONFIG_ARM=y
configs/am335x_evm_usbspl_defconfig
1 1 CONFIG_SPL=y
  2 +CONFIG_SPL_STACK_R=y
  3 +CONFIG_SPL_STACK_R_ADDR=0x82000000
2 4 CONFIG_SYS_EXTRA_OPTIONS="NAND,SPL_USBETH_SUPPORT"
3 5 CONFIG_CONS_INDEX=1
4 6 +S:CONFIG_ARM=y
configs/am335x_igep0033_defconfig
1 1 CONFIG_SPL=y
  2 +CONFIG_SPL_STACK_R=y
  3 +CONFIG_SPL_STACK_R_ADDR=0x82000000
2 4 +S:CONFIG_ARM=y
3 5 +S:CONFIG_TARGET_AM335X_IGEP0033=y
4 6 CONFIG_SYS_MALLOC_F=y
include/configs/am3517_crane.h
... ... @@ -297,7 +297,6 @@
297 297 #define CONFIG_SPL_NAND_SIMPLE
298 298 #define CONFIG_SPL_TEXT_BASE 0x40200800
299 299 #define CONFIG_SPL_MAX_SIZE (54 * 1024) /* 8 KB for stack */
300   -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
301 300  
302 301 #define CONFIG_SPL_BSS_START_ADDR 0x80000000
303 302 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
include/configs/am3517_evm.h
... ... @@ -306,7 +306,6 @@
306 306 #define CONFIG_SPL_NAND_SIMPLE
307 307 #define CONFIG_SPL_TEXT_BASE 0x40200800
308 308 #define CONFIG_SPL_MAX_SIZE (54 * 1024) /* 8 KB for stack */
309   -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
310 309  
311 310 #define CONFIG_SPL_BSS_START_ADDR 0x80000000
312 311 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
include/configs/bur_am335x_common.h
... ... @@ -175,7 +175,6 @@
175 175 *
176 176 * ----------------------------------------------------------------------------
177 177 */
178   -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR
179 178 #undef CONFIG_SYS_TEXT_BASE
180 179 #define CONFIG_SYS_TEXT_BASE 0x80800000
181 180 #define CONFIG_SPL_BSS_START_ADDR 0x80A00000
include/configs/cm_t35.h
... ... @@ -365,7 +365,6 @@
365 365  
366 366 #define CONFIG_SPL_TEXT_BASE 0x40200800
367 367 #define CONFIG_SPL_MAX_SIZE (54 * 1024) /* 8 KB for stack */
368   -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
369 368  
370 369 /*
371 370 * Use 0x80008000 as TEXT_BASE here for compatibility reasons with the
include/configs/devkit8000.h
... ... @@ -213,8 +213,6 @@
213 213  
214 214 #undef CONFIG_SPL_TEXT_BASE
215 215 #define CONFIG_SPL_TEXT_BASE 0x40200000 /*CONFIG_SYS_SRAM_START*/
216   -#undef CONFIG_SPL_STACK
217   -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
218 216  
219 217 /* NAND boot config */
220 218 #define CONFIG_SYS_NAND_BUSWIDTH_16BIT 16
include/configs/omap3_evm_common.h
... ... @@ -259,7 +259,6 @@
259 259 #define CONFIG_SPL_FRAMEWORK
260 260 #define CONFIG_SPL_TEXT_BASE 0x40200800
261 261 #define CONFIG_SPL_MAX_SIZE (54 * 1024) /* 8 KB for stack */
262   -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
263 262  
264 263 #define CONFIG_SPL_BSS_START_ADDR 0x80000000
265 264 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
include/configs/siemens-am33x-common.h
... ... @@ -142,7 +142,6 @@
142 142 #define CONFIG_SPL_FRAMEWORK
143 143 #define CONFIG_SPL_TEXT_BASE 0x402F0400
144 144 #define CONFIG_SPL_MAX_SIZE (101 * 1024)
145   -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR
146 145  
147 146 #define CONFIG_SPL_BSS_START_ADDR 0x80000000
148 147 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
include/configs/tam3517-common.h
... ... @@ -237,7 +237,6 @@
237 237  
238 238 #define CONFIG_SPL_TEXT_BASE 0x40200000 /*CONFIG_SYS_SRAM_START*/
239 239 #define CONFIG_SPL_MAX_SIZE (54 * 1024) /* 8 KB for stack */
240   -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
241 240  
242 241 #define CONFIG_SYS_SPL_MALLOC_START 0x8f000000
243 242 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x80000
include/configs/tao3530.h
... ... @@ -346,7 +346,6 @@
346 346  
347 347 #define CONFIG_SPL_TEXT_BASE 0x40200800
348 348 #define CONFIG_SPL_MAX_SIZE (54 * 1024) /* 8 KB for stack */
349   -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
350 349  
351 350 /*
352 351 * Use 0x80008000 as TEXT_BASE here for compatibility reasons with the
include/configs/ti814x_evm.h
... ... @@ -171,7 +171,6 @@
171 171 #define CONFIG_SPL_FRAMEWORK
172 172 #define CONFIG_SPL_TEXT_BASE 0x40300000
173 173 #define CONFIG_SPL_MAX_SIZE ((128 - 18) * 1024)
174   -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR
175 174  
176 175 #define CONFIG_SPL_BSS_START_ADDR 0x80000000
177 176 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
include/configs/ti816x_evm.h
... ... @@ -136,7 +136,6 @@
136 136 #define CONFIG_SPL_FRAMEWORK
137 137 #define CONFIG_SPL_TEXT_BASE 0x40400000
138 138 #define CONFIG_SPL_MAX_SIZE ((128 - 18) * 1024)
139   -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR
140 139  
141 140 #define CONFIG_SPL_BSS_START_ADDR 0x80000000
142 141 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */
include/configs/ti_armv7_common.h
... ... @@ -213,10 +213,9 @@
213 213 * SPLs). We have our BSS be placed 2MiB after this, to allow for the
214 214 * default Linux kernel address of 0x80008000 to work with most sized
215 215 * kernels, in the Falcon Mode case. We have the SPL malloc pool at the
216   - * end of the BSS area. We place our stack at 32MiB after the start of
217   - * DRAM to allow room for all of the above.
  216 + * end of the BSS area. We suggest that the stack be placed at 32MiB after
  217 + * the start of DRAM to allow room for all of the above (handled in Kconfig).
218 218 */
219   -#define CONFIG_SPL_STACK (CONFIG_SYS_SDRAM_BASE + (32 << 20))
220 219 #ifndef CONFIG_SYS_TEXT_BASE
221 220 #define CONFIG_SYS_TEXT_BASE 0x80800000
222 221 #endif
include/configs/tricorder.h
... ... @@ -354,7 +354,6 @@
354 354  
355 355 #define CONFIG_SPL_TEXT_BASE 0x40200000 /*CONFIG_SYS_SRAM_START*/
356 356 #define CONFIG_SPL_MAX_SIZE (57 * 1024) /* 7 KB for stack */
357   -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
358 357  
359 358 #define CONFIG_SPL_BSS_START_ADDR 0x80000000 /*CONFIG_SYS_SDRAM_BASE*/
360 359 #define CONFIG_SPL_BSS_MAX_SIZE 0x80000