Commit 87acf194a298f65a40c659036a5e413613d458e6

Authored by Tom Rini
1 parent ce3cc8ecf5

arm:am33xx: Make dram_init call sdram_init() in some contexts

We have two contexts for booting these platforms.  One is SPL which is
roughly: reset, cpu_init_crit, lowlevel_init, s_init, sdram_init, _main,
board_init_f from SPL, ... then U-Boot loads.  The other is a
memory-mapped XIP case (NOR or QSPI) where we do not run an SPL.  In
this case we go, roughly: reset, cpu_init_crit, lowlevel_init, s_init,
_main, regular board_init_f.

In the first case s_init will set a valid gd and then be able to call
sdram_init which in many cases will need i2c (which needs a valid gd for
gd->cur_i2c_bus).  In this second case we must (and are able to and
should) defer sdram_init() into dram_init() called by board_init_f as gd
will have been set in _main and cleared in board_init_f.

Signed-off-by: Tom Rini <trini@ti.com>

Showing 2 changed files with 6 additions and 0 deletions Side-by-side Diff

arch/arm/cpu/armv7/am33xx/board.c
... ... @@ -238,7 +238,9 @@
238 238 /* Enable RTC32K clock */
239 239 rtc32k_enable();
240 240 #endif
  241 +#ifdef CONFIG_SPL_BUILD
241 242 sdram_init();
  243 +#endif
242 244 }
243 245 #endif
244 246  
arch/arm/cpu/armv7/am33xx/emif4.c
... ... @@ -21,6 +21,10 @@
21 21  
22 22 int dram_init(void)
23 23 {
  24 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT
  25 + sdram_init();
  26 +#endif
  27 +
24 28 /* dram_init must store complete ramsize in gd->ram_size */
25 29 gd->ram_size = get_ram_size(
26 30 (void *)CONFIG_SYS_SDRAM_BASE,