diff mbox

[U-Boot,20/23] ARM: rmobile: salvator-x: Count all DRAM in all slots

Message ID 20170513135753.8478-20-marek.vasut+renesas@gmail.com
State Accepted
Commit 8f284e660ba9aa7d1f56a62fd62146c3eab00125
Delegated to: Nobuhiro Iwamatsu
Headers show

Commit Message

Marek Vasut May 13, 2017, 1:57 p.m. UTC
Instead of counting only the DRAM in the first slot, count
all the DRAM in all slots and report it accordingly.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 board/renesas/salvator-x/salvator-x.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

Comments

Nobuhiro Iwamatsu May 13, 2017, 9:42 p.m. UTC | #1
Applied to rmobile branch, thanks!

2017-05-13 22:57 GMT+09:00 Marek Vasut <marek.vasut@gmail.com>:
> Instead of counting only the DRAM in the first slot, count
> all the DRAM in all slots and report it accordingly.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> ---
>  board/renesas/salvator-x/salvator-x.c | 30 +++++++++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c
> index 44e4006f5c..14385d7361 100644
> --- a/board/renesas/salvator-x/salvator-x.c
> +++ b/board/renesas/salvator-x/salvator-x.c
> @@ -235,8 +235,36 @@ int board_mmc_init(bd_t *bis)
>
>  int dram_init(void)
>  {
> -       gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> +       gd->ram_size = PHYS_SDRAM_1_SIZE;
> +#if (CONFIG_NR_DRAM_BANKS >= 2)
> +       gd->ram_size += PHYS_SDRAM_2_SIZE;
> +#endif
> +#if (CONFIG_NR_DRAM_BANKS >= 3)
> +       gd->ram_size += PHYS_SDRAM_3_SIZE;
> +#endif
> +#if (CONFIG_NR_DRAM_BANKS >= 4)
> +       gd->ram_size += PHYS_SDRAM_4_SIZE;
> +#endif
> +
> +       return 0;
> +}
>
> +int dram_init_banksize(void)
> +{
> +       gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
> +       gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
> +#if (CONFIG_NR_DRAM_BANKS >= 2)
> +       gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
> +       gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
> +#endif
> +#if (CONFIG_NR_DRAM_BANKS >= 3)
> +       gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
> +       gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
> +#endif
> +#if (CONFIG_NR_DRAM_BANKS >= 4)
> +       gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
> +       gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
> +#endif
>         return 0;
>  }
>
> --
> 2.11.0
>
diff mbox

Patch

diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c
index 44e4006f5c..14385d7361 100644
--- a/board/renesas/salvator-x/salvator-x.c
+++ b/board/renesas/salvator-x/salvator-x.c
@@ -235,8 +235,36 @@  int board_mmc_init(bd_t *bis)
 
 int dram_init(void)
 {
-	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+	gd->ram_size = PHYS_SDRAM_1_SIZE;
+#if (CONFIG_NR_DRAM_BANKS >= 2)
+	gd->ram_size += PHYS_SDRAM_2_SIZE;
+#endif
+#if (CONFIG_NR_DRAM_BANKS >= 3)
+	gd->ram_size += PHYS_SDRAM_3_SIZE;
+#endif
+#if (CONFIG_NR_DRAM_BANKS >= 4)
+	gd->ram_size += PHYS_SDRAM_4_SIZE;
+#endif
+
+	return 0;
+}
 
+int dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+#if (CONFIG_NR_DRAM_BANKS >= 2)
+	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+	gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+#endif
+#if (CONFIG_NR_DRAM_BANKS >= 3)
+	gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+	gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+#endif
+#if (CONFIG_NR_DRAM_BANKS >= 4)
+	gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+	gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
+#endif
 	return 0;
 }