]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
arm:am33xx: Make dram_init call sdram_init() in some contexts
authorTom Rini <trini@ti.com>
Wed, 21 May 2014 16:57:21 +0000 (12:57 -0400)
committerTom Rini <trini@ti.com>
Fri, 6 Jun 2014 21:46:14 +0000 (17:46 -0400)
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>
arch/arm/cpu/armv7/am33xx/board.c
arch/arm/cpu/armv7/am33xx/emif4.c

index e5c922af8a24de600db9f5b710476eb47b41cfd4..9a69b6ccfac4ff6197d8b6a214bbd8279a8fc587 100644 (file)
@@ -238,7 +238,9 @@ void s_init(void)
        /* Enable RTC32K clock */
        rtc32k_enable();
 #endif
+#ifdef CONFIG_SPL_BUILD
        sdram_init();
+#endif
 }
 #endif
 
index 2c67c322cae5ee25b61c868cfeafc0f5098919b4..a7a3e88cd75b3d31f63311f3beebb175f2ea838f 100644 (file)
@@ -21,6 +21,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+       sdram_init();
+#endif
+
        /* dram_init must store complete ramsize in gd->ram_size */
        gd->ram_size = get_ram_size(
                        (void *)CONFIG_SYS_SDRAM_BASE,