mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [RFC only] ARM: i.MX: Fix SDRAM size detect
@ 2013-04-26 10:21 Alexander Shiyan
  2013-04-26 10:48 ` Sascha Hauer
  0 siblings, 1 reply; 14+ messages in thread
From: Alexander Shiyan @ 2013-04-26 10:21 UTC (permalink / raw)
  To: barebox

This is a trying to fix problem described in:
http://lists.infradead.org/pipermail/barebox/2013-April/014182.html

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-imx/esdctl.c | 13 ++-----------
 arch/arm/mach-imx/imx51.c  | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index cb57d45..bde02fd 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -345,7 +345,7 @@ static int imx_esdctl_init(void)
 	return platform_driver_register(&imx_serial_driver);
 }
 
-mem_initcall(imx_esdctl_init);
+//mem_initcall(imx_esdctl_init);
 
 /*
  * The i.MX SoCs usually have two SDRAM chipselects. The following
@@ -435,16 +435,7 @@ void __naked __noreturn imx35_barebox_entry(uint32_t boarddata)
 
 void __naked __noreturn imx51_barebox_entry(uint32_t boarddata)
 {
-	unsigned long base;
-	unsigned long size;
-
-	base = MX51_CSD0_BASE_ADDR;
-
-	size = imx_v3_sdram_size((void *)MX51_ESDCTL_BASE_ADDR, 0);
-	if (size == SZ_256M)
-		size += imx_v3_sdram_size((void *)MX51_ESDCTL_BASE_ADDR, 1);
-
-	barebox_arm_entry(base, size, boarddata);
+	barebox_arm_entry(MX51_CSD0_BASE_ADDR, SZ_128M, boarddata);
 }
 
 void __naked __noreturn imx53_barebox_entry(uint32_t boarddata)
diff --git a/arch/arm/mach-imx/imx51.c b/arch/arm/mach-imx/imx51.c
index 54d99a4..6593b7d 100644
--- a/arch/arm/mach-imx/imx51.c
+++ b/arch/arm/mach-imx/imx51.c
@@ -21,6 +21,8 @@
 #include <mach/revision.h>
 #include <mach/clock-imx51_53.h>
 #include <mach/generic.h>
+#include <mach/esdctl.h>
+#include <asm/memory.h>
 
 #define SI_REV 0x48
 
@@ -76,6 +78,25 @@ static int imx51_init(void)
 }
 postcore_initcall(imx51_init);
 
+static int imx51_memory_init(void)
+{
+	void __iomem *esdctl = IOMEM(MX51_ESDCTL_BASE_ADDR + IMX_ESDCTL1);
+	unsigned long add, size = SZ_128M;
+
+	add = get_ram_size((ulong *)(MX51_CSD0_BASE_ADDR + SZ_128M), SZ_128M);
+	if (add) {
+		size += add;
+		if (readl(esdctl) & ESDCTL0_SDE)
+			size += get_ram_size((ulong *)MX51_CSD1_BASE_ADDR, SZ_256M);
+
+	}
+
+	arm_add_mem_device("ram0", MX51_CSD0_BASE_ADDR, size);
+
+	return 0;
+}
+mem_initcall(imx51_memory_init);
+
 /*
  * Saves the boot source media into the $bootsource environment variable
  *
-- 
1.8.1.5


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

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

end of thread, other threads:[~2013-05-08  6:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-26 10:21 [RFC only] ARM: i.MX: Fix SDRAM size detect Alexander Shiyan
2013-04-26 10:48 ` Sascha Hauer
2013-04-26 11:12   ` Re[2]: " Alexander Shiyan
2013-04-26 11:42     ` Sascha Hauer
2013-04-26 11:50       ` Re[2]: " Alexander Shiyan
2013-04-26 21:48         ` [PATCH] Fix ccxmx51 SDRAM size detection Sascha Hauer
2013-04-26 21:48           ` [PATCH 1/2] ARM: i.MX: Allow disabling SDRAM autodetection Sascha Hauer
2013-04-26 21:48           ` [PATCH 2/2] ARM: i.MX: ccxmx51: detect SDRAM size by board id Sascha Hauer
2013-05-07 11:45             ` Alexander Shiyan
2013-05-08  6:25               ` Sascha Hauer
2013-05-07 12:39             ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-07 12:46               ` Re[2]: " Alexander Shiyan
2013-05-07 16:06                 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-27  4:41           ` [PATCH] Fix ccxmx51 SDRAM size detection Alexander Shiyan

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