Skip to contentSkip to conversation

rpi: fix dram bank initialization

PATCH New matthias.bgg at kernel.org 1 participant 3 messages Dec 5, 2019 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 rpi: fix dram bank initialization

From: Matthias Brugger <[email protected]>

To update the dram bank information from device-tree we use fdtdec_decode_ram_size() which expectes the the size-cells and address-cells to be defined in the memory node. For normal system RAM these values are defined in the root node. When the values differ from the default values defined in the spec, we can end up with wrong RAM bank information.

Switch to the "standard" way to update the RAM bank information to avoid this.

Fixes 9de5b89e4c ("rpi4: enable dram bank initialization")

---

Changes in v2: None

 board/raspberrypi/rpi/rpi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
board/raspberrypi/rpi/rpi.c +7 -2
index 5f120ea9c2..e19610f40f 100644
@@ -275,8 +275,13 @@ int dram_init(void)
 #ifdef CONFIG_BCM2711
 int dram_init_banksize(void)
 {
-	return fdtdec_decode_ram_size(gd->fdt_blob, NULL, 0, NULL,
-				     (phys_size_t *)&gd->ram_size, gd->bd);
+	int ret;
+
+	ret = fdtdec_setup_memory_banksize();
+	if (ret)
+		return ret;
+
+	return fdtdec_setup_mem_size_base();
 }
 #endif
 #endif
Signature · 1 line
2.24.0
#1 lore raw

PATCH v2 2/3 rpi: Enable DRAM bank initialization on arm64

From: Matthias Brugger <[email protected]>

Up to now we only update the DRAM banks when we are define CONFIG_BCM2711. But our one binary approach uses a config that supports BCM2837 and BCM2711. As a result we only see one gibibyte of RAM on Raspberry Pi 4, even if it has more RAM.
Fix this by calling dram_init_banksize.

Fixes 5694090670 ("ARM: defconfig: add unified config for RPi3 and RPi4")

---

Changes in v2:
- fix commit message
- call dram_init_banksize independent of ARM64

 board/raspberrypi/rpi/rpi.c | 2 --
 1 file changed, 2 deletions(-)
board/raspberrypi/rpi/rpi.c +0 -2
index e19610f40f..e367ba3092 100644
@@ -272,7 +272,6 @@ int dram_init(void)
 }
 
 #ifdef CONFIG_OF_BOARD
-#ifdef CONFIG_BCM2711
 int dram_init_banksize(void)
 {
 	int ret;
@@ -284,7 +283,6 @@ int dram_init_banksize(void)
 	return fdtdec_setup_mem_size_base();
 }
 #endif
-#endif
 
 static void set_fdtfile(void)
 {
Signature · 1 line
2.24.0
#2 lore raw

PATCH v2 3/3 ARM: defconfig: Fix 32bit config for RPi4

In reply to matthias.bgg at kernel.org

From: Matthias Brugger <[email protected]>

The rpi_4_32b_defconfig states that only one DRAM bank is present. This leads to a wrong configuration of the available DRAM. Fix this by setting the DRAM bank config accordingly.

Fixes 193279d784 ("RPI: Add defconfigs for rpi4 (32/64)")

---

Changes in v2:
- fix rpi_4_32b_defconfig

 configs/rpi_4_32b_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/rpi_4_32b_defconfig +1 -1
index 7ff390cd24..ce729df2a0 100644
@@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00008000
 CONFIG_TARGET_RPI_4_32B=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ENV_SIZE=0x4000
-CONFIG_NR_DRAM_BANKS=1
+CONFIG_NR_DRAM_BANKS=2
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
Signature · 1 line
2.24.0