summaryrefslogtreecommitdiff
path: root/recipes/u-boot/u-boot-git/beagleboard/0015-OMAP3-mem.c-enhance-the-RAM-test.patch
blob: ce3c3b85e68f7aff4aa736aea9ebe0f4059c30ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From f2e3d22fb1963d08844edee45f7d7d6beba32152 Mon Sep 17 00:00:00 2001
From: Steve Sakoman <steve@sakoman.com>
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