From f2e3d22fb1963d08844edee45f7d7d6beba32152 Mon Sep 17 00:00:00 2001 From: Steve Sakoman Date: Tue, 23 Mar 2010 09:06:49 -0700 Subject: [PATCH 15/37] OMAP3: mem.c: enhance the RAM test --- cpu/arm_cortexa8/omap3/mem.c | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cpu/arm_cortexa8/omap3/mem.c b/cpu/arm_cortexa8/omap3/mem.c index dfb7e4c..b828097 100644 --- a/cpu/arm_cortexa8/omap3/mem.c +++ b/cpu/arm_cortexa8/omap3/mem.c @@ -106,21 +106,23 @@ void make_cs1_contiguous(void) *******************************************************/ u32 mem_ok(u32 cs) { - u32 val1, val2, addr; + u32 i, val1, val2, addr, size; u32 pattern = 0x12345678; - addr = OMAP34XX_SDRC_CS0 + get_sdr_cs_offset(cs); - - writel(0x0, addr + 0x400); /* clear pos A */ - writel(pattern, addr); /* pattern to pos B */ - writel(0x0, addr + 4); /* remove pattern off the bus */ - val1 = readl(addr + 0x400); /* get pos A value */ - val2 = readl(addr); /* get val2 */ + size = get_sdr_cs_offset(cs); + addr = OMAP34XX_SDRC_CS0 + size; + + for (i = 0; i < size; i+=1024) { + writel(pattern - i, addr + i); + } - if ((val1 != 0) || (val2 != pattern)) /* see if pos A val changed */ - return 0; - else - return 1; + for (i = 0; i < size; i+=1024) { + val1 = readl(addr + i); + if (val1 != (pattern - i)) { + return 0; + } + } + return 1; } /******************************************************** -- 1.6.6.1