aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2021-02-01 12:16:33 +0100
committerMatthias Brugger <mbrugger@suse.com>2021-02-18 11:56:25 +0100
commit6b3d18c2cb61e5beefbce2de589fe7707ac78fe3 (patch)
treef924bfacf96721e8a40a4be1d0eecf42d8a13bc8
parent85f3fddbcc2e8282f1c26dcef4684f59490d47ba (diff)
downloadu-boot-6b3d18c2cb61e5beefbce2de589fe7707ac78fe3.zip
u-boot-6b3d18c2cb61e5beefbce2de589fe7707ac78fe3.tar.gz
u-boot-6b3d18c2cb61e5beefbce2de589fe7707ac78fe3.tar.bz2
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 <m.szyprowski@samsung.com> Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
-rw-r--r--board/raspberrypi/rpi/rpi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 6b1fa5f..6a9384f 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;
}