[U-Boot] [PATCH] stm32f7: board: Fix memory init

Vikas Manocha vikas.manocha at st.com
Fri Aug 3 00:48:54 UTC 2018


Hi Patrice,

On 08/02/2018 05:18 AM, Patrice Chotard wrote:
> Commit 1473b12ad0b3 ("lib: fdtdec: Update ram_base to store ram start
> adddress") brings regression on STM32F7 which can't boot.
> 
> Use fdtdec_setup_mem_size_base() to setup memory base and size.
> Use fdtdec_setup_memory_banksize() to setup memory bank base and size.
> 
> Reported-by: Mark Olsson <mark at markolsson.se>
> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
> Cc: Mark Olsson <mark at markolsson.se>

Reviewed-by: Vikas Manocha <vikas.manocha at st.com>
one minor comment below.

> ---
> 
>  board/st/stm32f746-disco/stm32f746-disco.c | 31 ++++--------------------------
>  1 file changed, 4 insertions(+), 27 deletions(-)
> 
> diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
> index e21cfc6e4955..a997e1825abf 100644
> --- a/board/st/stm32f746-disco/stm32f746-disco.c
> +++ b/board/st/stm32f746-disco/stm32f746-disco.c
> @@ -21,23 +21,9 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> -int get_memory_base_size(fdt_addr_t *mr_base, fdt_addr_t *mr_size)
> -{
> -	int mr_node;
> -
> -	mr_node = fdt_path_offset(gd->fdt_blob, "/memory");
> -	if (mr_node < 0)
> -		return mr_node;
> -	*mr_base = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, mr_node,
> -						      "reg", 0, mr_size, false);
> -	debug("mr_base = %lx, mr_size= %lx\n", *mr_base, *mr_size);
> -
> -	return 0;
> -}
>  int dram_init(void)
>  {
> -	int rv;
> -	fdt_addr_t mr_base, mr_size;
> +	int rv = 0;
this variable can be removed by returning 0 or error directly.

Cheers,
Vikas

>  
>  #ifndef CONFIG_SUPPORT_SPL
>  	struct udevice *dev;
> @@ -48,24 +34,15 @@ int dram_init(void)
>  	}
>  
>  #endif
> -	rv = get_memory_base_size(&mr_base, &mr_size);
> -	if (rv)
> -		return rv;
> -	gd->ram_size = mr_size;
> -	gd->ram_top = mr_base;
> +	if (fdtdec_setup_mem_size_base() != 0)
> +		rv = -EINVAL;
>  
>  	return rv;
>  }
>  
>  int dram_init_banksize(void)
>  {
> -	fdt_addr_t mr_base, mr_size;
> -	get_memory_base_size(&mr_base, &mr_size);
> -	/*
> -	 * Fill in global info with description of SRAM configuration
> -	 */
> -	gd->bd->bi_dram[0].start = mr_base;
> -	gd->bd->bi_dram[0].size  = mr_size;
> +	fdtdec_setup_memory_banksize();
>  
>  	return 0;
>  }
> 


More information about the U-Boot mailing list