mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs
@ 2016-04-01 12:10 Sascha Hauer
  2016-04-01 12:10 ` [PATCH 2/7] ARM: i.MX6: esdctl: Fix CS0_end " Sascha Hauer
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sascha Hauer @ 2016-04-01 12:10 UTC (permalink / raw)
  To: Barebox List

On i.MX6 a single chipselect can have 4GiB, which overflows a 32bit
type, so imx6_mmdc_sdram_size() must return a u64 to support this case.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/esdctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index e633b62..66ba51c 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -171,11 +171,11 @@ static inline unsigned long imx_v4_sdram_size(void __iomem *esdctlbase, int cs)
  * MMDC - found on i.MX6
  */
 
-static inline unsigned long imx6_mmdc_sdram_size(void __iomem *mmdcbase, int cs)
+static inline u64 imx6_mmdc_sdram_size(void __iomem *mmdcbase, int cs)
 {
 	u32 ctlval = readl(mmdcbase + MDCTL);
 	u32 mdmisc = readl(mmdcbase + MDMISC);
-	unsigned long size;
+	u64 size;
 	int rows, cols, width = 2, banks = 8;
 
 	if (cs == 0 && !(ctlval & MMDCx_MDCTL_SDE0))
@@ -201,7 +201,7 @@ static inline unsigned long imx6_mmdc_sdram_size(void __iomem *mmdcbase, int cs)
 	if (mdmisc & MMDCx_MDMISC_DDR_4_BANKS)
 		banks = 4;
 
-	size = (1 << cols) * (1 << rows) * banks * width;
+	size = (u64)(1 << cols) * (1 << rows) * banks * width;
 
 	return size;
 }
-- 
2.7.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-01 12:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
2016-04-01 12:10 ` [PATCH 2/7] ARM: i.MX6: esdctl: Fix CS0_end " Sascha Hauer
2016-04-01 12:10 ` [PATCH 3/7] ARM: i.MX: remove unused imx-flash-header.h Sascha Hauer
2016-04-01 12:10 ` [PATCH 4/7] ARM: i.MX: xload-esdhc: Add GPL header Sascha Hauer
2016-04-01 12:10 ` [PATCH 5/7] ARM: i.MX: xload-esdhc: Fix typo successul -> successful Sascha Hauer
2016-04-01 12:10 ` [PATCH 6/7] ARM: i.MX: xload-esdhc: Add debug messages Sascha Hauer
2016-04-01 12:10 ` [PATCH 7/7] ARM: i.MX: xload-esdhc: Find entry in image Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox