[U-Boot] [PATCH 06/10] board: altera: Stratix10: Add ft_board_setup()

Ley Foon Tan lftan.linux at gmail.com
Tue Mar 19 03:28:19 UTC 2019


On Tue, Mar 12, 2019 at 7:03 PM Marek Vasut <marex at denx.de> wrote:
>
> On 3/12/19 9:31 AM, Ley Foon Tan wrote:
> > Add ft_board_setup() function to setup memory banks before
> > boot to Linux.
>
> Shouldn't bootm/booti be doing just that already ?
Don't need this if we use fdtdec_setup_memory_banksize().

>
> > Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
> > ---
> >  board/altera/stratix10-socdk/socfpga.c | 25 +++++++++++++++++++++++++
> >  1 file changed, 25 insertions(+)
> >
> > diff --git a/board/altera/stratix10-socdk/socfpga.c b/board/altera/stratix10-socdk/socfpga.c
> > index 99c10d313c..ca6e0e9085 100644
> > --- a/board/altera/stratix10-socdk/socfpga.c
> > +++ b/board/altera/stratix10-socdk/socfpga.c
> > @@ -5,6 +5,7 @@
> >   */
> >
> >  #include <common.h>
> > +#include <fdt_support.h>
> >  #include <asm/arch/sdram.h>
> >  #include <linux/sizes.h>
> >
> > @@ -17,3 +18,27 @@ ulong board_get_usable_ram_top(ulong total_size)
> >               return sdram_calculate_size();
> >  }
> >  #endif
> > +
> > +#ifdef CONFIG_OF_BOARD_SETUP
> > +int ft_board_setup(void *blob, bd_t *bd)
> > +{
> > +     int ret = 0;
> > +#ifdef CONFIG_OF_LIBFDT
> > +     int bank;
> > +     int actual_bank = 0;
> > +     u64 start[CONFIG_NR_DRAM_BANKS];
> > +     u64 size[CONFIG_NR_DRAM_BANKS];
> > +
> > +     for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
> > +             if (bd->bi_dram[bank].size) {
> > +                     start[actual_bank] = bd->bi_dram[bank].start;
> > +                     size[actual_bank++] = bd->bi_dram[bank].size;
> > +             }
> > +     }
> > +
> > +     ret = fdt_fixup_memory_banks(blob, start, size, actual_bank);
> > +#endif /* CONFIG_OF_LIBFDT */
> > +
> > +     return ret;
> > +}
> > +#endif
> >
Regards
Ley Foon


More information about the U-Boot mailing list