diff mbox series

[v7,03/10] board_f: Add default values for bi_dram[] in dram_init_banksize()

Message ID 20200820044452.2786286-4-sr@denx.de
State Superseded
Delegated to: Tom Rini
Headers show
Series Remove CONFIG_NR_DRAM_BANKS option and bi_memstart/memsize from bd_info | expand

Commit Message

Stefan Roese Aug. 20, 2020, 4:44 a.m. UTC
Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
make sure, that bd_dram[] is always configured in the weak default
implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
not set.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>

---

Changes in v7:
- Add Reviewe-by tag from Ovidiu

Changes in v6:
- Simplify dram_init_banksize() even more as suggested by Daniel

Changes in v4:
- New patch

 common/board_f.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Bin Meng Aug. 20, 2020, 9:22 a.m. UTC | #1
Hi Stefan,

On Thu, Aug 20, 2020 at 12:45 PM Stefan Roese <sr@denx.de> wrote:
>
> Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
> make sure, that bd_dram[] is always configured in the weak default
> implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
> not set.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>
>
> ---
>
> Changes in v7:
> - Add Reviewe-by tag from Ovidiu
>
> Changes in v6:
> - Simplify dram_init_banksize() even more as suggested by Daniel
>
> Changes in v4:
> - New patch
>
>  common/board_f.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/common/board_f.c b/common/board_f.c
> index d1f0f9af08..8a43df97e4 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -237,10 +237,8 @@ static int show_dram_config(void)
>
>  __weak int dram_init_banksize(void)
>  {
> -#if defined(CONFIG_SYS_SDRAM_BASE)
> -       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;

After this change, I guess CONFIG_SYS_SDRAM_BASE can be dropped in
board's config.h now?

> +       gd->bd->bi_dram[0].start = gd->ram_base;
>         gd->bd->bi_dram[0].size = get_effective_memsize();
> -#endif
>
>         return 0;
>  }
> @@ -602,9 +600,6 @@ int setup_bdinfo(void)
>  {
>         struct bd_info *bd = gd->bd;
>
> -       bd->bi_memstart = gd->ram_base;  /* start of memory */
> -       bd->bi_memsize = gd->ram_size;   /* size in bytes */
> -
>         if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) {
>                 bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
>                 bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;  /* size  of SRAM */
> --

Regards,
Bin
Stefan Roese Aug. 20, 2020, 9:29 a.m. UTC | #2
Hi Bin,

On 20.08.20 11:22, Bin Meng wrote:
> Hi Stefan,
> 
> On Thu, Aug 20, 2020 at 12:45 PM Stefan Roese <sr@denx.de> wrote:
>>
>> Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and
>> make sure, that bd_dram[] is always configured in the weak default
>> implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is
>> not set.
>>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Reviewed-by: Ovidiu Panait <ovidiu.panait@windriver.com>
>>
>> ---
>>
>> Changes in v7:
>> - Add Reviewe-by tag from Ovidiu
>>
>> Changes in v6:
>> - Simplify dram_init_banksize() even more as suggested by Daniel
>>
>> Changes in v4:
>> - New patch
>>
>>   common/board_f.c | 7 +------
>>   1 file changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/common/board_f.c b/common/board_f.c
>> index d1f0f9af08..8a43df97e4 100644
>> --- a/common/board_f.c
>> +++ b/common/board_f.c
>> @@ -237,10 +237,8 @@ static int show_dram_config(void)
>>
>>   __weak int dram_init_banksize(void)
>>   {
>> -#if defined(CONFIG_SYS_SDRAM_BASE)
>> -       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
> 
> After this change, I guess CONFIG_SYS_SDRAM_BASE can be dropped in
> board's config.h now?

No. Its still referenced in many other places, e.g.:

static int setup_dest_addr(void)
{
...
#ifdef CONFIG_SYS_SDRAM_BASE
	gd->ram_base = CONFIG_SYS_SDRAM_BASE;
#endif

Please see Daniel's explanation for this change here:

https://www.mail-archive.com/u-boot@lists.denx.de/msg380426.html

Thanks,
Stefan
diff mbox series

Patch

diff --git a/common/board_f.c b/common/board_f.c
index d1f0f9af08..8a43df97e4 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -237,10 +237,8 @@  static int show_dram_config(void)
 
 __weak int dram_init_banksize(void)
 {
-#if defined(CONFIG_SYS_SDRAM_BASE)
-	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+	gd->bd->bi_dram[0].start = gd->ram_base;
 	gd->bd->bi_dram[0].size = get_effective_memsize();
-#endif
 
 	return 0;
 }
@@ -602,9 +600,6 @@  int setup_bdinfo(void)
 {
 	struct bd_info *bd = gd->bd;
 
-	bd->bi_memstart = gd->ram_base;  /* start of memory */
-	bd->bi_memsize = gd->ram_size;   /* size in bytes */
-
 	if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) {
 		bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
 		bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;  /* size  of SRAM */