Skip to contentSkip to conversation

board: gateworks: venice: determine dram size at runtime

PATCH Superseded Tim Harvey 2 participants 2 messages Feb 18, 2022 – Feb 26, 2022 Arm i.MX and Layerscape

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 board: gateworks: venice: determine dram size at runtime

The SPL does not update the memory node with the dram size from EEPROM but instead we can use get_ram_size which does a simple memory test to determine the available RAM. Update PHYS_SDRAM_SIZE to 4GiB as that is the max used on the Venice boards.

---
 board/gateworks/venice/venice.c | 13 ++-----------
 include/configs/imx8mm_venice.h |  2 +-
 2 files changed, 3 insertions(+), 12 deletions(-)
board/gateworks/venice/venice.c +2 -11
index 4e05802b6ff1..5334500ef6a7 100644
@@ -21,19 +21,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int board_phys_sdram_size(phys_size_t *size)
 {
-	const fdt64_t *val;
-	int offset;
-	int len;
-
-	/* get size from dt which SPL updated per EEPROM config */
-	offset = fdt_path_offset(gd->fdt_blob, "/memory");
-	if (offset < 0)
+	if (!size)
 		return -EINVAL;
 
-	val = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
-	if (len < sizeof(*val) * 2)
-		return -EINVAL;
-	*size = get_unaligned_be64(&val[1]);
+	*size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
 
 	return 0;
 }
include/configs/imx8mm_venice.h +1 -1
index d9a86a62ed08..455a8d0187d8 100644
@@ -83,7 +83,7 @@
 
 /* SDRAM configuration */
 #define PHYS_SDRAM                      0x40000000
-#define PHYS_SDRAM_SIZE			SZ_1G /* 1GB DDR */
+#define PHYS_SDRAM_SIZE			SZ_4G
 #define CONFIG_SYS_BOOTM_LEN		SZ_256M
 
 /* UART */
Signature · 1 line
2.17.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Tim Harvey

The SPL does not update the memory node with the dram size from EEPROM but instead we can use get_ram_size which does a simple memory test to determine the available RAM. Update PHYS_SDRAM_SIZE to 4GiB as that is the max used on the Venice boards.