diff mbox

[U-Boot,1/2] board_init: Fix the logic to setup malloc_base

Message ID 1447280104-23967-1-git-send-email-festevam@gmail.com
State Superseded
Headers show

Commit Message

Fabio Estevam Nov. 11, 2015, 10:15 p.m. UTC
From: Fabio Estevam <fabio.estevam@freescale.com>

Prior to commit 5ba534d247d418 ("arm: Switch 32-bit ARM to using generic
global_data setup") we used to have assembly code that configured the
malloc_base address.

After this commit we use the board_init_f_mem() function in C to setup
malloc_base address.

However the ifdef logic has a problem that prevents malloc_base to be
configured in the SPL case.

This issue has been observed in a Congatec board, where we need to
retrieve the manufacturing information from the SPI NOR (the SPI API 
calls malloc) prior to configuring the DRAM. In this case as malloc_base
was not configured we always see malloc to fail.

Adjust the ifdef logic so that malloc_base is always configured when
CONFIG_SYS_MALLOC_F is set.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 common/init/board_init.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Simon Glass Nov. 11, 2015, 10:27 p.m. UTC | #1
Hi Fabio,

On 11 November 2015 at 15:15, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Prior to commit 5ba534d247d418 ("arm: Switch 32-bit ARM to using generic
> global_data setup") we used to have assembly code that configured the
> malloc_base address.
>
> After this commit we use the board_init_f_mem() function in C to setup
> malloc_base address.
>
> However the ifdef logic has a problem that prevents malloc_base to be
> configured in the SPL case.

Would you mind rewording this a bit to avoid confusion? The point here
is that a deliberate choice was made to support only early malloc() or
full malloc() in SPL, but not both. The point of your change is to
allow both to be used, one after the other, in SPL.

>
> This issue has been observed in a Congatec board, where we need to
> retrieve the manufacturing information from the SPI NOR (the SPI API
> calls malloc) prior to configuring the DRAM. In this case as malloc_base
> was not configured we always see malloc to fail.
>
> Adjust the ifdef logic so that malloc_base is always configured when
> CONFIG_SYS_MALLOC_F is set.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  common/init/board_init.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/common/init/board_init.c b/common/init/board_init.c
> index e74b63b..1c6126d 100644
> --- a/common/init/board_init.c
> +++ b/common/init/board_init.c
> @@ -50,8 +50,7 @@ ulong board_init_f_mem(ulong top)
>  #endif
>         arch_setup_gd(gd_ptr);
>
> -#if defined(CONFIG_SYS_MALLOC_F) && \
> -       (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START))
> +#if defined(CONFIG_SYS_MALLOC_F)
>         top -= CONFIG_SYS_MALLOC_F_LEN;
>         gd->malloc_base = top;
>  #endif
> --
> 1.9.1
>

Regards,
Simon
diff mbox

Patch

diff --git a/common/init/board_init.c b/common/init/board_init.c
index e74b63b..1c6126d 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -50,8 +50,7 @@  ulong board_init_f_mem(ulong top)
 #endif
 	arch_setup_gd(gd_ptr);
 
-#if defined(CONFIG_SYS_MALLOC_F) && \
-	(!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START))
+#if defined(CONFIG_SYS_MALLOC_F)
 	top -= CONFIG_SYS_MALLOC_F_LEN;
 	gd->malloc_base = top;
 #endif