diff mbox series

board: synquacer: set actual gd->ram_top and gd->ram_size

Message ID 20231003022957.1743493-1-masahisa.kojima@linaro.org
State Accepted
Commit 357f4fb0bdc5ca1e6e881638b7089444f07b99d3
Headers show
Series board: synquacer: set actual gd->ram_top and gd->ram_size | expand

Commit Message

Masahisa Kojima Oct. 3, 2023, 2:29 a.m. UTC
Current gd->ram_size and gd->ram_top reflect only the
first DRAM bank even if the SynQuacer Developerbox could
have up to three DRAM banks.
With the commit 06d514d77c37 ("lmb: consider EFI memory map"),
the first DRAM bank indicates <4GB address, so whole >4GB memory
is marked as EFI_BOOT_SERVICES_DATA and it results that
U-Boot can not access >4GB memory.

Since 64-bits DRAM address is fully available on the SynQuacer
Developerbox, let's set the installed DIMM information to
gd->ram_top and gd->ram_size.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
---
 board/socionext/developerbox/developerbox.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Jassi Brar Oct. 3, 2023, 1:25 p.m. UTC | #1
On Mon, 2 Oct 2023 at 21:31, Masahisa Kojima <masahisa.kojima@linaro.org> wrote:
>
> Current gd->ram_size and gd->ram_top reflect only the
> first DRAM bank even if the SynQuacer Developerbox could
> have up to three DRAM banks.
> With the commit 06d514d77c37 ("lmb: consider EFI memory map"),
> the first DRAM bank indicates <4GB address, so whole >4GB memory
> is marked as EFI_BOOT_SERVICES_DATA and it results that
> U-Boot can not access >4GB memory.
>
> Since 64-bits DRAM address is fully available on the SynQuacer
> Developerbox, let's set the installed DIMM information to
> gd->ram_top and gd->ram_size.
>
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>

Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Tom Rini Oct. 11, 2023, 6:37 p.m. UTC | #2
On Tue, Oct 03, 2023 at 11:29:57AM +0900, Masahisa Kojima wrote:

> Current gd->ram_size and gd->ram_top reflect only the
> first DRAM bank even if the SynQuacer Developerbox could
> have up to three DRAM banks.
> With the commit 06d514d77c37 ("lmb: consider EFI memory map"),
> the first DRAM bank indicates <4GB address, so whole >4GB memory
> is marked as EFI_BOOT_SERVICES_DATA and it results that
> U-Boot can not access >4GB memory.
> 
> Since 64-bits DRAM address is fully available on the SynQuacer
> Developerbox, let's set the installed DIMM information to
> gd->ram_top and gd->ram_size.
> 
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
> Acked-by: Jassi Brar <jaswinder.singh@linaro.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c
index 204e5a41a5..9585944d80 100644
--- a/board/socionext/developerbox/developerbox.c
+++ b/board/socionext/developerbox/developerbox.c
@@ -145,13 +145,27 @@  int dram_init(void)
 {
 	struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE;
 	struct draminfo_entry *ent = synquacer_draminfo->entry;
+	unsigned long size = 0;
+	int i;
+
+	for (i = 0; i < synquacer_draminfo->nr_regions; i++)
+		size += ent[i].size;
 
-	gd->ram_size = ent[0].size;
+	gd->ram_size = size;
 	gd->ram_base = ent[0].base;
 
 	return 0;
 }
 
+phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
+{
+	struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE;
+	struct draminfo_entry *ent = synquacer_draminfo->entry;
+
+	return ent[synquacer_draminfo->nr_regions - 1].base +
+	       ent[synquacer_draminfo->nr_regions - 1].size;
+}
+
 int dram_init_banksize(void)
 {
 	struct draminfo *synquacer_draminfo = (void *)SQ_DRAMINFO_BASE;