summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-toradex/0001-ARM-imx8mp-verdin-imx8mp-Add-memory-size-detection.patch
blob: b3adb6651e6f3d6b300c9a2edcb95b65999044bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From dea2132a615a744f7f00ebbc551c53867c7537dc Mon Sep 17 00:00:00 2001
From: Francesco Dolcini <francesco.dolcini@toradex.com>
Date: Tue, 6 Sep 2022 17:12:17 +0200
Subject: [PATCH] ARM: imx8mp: verdin-imx8mp: Add memory size detection

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.

Upstream-Status: Submitted [https://lore.kernel.org/u-boot/20220907095105.21630-1-francesco.dolcini@toradex.com/]
Fixes: 2bc2f817cea7 ("board: toradex: add verdin imx8m plus support")
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
 board/toradex/verdin-imx8mp/verdin-imx8mp.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/board/toradex/verdin-imx8mp/verdin-imx8mp.c b/board/toradex/verdin-imx8mp/verdin-imx8mp.c
index e3c1a1201daa..743e00bf9c46 100644
--- a/board/toradex/verdin-imx8mp/verdin-imx8mp.c
+++ b/board/toradex/verdin-imx8mp/verdin-imx8mp.c
@@ -121,6 +121,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)
 {
-- 
2.25.1