From: Matthias Brugger <mbrug...@suse.com>

When booting through the efi stub, the memory map get's created by
reading the dram bank information. Depending on the version of the RPi4
this information changes. Read the device tree to initialize the dram
bank data structure. This way the kernel is able to access the whole
range of available memory.

Signed-off-by: Matthias Brugger <mbrug...@suse.com>
---
This patch is based on basic RPi4 support implemented by series:
https://www.mail-archive.com/u-boot@lists.denx.de/msg335667.html
which is part of v2019.10-rc4

To actually work correctly we need the series that fixes the libftd:
https://patchwork.ozlabs.org/cover/1158304/

Changes in v2:
- don't call dram_init_banksize if OF_BOARD is not used

 board/raspberrypi/rpi/rpi.c | 10 ++++++++++
 configs/rpi_4_defconfig     |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index fa57d50c95..9e0abdda31 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -312,6 +312,16 @@ int dram_init(void)
        return 0;
 }
 
+#ifdef CONFIG_OF_BOARD
+#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);
+}
+#endif
+#endif
+
 static void set_fdtfile(void)
 {
        const char *fdtfile;
diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig
index da8c960a2a..c639ac93de 100644
--- a/configs/rpi_4_defconfig
+++ b/configs/rpi_4_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x00080000
 CONFIG_TARGET_RPI_4=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_DISTRO_DEFAULTS=y
-CONFIG_NR_DRAM_BANKS=1
+CONFIG_NR_DRAM_BANKS=2
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
 CONFIG_OF_BOARD=y
 CONFIG_OF_BOARD_SETUP=y
-- 
2.22.0

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to