[U-Boot] [PATCH v2 2/2] ARM: davinci: SPL: fix BSS initialization

Adam Ford aford173 at gmail.com
Tue May 28 15:14:07 UTC 2019


On Mon, May 27, 2019 at 6:46 AM Sekhar Nori <nsekhar at ti.com> wrote:
>
> U-Boot README recommends initializing SDRAM in board_init_f(). DA850
> was doing it as part of board_init_r() (through call to spl_board_init()
> which calls arch_cpu_init() which calls da850_ddr_setup())
>
> This worked fine till commit 15b8c7505819 ("davinci:
> da850evm/omapl138-lcdk: Move BSS to SDRAM because SRAM is full") moved
> BSS to SDRAM.
>
> Functions like mmc_initialize() called in board_init_r() assume BSS is
> available. Since SDRAM was not initialized when arch/arm/lib/crt0.S tried
> to initialize BSS to 0, BSS is not initialized correctly.
>
> Fix this by simply calling arch_cpu_init() from board_init_f(). Also move
> preloader_console_init() there to help debug issues with board_init_r().
>
> With this spl_board_init() is no longer needed, we remove it.

I like this idea.

>
> Tested using MMC/SD boot on OMAP-L138 LCDK board.
>
> Signed-off-by: Sekhar Nori <nsekhar at ti.com>
> ---
>  arch/arm/mach-davinci/spl.c       | 2 +-
>  configs/da850_am18xxevm_defconfig | 1 -
>  configs/da850evm_defconfig        | 1 -
>  configs/da850evm_nand_defconfig   | 1 -
>  configs/ipam390_defconfig         | 1 -
>  configs/omapl138_lcdk_defconfig   | 1 -
>  6 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/spl.c b/arch/arm/mach-davinci/spl.c
> index 103639e34757..9861afd820a1 100644
> --- a/arch/arm/mach-davinci/spl.c
> +++ b/arch/arm/mach-davinci/spl.c
> @@ -31,7 +31,7 @@ void putc(char c)
>  }
>  #endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
>
> -void spl_board_init(void)
> +void board_init_f(ulong dummy)
>  {

The da850 uses the device tree to get the serial port information, and
someone else just submitted a patch to enable the device tree for the
LCDK.  At least for the da850-evm, we need to initialize the spl stuff
here to fetch the device tree info in order to enable the serial port
for preload_console_init() or it hangs.

I think we should add spl_early_init(); If you don't want it enabled
all the time, we could encapsulate it in an ifdef checking for the
presence of OF_CONTROL, but I think it should be harmless to have it
executed all the time based on my interpretation of the readme file.


>         arch_cpu_init();
>         preloader_console_init();
> diff --git a/configs/da850_am18xxevm_defconfig b/configs/da850_am18xxevm_defconfig
> index f09822211312..7ecdc361ce85 100644
> --- a/configs/da850_am18xxevm_defconfig
> +++ b/configs/da850_am18xxevm_defconfig
> @@ -20,7 +20,6 @@ CONFIG_VERSION_VARIABLE=y
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  CONFIG_BOARD_EARLY_INIT_F=y
>  CONFIG_SPL_TEXT_BASE=0x80000000
> -CONFIG_SPL_BOARD_INIT=y
>  CONFIG_SPL_SPI_LOAD=y
>  CONFIG_HUSH_PARSER=y
>  CONFIG_SYS_PROMPT="U-Boot > "
> diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
> index 8c16d5c4f5a7..c09505828255 100644
> --- a/configs/da850evm_defconfig
> +++ b/configs/da850evm_defconfig
> @@ -21,7 +21,6 @@ CONFIG_VERSION_VARIABLE=y
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  CONFIG_BOARD_EARLY_INIT_F=y
>  CONFIG_SPL_TEXT_BASE=0x80000000
> -CONFIG_SPL_BOARD_INIT=y
>  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
>  CONFIG_SPL_SEPARATE_BSS=y
>  CONFIG_SPL_SPI_LOAD=y
> diff --git a/configs/da850evm_nand_defconfig b/configs/da850evm_nand_defconfig
> index b8eac0e65995..727101634679 100644
> --- a/configs/da850evm_nand_defconfig
> +++ b/configs/da850evm_nand_defconfig
> @@ -19,7 +19,6 @@ CONFIG_VERSION_VARIABLE=y
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  CONFIG_BOARD_EARLY_INIT_F=y
>  CONFIG_SPL_TEXT_BASE=0x80000000
> -CONFIG_SPL_BOARD_INIT=y
>  CONFIG_SPL_SYS_MALLOC_SIMPLE=y
>  CONFIG_SPL_SEPARATE_BSS=y
>  CONFIG_SPL_NAND_SUPPORT=y
> diff --git a/configs/ipam390_defconfig b/configs/ipam390_defconfig
> index f2270264bda4..88a0d971ef28 100644
> --- a/configs/ipam390_defconfig
> +++ b/configs/ipam390_defconfig
> @@ -14,7 +14,6 @@ CONFIG_VERSION_VARIABLE=y
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  CONFIG_BOARD_EARLY_INIT_F=y
>  CONFIG_SPL_TEXT_BASE=0x80000000
> -CONFIG_SPL_BOARD_INIT=y
>  CONFIG_SPL_NAND_SUPPORT=y
>  CONFIG_SPL_OS_BOOT=y
>  CONFIG_HUSH_PARSER=y
> diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig
> index e43141844a10..48f251ebb804 100644
> --- a/configs/omapl138_lcdk_defconfig
> +++ b/configs/omapl138_lcdk_defconfig
> @@ -18,7 +18,6 @@ CONFIG_VERSION_VARIABLE=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  CONFIG_BOARD_EARLY_INIT_F=y
>  CONFIG_SPL_TEXT_BASE=0x80000000
> -CONFIG_SPL_BOARD_INIT=y
>  CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5
>  CONFIG_SPL_NAND_SUPPORT=y
>  CONFIG_HUSH_PARSER=y
> --
> 2.16.2
>


More information about the U-Boot mailing list