]> git.sur5r.net Git - u-boot/commitdiff
arm: mxs: Wait for DRAM to start
authorMarek Vasut <marex@denx.de>
Mon, 28 Apr 2014 01:38:41 +0000 (03:38 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 29 Sep 2014 07:02:16 +0000 (09:02 +0200)
Instead of waiting for a fixed period of time and hoping for the best
that the DRAM will start, read back an EMI status register which tells
us exactly when the DRAM started.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c

index de8841a0e1ea9e9f5c79b9a2047044ef337edb2e..97ef67d8c5843b06fcd6c7d903cd3d4cb21d976b 100644 (file)
@@ -274,7 +274,13 @@ static void mx23_mem_init(void)
        setbits_le32(MXS_DRAM_BASE + 0x20, 1 << 16);
 
        clrbits_le32(MXS_DRAM_BASE + 0x40, 1 << 17);
-       early_delay(20000);
+
+       /* Wait for EMI_STAT bit DRAM_HALTED */
+       for (;;) {
+               if (!(readl(MXS_EMI_BASE + 0x10) & (1 << 1)))
+                       break;
+               early_delay(1000);
+       }
 
        /* Adjust EMI port priority. */
        clrsetbits_le32(0x80020000, 0x1f << 16, 0x2);