Commit a6b541b09022acb6f7c2754100ae26bd44eed1d9

Authored by Tom Rini
1 parent ab77f24119

TI ARMv7: Don't use GD before crt0.S has set it

Prior to this change we set the gd pointer early so that we can store
data in it.  This becomes problematic for DM changes as well as being
odd in general.  Re-work the code paths so that we don't need to set the
gd pointer so early and instead can rely upon the normal setting of it.

In order to do this we do need to move certain calls from s_init into
spl_board_init(), mainly preloader_console_init and
save_omap_boot_params.

Tested on: Beaglebone Black, AM43xx GP EVM, Beagleboard, Beagleboard xM,
OMAP5 uEVM, DRA7xx EVM
Signed-off-by: Tom Rini <trini@ti.com>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 4 changed files with 11 additions and 30 deletions Side-by-side Diff

arch/arm/cpu/armv7/am33xx/board.c
... ... @@ -285,14 +285,6 @@
285 285 #ifdef CONFIG_NOR_BOOT
286 286 enable_norboot_pin_mux();
287 287 #endif
288   - /*
289   - * Save the boot parameters passed from romcode.
290   - * We cannot delay the saving further than this,
291   - * to prevent overwrites.
292   - */
293   -#ifdef CONFIG_SPL_BUILD
294   - save_omap_boot_params();
295   -#endif
296 288 watchdog_disable();
297 289 set_uart_mux_conf();
298 290 setup_clocks_for_console();
... ... @@ -301,9 +293,6 @@
301 293 gd->baudrate = CONFIG_BAUDRATE;
302 294 serial_init();
303 295 gd->have_console = 1;
304   -#elif defined(CONFIG_SPL_BUILD)
305   - gd = &gdata;
306   - preloader_console_init();
307 296 #endif
308 297 #if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
309 298 /* Enable RTC32K clock */
arch/arm/cpu/armv7/omap-common/boot-common.c
... ... @@ -106,6 +106,16 @@
106 106  
107 107 void spl_board_init(void)
108 108 {
  109 + /*
  110 + * Save the boot parameters passed from romcode.
  111 + * We cannot delay the saving further than this,
  112 + * to prevent overwrites.
  113 + */
  114 + save_omap_boot_params();
  115 +
  116 + /* Prepare console output */
  117 + preloader_console_init();
  118 +
109 119 #ifdef CONFIG_SPL_NAND_SUPPORT
110 120 gpmc_init();
111 121 #endif
arch/arm/cpu/armv7/omap-common/hwinit-common.c
... ... @@ -111,14 +111,6 @@
111 111 */
112 112 void s_init(void)
113 113 {
114   - /*
115   - * Save the boot parameters passed from romcode.
116   - * We cannot delay the saving further than this,
117   - * to prevent overwrites.
118   - */
119   -#ifdef CONFIG_SPL_BUILD
120   - save_omap_boot_params();
121   -#endif
122 114 init_omap_revision();
123 115 hw_data_init();
124 116  
... ... @@ -133,9 +125,6 @@
133 125 srcomp_enable();
134 126 setup_clocks_for_console();
135 127  
136   - gd = &gdata;
137   -
138   - preloader_console_init();
139 128 do_io_settings();
140 129 #endif
141 130 prcm_init();
arch/arm/cpu/armv7/omap3/board.c
... ... @@ -119,6 +119,7 @@
119 119  
120 120 void spl_board_init(void)
121 121 {
  122 + preloader_console_init();
122 123 #if defined(CONFIG_SPL_NAND_SUPPORT) || defined(CONFIG_SPL_ONENAND_SUPPORT)
123 124 gpmc_init();
124 125 #endif
... ... @@ -262,14 +263,6 @@
262 263  
263 264 #ifdef CONFIG_USB_EHCI_OMAP
264 265 ehci_clocks_enable();
265   -#endif
266   -
267   -#ifdef CONFIG_SPL_BUILD
268   - gd = &gdata;
269   -
270   - preloader_console_init();
271   -
272   - timer_init();
273 266 #endif
274 267  
275 268 if (!in_sdram)