[U-Boot] [PATCH RFT 1/2] TI ARMv7: Don't use GD before crt0.S has set it

Simon Glass sjg at chromium.org
Sun Dec 21 19:52:52 CET 2014


Hi Tom,

On 19 December 2014 at 14:53, Tom Rini <trini at ti.com> wrote:
> 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 at ti.com>

This seems like it's going in the right direction to me!

Tested on Beaglebone Black.

Tested-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Simon Glass <sjg at chromium.org>

> ---
>  arch/arm/cpu/armv7/am33xx/board.c              |   11 -----------
>  arch/arm/cpu/armv7/omap-common/boot-common.c   |   10 ++++++++++
>  arch/arm/cpu/armv7/omap-common/hwinit-common.c |   11 -----------
>  arch/arm/cpu/armv7/omap3/board.c               |    9 +--------
>  4 files changed, 11 insertions(+), 30 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c
> index eaf09d1..81477aa 100644
> --- a/arch/arm/cpu/armv7/am33xx/board.c
> +++ b/arch/arm/cpu/armv7/am33xx/board.c
> @@ -285,14 +285,6 @@ void s_init(void)
>  #ifdef CONFIG_NOR_BOOT
>         enable_norboot_pin_mux();
>  #endif
> -       /*
> -        * Save the boot parameters passed from romcode.
> -        * We cannot delay the saving further than this,
> -        * to prevent overwrites.
> -        */
> -#ifdef CONFIG_SPL_BUILD
> -       save_omap_boot_params();
> -#endif
>         watchdog_disable();
>         set_uart_mux_conf();
>         setup_clocks_for_console();
> @@ -301,9 +293,6 @@ void s_init(void)
>         gd->baudrate = CONFIG_BAUDRATE;
>         serial_init();
>         gd->have_console = 1;
> -#elif defined(CONFIG_SPL_BUILD)
> -       gd = &gdata;
> -       preloader_console_init();
>  #endif
>  #if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
>         /* Enable RTC32K clock */
> diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
> index cb18908..3ba62db 100644
> --- a/arch/arm/cpu/armv7/omap-common/boot-common.c
> +++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
> @@ -104,6 +104,16 @@ u32 spl_boot_mode(void)
>
>  void spl_board_init(void)
>  {
> +       /*
> +        * Save the boot parameters passed from romcode.
> +        * We cannot delay the saving further than this,
> +        * to prevent overwrites.
> +        */
> +       save_omap_boot_params();
> +
> +       /* Prepare console output */
> +       preloader_console_init();
> +
>  #ifdef CONFIG_SPL_NAND_SUPPORT
>         gpmc_init();
>  #endif
> diff --git a/arch/arm/cpu/armv7/omap-common/hwinit-common.c b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
> index dd52e93..cb35c19 100644
> --- a/arch/arm/cpu/armv7/omap-common/hwinit-common.c
> +++ b/arch/arm/cpu/armv7/omap-common/hwinit-common.c
> @@ -111,14 +111,6 @@ int arch_cpu_init(void)
>   */
>  void s_init(void)
>  {
> -       /*
> -        * Save the boot parameters passed from romcode.
> -        * We cannot delay the saving further than this,
> -        * to prevent overwrites.
> -        */
> -#ifdef CONFIG_SPL_BUILD
> -       save_omap_boot_params();
> -#endif
>         init_omap_revision();
>         hw_data_init();
>
> @@ -133,9 +125,6 @@ void s_init(void)
>         srcomp_enable();
>         setup_clocks_for_console();
>
> -       gd = &gdata;
> -
> -       preloader_console_init();
>         do_io_settings();
>  #endif
>         prcm_init();
> diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
> index 53a9e5d..90d6ae7 100644
> --- a/arch/arm/cpu/armv7/omap3/board.c
> +++ b/arch/arm/cpu/armv7/omap3/board.c
> @@ -119,6 +119,7 @@ int board_mmc_init(bd_t *bis)
>
>  void spl_board_init(void)
>  {
> +       preloader_console_init();
>  #if defined(CONFIG_SPL_NAND_SUPPORT) || defined(CONFIG_SPL_ONENAND_SUPPORT)
>         gpmc_init();
>  #endif
> @@ -264,14 +265,6 @@ void s_init(void)
>         ehci_clocks_enable();
>  #endif
>
> -#ifdef CONFIG_SPL_BUILD
> -       gd = &gdata;
> -
> -       preloader_console_init();
> -
> -       timer_init();
> -#endif
> -
>         if (!in_sdram)
>                 mem_init();
>  }
> --
> 1.7.9.5
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list