Message ID | 1552379474-12867-5-git-send-email-ley.foon.tan@intel.com |
---|---|
State | Superseded |
Delegated to: | Marek Vasut |
Headers | show |
Series | Update Stratix 10 SDRAM driver | expand |
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@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 ?
On Tue, 2019-03-12 at 11:45 +0100, Marek Vasut wrote: > 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@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 ? > yes, this can be done with fdtdec_setup_memory_size. --dalon
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; }
Setup bi_dram struct based on returned from setup_memory_banks(). Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com> --- arch/arm/mach-socfpga/board.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)