summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mxs
diff options
context:
space:
mode:
authorBastian Krause <bst@pengutronix.de>2022-09-09 16:39:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-09-12 08:20:49 +0200
commit94de4d8dfcf22b3722e46fe1a4d02103bae914ed (patch)
tree8a41d44b31414cad6be69747e03bb4adde2a172b /arch/arm/mach-mxs
parent3e01858983aafb424b5ad10f11997af8cba99a5d (diff)
downloadbarebox-94de4d8dfcf22b3722e46fe1a4d02103bae914ed.tar.gz
barebox-94de4d8dfcf22b3722e46fe1a4d02103bae914ed.tar.xz
ARM: i.MX23: fix memory size calulcation
According to the i.MX233 Reference Manual (i.MX233RM, Rev. 4, 03 April 2009) section "14.1.1 AHB Address Ranges", the formula to calculate the DRAM memory size is: dram_memory_available = 2 * 2^col * 2^row * (# dram_devices) * (# banks_per_device) The calulcation in barebox misses the first factor, so the result is only half as big as it should be. On an iMX233 OLinuXino board the following errors can be observed: mmu: Critical Error: Can't request SDRAM region for ttb at 43fe4000 Error: Cannot request SDRAM region for stack The faulty calulcation leads to 32 MB being detected (as seen in the output of `iomem`), although 64 MB should be available (as passed to barebox_arm_entry() in lowlevel code). Fix the memory calculation by adding the missing factor 2. Fixes: 7158c5987e6 ("ARM: i.MX23: Add memory size detection") Signed-off-by: Bastian Krause <bst@pengutronix.de> Signed-off-by: Jürgen Borleis <jbe@pengutronix.de> Link: https://lore.barebox.org/20220909143915.4081275-1-bst@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mxs')
-rw-r--r--arch/arm/mach-mxs/include/mach/imx23.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/mach-mxs/include/mach/imx23.h b/arch/arm/mach-mxs/include/mach/imx23.h
index bdd3ae4407..03eddabed0 100644
--- a/arch/arm/mach-mxs/include/mach/imx23.h
+++ b/arch/arm/mach-mxs/include/mach/imx23.h
@@ -25,7 +25,7 @@ static inline u32 imx23_get_memsize(void)
cs0 = FIELD_GET(DRAM_CTL14_CS0_EN, ctl14);
cs1 = FIELD_GET(DRAM_CTL14_CS1_EN, ctl14);
- return (1 << columns) * (1 << rows) * banks * (cs0 + cs1);
+ return 2 * (1 << columns) * (1 << rows) * banks * (cs0 + cs1);
}
#endif /* __MACH_IMX23_H */