[U-Boot] [PATCH 04/10] arm: socfpga: Update dram_init_banksize() for Stratix10

Marek Vasut marex at denx.de
Tue Mar 12 10:45:36 UTC 2019


On 3/12/19 9:31 AM, Ley Foon Tan wrote:
> Setup bi_dram struct based on returned from setup_memory_banks().
> 
> Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
> ---
>  arch/arm/mach-socfpga/board.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-socfpga/board.c b/arch/arm/mach-socfpga/board.c
> index 7c8c05cc31..a0e9917e47 100644
> --- a/arch/arm/mach-socfpga/board.c
> +++ b/arch/arm/mach-socfpga/board.c
> @@ -12,6 +12,7 @@
>  #include <asm/arch/clock_manager.h>
>  #include <asm/arch/misc.h>
>  #include <asm/io.h>
> +#include <asm/arch/sdram.h>
>  
>  #include <usb.h>
>  #include <usb/dwc2_udc.h>
> @@ -48,8 +49,21 @@ int board_init(void)
>  
>  int dram_init_banksize(void)
>  {
> -	fdtdec_setup_memory_banksize();
> +#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) && defined(CONFIG_ALTERA_SDRAM)
> +	phys_addr_t bank_start[CONFIG_NR_DRAM_BANKS];
> +	phys_size_t bank_size[CONFIG_NR_DRAM_BANKS];
> +	int bank;
> +
> +	gd->ram_size = sdram_calculate_size();
> +	setup_memory_banks(bank_start, bank_size);
>  
> +	for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
> +		gd->bd->bi_dram[bank].start = bank_start[bank];
> +		gd->bd->bi_dram[bank].size = bank_size[bank];
> +	}
> +#else
> +	fdtdec_setup_memory_banksize();
> +#endif
>  	return 0;
>  }

Split this out into separate file if this really needs to be different,
but can't you somehow use fdtdec_setup_memory_size() on S10 and then
apply sanity checking instead ?

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list