Commit 196311dc728bbb9484356547b9daa731ca2feb8d

Authored by Tom Rini
1 parent 87acf194a2

arm:am33xx: Rework s_init and add board_early_init_f

With the changes to the i2c framework (and adopting the omap24xx_i2c
driver to them) we can no longer call i2c functions prior to gd having
been set and cleared.  When SPL booting, this is handled by setting gd
to point to SRAM in s_init.  However in the cases where we are loaded
directly by ROM (memory mapped NOR or QSPI) we need to make use of the
normal hooks to slightly delay these calls.

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

Showing 3 changed files with 32 additions and 2 deletions Side-by-side Diff

arch/arm/cpu/armv7/am33xx/board.c
... ... @@ -144,6 +144,19 @@
144 144  
145 145 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
146 146 /*
  147 + * In the case of non-SPL based booting we'll want to call these
  148 + * functions a tiny bit later as it will require gd to be set and cleared
  149 + * and that's not true in s_init in this case so we cannot do it there.
  150 + */
  151 +int board_early_init_f(void)
  152 +{
  153 + prcm_init();
  154 + set_mux_conf_regs();
  155 +
  156 + return 0;
  157 +}
  158 +
  159 +/*
147 160 * This function is the place to do per-board things such as ramp up the
148 161 * MPU clock frequency.
149 162 */
150 163  
... ... @@ -232,13 +245,12 @@
232 245 gd = &gdata;
233 246 preloader_console_init();
234 247 #endif
235   - prcm_init();
236   - set_mux_conf_regs();
237 248 #if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
238 249 /* Enable RTC32K clock */
239 250 rtc32k_enable();
240 251 #endif
241 252 #ifdef CONFIG_SPL_BUILD
  253 + board_early_init_f();
242 254 sdram_init();
243 255 #endif
244 256 }
include/configs/am43xx_evm.h
... ... @@ -52,6 +52,15 @@
52 52 #define CONFIG_SKIP_LOWLEVEL_INIT
53 53 #endif
54 54  
  55 +/*
  56 + * When building U-Boot such that there is no previous loader
  57 + * we need to call board_early_init_f. This is taken care of in
  58 + * s_init when we have SPL used.
  59 + */
  60 +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && !defined(CONFIG_SPL)
  61 +#define CONFIG_BOARD_EARLY_INIT_F
  62 +#endif
  63 +
55 64 /* Now bring in the rest of the common code. */
56 65 #include <configs/ti_armv7_common.h>
57 66  
include/configs/ti_am335x_common.h
... ... @@ -75,6 +75,15 @@
75 75 #define CONFIG_SKIP_LOWLEVEL_INIT
76 76 #endif
77 77  
  78 +/*
  79 + * When building U-Boot such that there is no previous loader
  80 + * we need to call board_early_init_f. This is taken care of in
  81 + * s_init when we have SPL used.
  82 + */
  83 +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && !defined(CONFIG_SPL)
  84 +#define CONFIG_BOARD_EARLY_INIT_F
  85 +#endif
  86 +
78 87 #ifdef CONFIG_NAND
79 88 #define CONFIG_SPL_NAND_AM33XX_BCH /* ELM support */
80 89 #endif