ARM: imx8mp: verdin-imx8mp: Add memory size detection
authorFrancesco Dolcini <francesco.dolcini@toradex.com>
Wed, 7 Sep 2022 09:51:05 +0000 (11:51 +0200)
committerStefano Babic <sbabic@denx.de>
Thu, 20 Oct 2022 15:35:51 +0000 (17:35 +0200)
Add RAM auto-sizing, without this change memory size for all SKU is set
to 8GB and the system will crash on SKU with less memory as soon as the
non existent memory addresses are accessed.

Fixes: 2bc2f817cea7 ("board: toradex: add verdin imx8m plus support")
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
board/toradex/verdin-imx8mp/verdin-imx8mp.c

index 06f665b92c1d68eed6b34a7d2082e508ceee7dc6..9c2e44a12295c4f5cc5b797d4097d9a331a0aa44 100644 (file)
@@ -118,6 +118,16 @@ int board_late_init(void)
        return 0;
 }
 
+int board_phys_sdram_size(phys_size_t *size)
+{
+       if (!size)
+               return -EINVAL;
+
+       *size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE + PHYS_SDRAM_2_SIZE);
+
+       return 0;
+}
+
 #if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {