From 6b3d18c2cb61e5beefbce2de589fe7707ac78fe3 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Mon, 1 Feb 2021 12:16:33 +0100 Subject: rpi: limit size of the RAM to the multiple of the MMU_SECTION_SIZE When RPi4 is booted from USB Mass Storage, the firmware reports 947MiB of the ARM memory (948 in case of the standard SD-card boot). This value is not MMU_SECTION_SIZE aligned, so the dram_bank_mmu_setup() skips mapping of the last 1MiB. This later causes u-boot in ARM 32bit mode to freeze, because it relocated itself into that unmapped memory and fails to execute. Fix this by limiting the size of the first bank to the multiple of MMU_SECTION_SIZE. Signed-off-by: Marek Szyprowski Reviewed-by: Nicolas Saenz Julienne Tested-by: Jaehoon Chung Reviewed-by: Jaehoon Chung Signed-off-by: Matthias Brugger --- board/raspberrypi/rpi/rpi.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'board/raspberrypi/rpi/rpi.c') diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 6b1fa5fc14..6a9384f1d6 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -268,6 +268,13 @@ int dram_init(void) gd->ram_size = msg->get_arm_mem.body.resp.mem_size; + /* + * In some configurations the memory size returned by VideoCore + * is not aligned to the section size, what is mandatory for + * the u-boot's memory setup. + */ + gd->ram_size &= ~MMU_SECTION_SIZE; + return 0; } -- cgit v1.2.3 From f10f5362815e363fe6511348fd4077cf171cea3f Mon Sep 17 00:00:00 2001 From: Nicolas Saenz Julienne Date: Tue, 12 Jan 2021 13:55:19 +0100 Subject: rpi: Add identifier for the new RPi400 The Raspberry Pi Foundation released the new RPi400 which we want to detect, so we can enable Ethernet on it and know the correct device tree file name. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Peter Robinson Tested-by: Peter Robinson Signed-off-by: Matthias Brugger --- board/raspberrypi/rpi/rpi.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'board/raspberrypi/rpi/rpi.c') diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 6a9384f1d6..772cb40ca9 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -157,6 +157,11 @@ static const struct rpi_model rpi_models_new_scheme[] = { DTB_DIR "bcm2711-rpi-4-b.dtb", true, }, + [0x13] = { + "400", + DTB_DIR "bcm2711-rpi-400.dtb", + true, + }, }; static const struct rpi_model rpi_models_old_scheme[] = { -- cgit v1.2.3 From 561bce3522bd1df5f6b10fbae5a6ea5c0b131ff9 Mon Sep 17 00:00:00 2001 From: Nicolas Saenz Julienne Date: Tue, 12 Jan 2021 13:55:20 +0100 Subject: rpi: Add identifier for the new CM4 The Raspberry Pi Foundation released the new Compute Module 4 which we want to detect, so we can enable Ethernet on it and know the correct device tree file name. Note that this sets the Ethernet option to true since the official CM4 IO board has an Ethernet port. But that might not be the case when using custom ones. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Peter Robinson Tested-by: Peter Robinson Signed-off-by: Matthias Brugger --- board/raspberrypi/rpi/rpi.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'board/raspberrypi/rpi/rpi.c') diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 772cb40ca9..df52a4689f 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -162,6 +162,11 @@ static const struct rpi_model rpi_models_new_scheme[] = { DTB_DIR "bcm2711-rpi-400.dtb", true, }, + [0x14] = { + "Compute Module 4", + DTB_DIR "bcm2711-rpi-cm4.dtb", + true, + }, }; static const struct rpi_model rpi_models_old_scheme[] = { -- cgit v1.2.3