Skip to contentSkip to conversation

POST: support for km_arm and mem_regions test definition

PATCH New Valentin Longchamp 3 participants 18 messages Sep 12, 2011 – Oct 5, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 cover POST: support for km_arm and mem_regions test definition

This series adds support for POST on the km_arm boards. These boards use a jumper to run some self-tests at the board power-up. There are some adaptations for POST to run on the ARM architecture.

This series defines a new mem_regions POST test. This test also takes place before relocation, but it only tests some regions of the RAM so that it is quicker.

Changes for v2:
- added CONFIG_POST_EXTERNAL_WORD_FUNCS to allow to redefine post_word_load/store in the board support file when the proposed functions are not suitable.

Changes for v3:
- moved CONFIG_POST_EXTERNAL_WORD_FUNCS to an individual patch
- moved memory test configuration for km_arm from post to board code

Changes for v4:
- rebased on 2011.09-rc1
- changed a comment in km_arm.h
- moved post_word location by 4 bytes because of conflict with bootcounter

Valentin Longchamp (8):
POST/arm: adaptations needed for POST on ARM to work
POST: allow redefinition of post_word_load/store
POST: add post_log_res field for post results in global data
POST: make env test flags fetching optional
POST: drivers/memory.c coding style cleanup
POST: add new memory regions test
km_arm: change CONFIG_SYS_TEXT_BASE to end of RAM
km_arm: enable POST for these boards

 arch/arm/include/asm/global_data.h      |    5 +
 arch/arm/lib/board.c                    |    2 +
 arch/blackfin/include/asm/global_data.h |    1 +
 arch/nios2/include/asm/global_data.h    |    1 +
 arch/powerpc/include/asm/global_data.h  |    1 +
 arch/sparc/include/asm/global_data.h    |    1 +
 board/keymile/km_arm/km_arm.c           |   33 ++++++
 include/configs/km/km_arm.h             |    8 ++-
 include/post.h                          |    9 ++
 post/drivers/memory.c                   |  171 +++++++++++++++++++------------
 post/post.c                             |   29 ++++--
 post/tests.c                            |   13 +++
 12 files changed, 199 insertions(+), 75 deletions(-)
#1 lore raw

PATCH v4 1/8 POST/arm: adaptations needed for POST on ARM to work

For post to run on ARM, 3 things are needed:
- post_log_word to be defined in gd
- a post.h include in arch/arm/lib/board.c

---
Changes for v2:
- introduced CONFIG_POST_EXTERNAL_WORD_FUNCS
Changes for v3:
- removed CONFIG_POST_EXTERNAL_WORD_FUNCS. This is now in a separate patch

---
 arch/arm/include/asm/global_data.h |    4 ++++
 arch/arm/lib/board.c               |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/include/asm/global_data.h +4 -0
index 4fc51fd..b2c336a 100644
@@ -75,6 +75,10 @@ typedef	struct	global_data {
 #endif
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
+	unsigned long	post_log_word; /* Record POST activities */
+	unsigned long	post_init_f_time; /* When post_init_f started */
+#endif
 } gd_t;
 
 /*
arch/arm/lib/board.c +2 -0
index a7fb251..44ff2f8 100644
@@ -48,6 +48,8 @@
 #include <nand.h>
 #include <onenand_uboot.h>
 #include <mmc.h>
+#include <post.h>
+#include <logbuff.h>
 
 #ifdef CONFIG_BITBANGMII
 #include <miiphy.h>
Signature · 1 line
1.7.1
#2 lore raw

PATCH v4 1/8 POST/arm: adaptations needed for POST on ARM to work

Dear Valentin Longchamp,

Quoted 13 lines · In message <[email protected]>…

For post to run on ARM, 3 things are needed:
- post_log_word to be defined in gd
- a post.h include in arch/arm/lib/board.c

---
Changes for v2:
- introduced CONFIG_POST_EXTERNAL_WORD_FUNCS
Changes for v3:
- removed CONFIG_POST_EXTERNAL_WORD_FUNCS. This is now in a separate patch

Quoted 4 lines
---
 arch/arm/include/asm/global_data.h |    4 ++++
 arch/arm/lib/board.c               |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Murder is contrary to the laws of man and God.
	-- M-5 Computer, "The Ultimate Computer", stardate 4731.3
#3 lore raw

PATCH v4 2/8 POST: allow redefinition of post_word_load/store

In reply to Valentin Longchamp

The predefinde post_word_load/store functions do not fit all boards, so we introduce a way to define post_word_load/store as externs in post.h that then can be defined in board specific files. This is done with the CONFIG_POST_EXTERNAL_WORD_FUNCS #define

---
 include/post.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/post.h +8 -0
index 3d23d22..e783b94 100644
@@ -33,6 +33,7 @@
 
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 
+#ifndef CONFIG_POST_EXTERNAL_WORD_FUNCS
 #ifdef CONFIG_SYS_POST_WORD_ADDR
 #define _POST_WORD_ADDR	CONFIG_SYS_POST_WORD_ADDR
 #else
@@ -85,6 +86,13 @@ static inline void post_word_store (ulong value)
 {
 	out_le32((volatile void *)(_POST_WORD_ADDR), value);
 }
+
+#else
+
+extern ulong post_word_load(void);
+extern void post_word_store(ulong value);
+
+#endif /* CONFIG_POST_EXTERNAL_WORD_FUNCS */
 #endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */
 #endif /* __ASSEMBLY__ */
 
Signature · 1 line
1.7.1
#4 lore raw

PATCH v4 2/8 POST: allow redefinition of post_word_load/store

Dear Valentin Longchamp,

Quoted 10 lines · In message <[email protected]>…

The predefinde post_word_load/store functions do not fit all boards, so we introduce a way to define post_word_load/store as externs in post.h that then can be defined in board specific files. This is done with the CONFIG_POST_EXTERNAL_WORD_FUNCS #define

---
 include/post.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PROGRAM - n.  A magic spell cast over a computer  allowing it to turn
one's input into error messages.
v. tr. - To engage in a pastime similar to banging one's head against
a wall, but with fewer opportunities for reward.
#5 lore raw

PATCH v4 3/8 POST: add post_log_res field for post results in global data

In reply to Valentin Longchamp

The current post_log_word in global data is currently split into 2x 16 bits: half for the test start, half for the test success. Since we alredy have more than 16 POST tests defined and more could be defined, this may result in an overflow and the post_output_backlog would not work for the tests defined further of these 16 positions.

An additional field is added to global data so that we can now support up to 32 (depending of architecture) tests. The post_log_word is only used to record the start of the test and the new field post_log_res for the test success (or failure). The post_output_backlog is for this change also adapted.

---
 arch/arm/include/asm/global_data.h      |    1 +
 arch/blackfin/include/asm/global_data.h |    1 +
 arch/nios2/include/asm/global_data.h    |    1 +
 arch/powerpc/include/asm/global_data.h  |    1 +
 arch/sparc/include/asm/global_data.h    |    1 +
 post/post.c                             |    9 +++++----
 6 files changed, 10 insertions(+), 4 deletions(-)
arch/arm/include/asm/global_data.h +1 -0
index b2c336a..14b9255 100644
@@ -77,6 +77,7 @@ typedef	struct	global_data {
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 	unsigned long	post_log_word; /* Record POST activities */
+	unsigned long	post_log_res; /* success of POST test */
 	unsigned long	post_init_f_time; /* When post_init_f started */
 #endif
 } gd_t;
arch/blackfin/include/asm/global_data.h +1 -0
index eba5e93..62cd631 100644
@@ -50,6 +50,7 @@ typedef struct global_data {
 	unsigned long env_valid;	/* Checksum of Environment valid? */
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 	unsigned long post_log_word;	/* Record POST activities */
+	unsigned long post_log_res; 	/* success of POST test */
 	unsigned long post_init_f_time;	/* When post_init_f started */
 #endif
 
arch/nios2/include/asm/global_data.h +1 -0
index 2c4a719..1f0bbe8 100644
@@ -34,6 +34,7 @@ typedef	struct	global_data {
 	unsigned long	env_valid;	/* Checksum of Environment valid */
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 	unsigned long	post_log_word;	/* Record POST activities */
+	unsigned long	post_log_res; /* success of POST test */
 	unsigned long	post_init_f_time; /* When post_init_f started */
 #endif
 	void		**jt;		/* Standalone app jump table */
arch/powerpc/include/asm/global_data.h +1 -0
index a33ca2f..fbfe8c0 100644
@@ -160,6 +160,7 @@ typedef	struct	global_data {
 #endif
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 	unsigned long	post_log_word;  /* Record POST activities */
+	unsigned long	post_log_res; /* success of POST test */
 	unsigned long	post_init_f_time;  /* When post_init_f started */
 #endif
 #ifdef CONFIG_BOARD_TYPES
arch/sparc/include/asm/global_data.h +1 -0
index 9b14674..4b62250 100644
@@ -58,6 +58,7 @@ typedef struct global_data {
 #endif
 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
 	unsigned long post_log_word;	/* Record POST activities */
+	unsigned long post_log_res;	/* success of POST test */
 	unsigned long post_init_f_time;	/* When post_init_f started */
 #endif
 #ifdef CONFIG_BOARD_TYPES
post/post.c +5 -4
index 852d6a5..61acf8d 100644
@@ -121,6 +121,7 @@ void post_bootmode_init (void)
 
 	/* Reset activity record */
 	gd->post_log_word = 0;
+	gd->post_log_res = 0;
 }
 
 int post_bootmode_get (unsigned int *last_test)
@@ -144,12 +145,12 @@ int post_bootmode_get (unsigned int *last_test)
 /* POST tests run before relocation only mark status bits .... */
 static void post_log_mark_start ( unsigned long testid )
 {
-	gd->post_log_word |= (testid)<<16;
+	gd->post_log_word |= testid;
 }
 
 static void post_log_mark_succ ( unsigned long testid )
 {
-	gd->post_log_word |= testid;
+	gd->post_log_res |= testid;
 }
 
 /* ... and the messages are output once we are relocated */
@@ -158,9 +159,9 @@ void post_output_backlog ( void )
 	int j;
 
 	for (j = 0; j < post_list_size; j++) {
-		if (gd->post_log_word & (post_list[j].testid<<16)) {
+		if (gd->post_log_word & (post_list[j].testid)) {
 			post_log ("POST %s ", post_list[j].cmd);
-			if (gd->post_log_word & post_list[j].testid)
+			if (gd->post_log_res & post_list[j].testid)
 				post_log ("PASSED\n");
 			else {
 				post_log ("FAILED\n");
Signature · 1 line
1.7.1
#6 lore raw

PATCH v4 3/8 POST: add post_log_res field for post results in global data

Dear Valentin Longchamp,

Quoted 15 lines · In message <[email protected]>…

The current post_log_word in global data is currently split into 2x 16 bits: half for the test start, half for the test success. Since we alredy have more than 16 POST tests defined and more could be defined, this may result in an overflow and the post_output_backlog would not work for the tests defined further of these 16 positions.

An additional field is added to global data so that we can now support up to 32 (depending of architecture) tests. The post_log_word is only used to record the start of the test and the new field post_log_res for the test success (or failure). The post_output_backlog is for this change also adapted.

Quoted 8 lines
---
 arch/arm/include/asm/global_data.h      |    1 +
 arch/blackfin/include/asm/global_data.h |    1 +
 arch/nios2/include/asm/global_data.h    |    1 +
 arch/powerpc/include/asm/global_data.h  |    1 +
 arch/sparc/include/asm/global_data.h    |    1 +
 post/post.c                             |    9 +++++----
 6 files changed, 10 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Remember that Beethoven wrote his first symphony in C ...
#7 lore raw

PATCH v4 4/8 POST: make env test flags fetching optional

In reply to Valentin Longchamp

Some boards have the environment variables defined in a slow EEPROM. post_run accesses these environment variables to define which tests have to be run (in post_get_flags). This is very slow before the code relocation on some boards with a slow I2C EEPROM for environement variables.

This patch adds a config option to skip the fetching of the test flags in the environment variables. The test flags assigned to the tests then only are the ones statically defined for the test in post/tests.c.

---
 post/post.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
post/post.c +15 -5
index 61acf8d..1ee0a29 100644
@@ -191,7 +191,8 @@ static void post_bootmode_test_off (void)
 	post_word_store (word);
 }
 
-static void post_get_flags (int *test_flags)
+#ifndef CONFIG_POST_SKIP_ENV_FLAGS
+static void post_get_env_flags(int *test_flags)
 {
 	int  flag[] = {  POST_POWERON,   POST_NORMAL,   POST_SLOWTEST,
 			 POST_CRITICAL };
@@ -204,10 +205,6 @@ static void post_get_flags (int *test_flags)
 	int last;
 	int i, j;
 
-	for (j = 0; j < post_list_size; j++) {
-		test_flags[j] = post_list[j].flags;
-	}
-
 	for (i = 0; i < varnum; i++) {
 		if (getenv_f(var[i], list, sizeof (list)) <= 0)
 			continue;
@@ -245,6 +242,19 @@ static void post_get_flags (int *test_flags)
 			name = s + 1;
 		}
 	}
+}
+#endif
+
+static void post_get_flags(int *test_flags)
+{
+	int j;
+
+	for (j = 0; j < post_list_size; j++)
+		test_flags[j] = post_list[j].flags;
+
+#ifndef CONFIG_POST_SKIP_ENV_FLAGS
+	post_get_env_flags(test_flags);
+#endif
 
 	for (j = 0; j < post_list_size; j++) {
 		if (test_flags[j] & POST_POWERON) {
Signature · 1 line
1.7.1
#8 lore raw

PATCH v4 4/8 POST: make env test flags fetching optional

Dear Valentin Longchamp,

Quoted 9 lines · In message <[email protected]>…

Some boards have the environment variables defined in a slow EEPROM. post_run accesses these environment variables to define which tests have to be run (in post_get_flags). This is very slow before the code relocation on some boards with a slow I2C EEPROM for environement variables.

This patch adds a config option to skip the fetching of the test flags in the environment variables. The test flags assigned to the tests then only are the ones statically defined for the test in post/tests.c.

Quoted 6 lines
---
 post/post.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Never call a man a fool.  Borrow from him.
#9 lore raw

PATCH v4 5/8 POST: drivers/memory.c coding style cleanup

In reply to Valentin Longchamp

This is needed for a further patch adding a new memory test.

---
Changes for v4:
- rebased on 2011.09-rc1

---
 post/drivers/memory.c |  113 +++++++++++++++++++++++++------------------------
 1 files changed, 57 insertions(+), 56 deletions(-)
post/drivers/memory.c +57 -56
index c2b711e..69c5dbe 100644
@@ -250,7 +250,7 @@ static int memory_post_dataline(unsigned long long * pmem)
 			hi = (temp64>>32) & 0xffffffff;
 			lo = temp64 & 0xffffffff;
 
-			post_log ("Memory (date line) error at %08x, "
+			post_log("Memory (date line) error at %08x, "
 				  "wrote %08x%08x, read %08x%08x !\n",
 					  pmem, pathi, patlo, hi, lo);
 			ret = -1;
@@ -281,7 +281,7 @@ static int memory_post_addrline(ulong *testaddr, ulong *base, ulong size)
 			}
 #endif
 			if(readback == *testaddr) {
-				post_log ("Memory (address line) error at %08x<->%08x, "
+				post_log("Memory (address line) error at %08x<->%08x, "
 					"XOR value %08x !\n",
 					testaddr, target, xor);
 				ret = -1;
@@ -291,7 +291,7 @@ static int memory_post_addrline(ulong *testaddr, ulong *base, ulong size)
 	return ret;
 }
 
-static int memory_post_test1 (unsigned long start,
+static int memory_post_test1(unsigned long start,
 			      unsigned long size,
 			      unsigned long val)
 {
@@ -303,13 +303,13 @@ static int memory_post_test1 (unsigned long start,
 	for (i = 0; i < size / sizeof (ulong); i++) {
 		mem[i] = val;
 		if (i % 1024 == 0)
-			WATCHDOG_RESET ();
+			WATCHDOG_RESET();
 	}
 
-	for (i = 0; i < size / sizeof (ulong) && ret == 0; i++) {
+	for (i = 0; i < size / sizeof (ulong) && !ret; i++) {
 		readback = mem[i];
 		if (readback != val) {
-			post_log ("Memory error at %08x, "
+			post_log("Memory error at %08x, "
 				  "wrote %08x, read %08x !\n",
 					  mem + i, val, readback);
 
@@ -317,13 +317,13 @@ static int memory_post_test1 (unsigned long start,
 			break;
 		}
 		if (i % 1024 == 0)
-			WATCHDOG_RESET ();
+			WATCHDOG_RESET();
 	}
 
 	return ret;
 }
 
-static int memory_post_test2 (unsigned long start, unsigned long size)
+static int memory_post_test2(unsigned long start, unsigned long size)
 {
 	unsigned long i;
 	ulong *mem = (ulong *) start;
@@ -333,13 +333,13 @@ static int memory_post_test2 (unsigned long start, unsigned long size)
 	for (i = 0; i < size / sizeof (ulong); i++) {
 		mem[i] = 1 << (i % 32);
 		if (i % 1024 == 0)
-			WATCHDOG_RESET ();
+			WATCHDOG_RESET();
 	}
 
-	for (i = 0; i < size / sizeof (ulong) && ret == 0; i++) {
+	for (i = 0; i < size / sizeof (ulong) && !ret; i++) {
 		readback = mem[i];
 		if (readback != (1 << (i % 32))) {
-			post_log ("Memory error at %08x, "
+			post_log("Memory error at %08x, "
 				  "wrote %08x, read %08x !\n",
 					  mem + i, 1 << (i % 32), readback);
 
@@ -347,13 +347,13 @@ static int memory_post_test2 (unsigned long start, unsigned long size)
 			break;
 		}
 		if (i % 1024 == 0)
-			WATCHDOG_RESET ();
+			WATCHDOG_RESET();
 	}
 
 	return ret;
 }
 
-static int memory_post_test3 (unsigned long start, unsigned long size)
+static int memory_post_test3(unsigned long start, unsigned long size)
 {
 	unsigned long i;
 	ulong *mem = (ulong *) start;
@@ -363,13 +363,13 @@ static int memory_post_test3 (unsigned long start, unsigned long size)
 	for (i = 0; i < size / sizeof (ulong); i++) {
 		mem[i] = i;
 		if (i % 1024 == 0)
-			WATCHDOG_RESET ();
+			WATCHDOG_RESET();
 	}
 
-	for (i = 0; i < size / sizeof (ulong) && ret == 0; i++) {
+	for (i = 0; i < size / sizeof (ulong) && !ret; i++) {
 		readback = mem[i];
 		if (readback != i) {
-			post_log ("Memory error at %08x, "
+			post_log("Memory error at %08x, "
 				  "wrote %08x, read %08x !\n",
 					  mem + i, i, readback);
 
@@ -377,13 +377,13 @@ static int memory_post_test3 (unsigned long start, unsigned long size)
 			break;
 		}
 		if (i % 1024 == 0)
-			WATCHDOG_RESET ();
+			WATCHDOG_RESET();
 	}
 
 	return ret;
 }
 
-static int memory_post_test4 (unsigned long start, unsigned long size)
+static int memory_post_test4(unsigned long start, unsigned long size)
 {
 	unsigned long i;
 	ulong *mem = (ulong *) start;
@@ -393,13 +393,13 @@ static int memory_post_test4 (unsigned long start, unsigned long size)
 	for (i = 0; i < size / sizeof (ulong); i++) {
 		mem[i] = ~i;
 		if (i % 1024 == 0)
-			WATCHDOG_RESET ();
+			WATCHDOG_RESET();
 	}
 
-	for (i = 0; i < size / sizeof (ulong) && ret == 0; i++) {
+	for (i = 0; i < size / sizeof (ulong) && !ret; i++) {
 		readback = mem[i];
 		if (readback != ~i) {
-			post_log ("Memory error at %08x, "
+			post_log("Memory error@%08x, "
 				  "wrote %08x, read %08x !\n",
 					  mem + i, ~i, readback);
 
@@ -407,47 +407,48 @@ static int memory_post_test4 (unsigned long start, unsigned long size)
 			break;
 		}
 		if (i % 1024 == 0)
-			WATCHDOG_RESET ();
+			WATCHDOG_RESET();
 	}
 
 	return ret;
 }
 
-static int memory_post_tests (unsigned long start, unsigned long size)
+static int memory_post_tests(unsigned long start, unsigned long size)
 {
 	int ret = 0;
 
-	if (ret == 0)
-		ret = memory_post_dataline ((unsigned long long *)start);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_addrline ((ulong *)start, (ulong *)start, size);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_addrline ((ulong *)(start + size - 8),
+	if (!ret)
+		ret = memory_post_dataline((unsigned long long *)start);
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_addrline((ulong *)start, (ulong *)start,
+						size);
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_addrline((ulong *)(start + size - 8),
 					    (ulong *)start, size);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_test1 (start, size, 0x00000000);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_test1 (start, size, 0xffffffff);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_test1 (start, size, 0x55555555);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_test1 (start, size, 0xaaaaaaaa);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_test2 (start, size);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_test3 (start, size);
-	WATCHDOG_RESET ();
-	if (ret == 0)
-		ret = memory_post_test4 (start, size);
-	WATCHDOG_RESET ();
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_test1(start, size, 0x00000000);
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_test1(start, size, 0xffffffff);
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_test1(start, size, 0x55555555);
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_test1(start, size, 0xaaaaaaaa);
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_test2(start, size);
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_test3(start, size);
+	WATCHDOG_RESET();
+	if (!ret)
+		ret = memory_post_test4(start, size);
+	WATCHDOG_RESET();
 
 	return ret;
 }
@@ -502,11 +503,11 @@ int memory_post_test(int flags)
 			ret = memory_post_tests(vstart, memsize);
 		} else {			/* POST_NORMAL */
 			unsigned long i;
-			for (i = 0; i < (memsize >> 20) && ret == 0; i++) {
-				if (ret == 0)
+			for (i = 0; i < (memsize >> 20) && !ret; i++) {
+				if (!ret)
 					ret = memory_post_tests(vstart +
 						(i << 20), 0x800);
-				if (ret == 0)
+				if (!ret)
 					ret = memory_post_tests(vstart +
 						(i << 20) + 0xff800, 0x800);
 			}
Signature · 1 line
1.7.1
#10 lore raw

PATCH v4 5/8 POST: drivers/memory.c coding style cleanup

Dear Valentin Longchamp,

Quoted 10 lines · In message <[email protected]>…

This is needed for a further patch adding a new memory test.

---
Changes for v4:
- rebased on 2011.09-rc1

---
 post/drivers/memory.c |  113 +++++++++++++++++++++++++------------------------
 1 files changed, 57 insertions(+), 56 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Digital computers are themselves more complex than most things people
build: They have very large numbers of states. This makes conceiving,
describing, and testing them hard. Software systems  have  orders-of-
magnitude more states than computers do.           - Fred Brooks, Jr.
#11 lore raw

PATCH v4 6/8 POST: add new memory regions test

In reply to Valentin Longchamp

This test is similar to the actual POST memory test but quicker and far less complete. It checks the address and data lines and then only tests some regularly placed sub regions of the RAM.
This can be useful when we want to test the RAM but we do not have enough time to run the full memory test.

The POST memory test code was rearranged in order to avoid code duplication between the two tests but the memory test functionnality remains the same.

---
Changes for v3:
- cosmetic changes in the test list
Changes for v4:
- rebased on 2011.09-rc1

---
 include/post.h        |    1 +
 post/drivers/memory.c |   78 +++++++++++++++++++++++++++++++++++++------------
 post/tests.c          |   13 ++++++++
 3 files changed, 73 insertions(+), 19 deletions(-)
include/post.h +1 -0
index e783b94..ac93f43 100644
@@ -196,6 +196,7 @@ extern int memory_post_test(int flags);
 #define CONFIG_SYS_POST_CODEC		0x00200000
 #define CONFIG_SYS_POST_COPROC		0x00400000
 #define CONFIG_SYS_POST_FLASH		0x00800000
+#define CONFIG_SYS_POST_MEM_REGIONS	0x01000000
 
 #endif /* CONFIG_POST */
 
post/drivers/memory.c +59 -19

120 lines not on this page · raw message

post/tests.c +13 -0
index bfb9cb5..c25460b 100644
@@ -55,6 +55,7 @@ extern int fpga_post_test (int flags);
 extern int lwmon5_watchdog_post_test(int flags);
 extern int sysmon1_post_test(int flags);
 extern int coprocessor_post_test(int flags);
+extern int memory_regions_post_test(int flags);
 
 extern int sysmon_init_f (void);
 
@@ -316,6 +317,18 @@ struct post_test post_list[] =
 	CONFIG_SYS_POST_FLASH
     },
 #endif
+#if CONFIG_POST & CONFIG_SYS_POST_MEM_REGIONS
+    {
+	"Memory regions test",
+	"mem_regions",
+	"This test checks regularly placed regions of the RAM.",
+	POST_ROM | POST_SLOWTEST | POST_PREREL,
+	&memory_regions_post_test,
+	NULL,
+	NULL,
+	CONFIG_SYS_POST_MEM_REGIONS
+    },
+#endif
 };
 
 unsigned int post_list_size = ARRAY_SIZE(post_list);
Signature · 1 line
1.7.1
#12 lore raw

PATCH v4 6/8 POST: add new memory regions test

Dear Valentin Longchamp,

Quoted 17 lines · In message <[email protected]>…

This test is similar to the actual POST memory test but quicker and far less complete. It checks the address and data lines and then only tests some regularly placed sub regions of the RAM.
This can be useful when we want to test the RAM but we do not have enough time to run the full memory test.

The POST memory test code was rearranged in order to avoid code duplication between the two tests but the memory test functionnality remains the same.

---
Changes for v3:
- cosmetic changes in the test list
Changes for v4:
- rebased on 2011.09-rc1

Quoted 5 lines
---
 include/post.h        |    1 +
 post/drivers/memory.c |   78 +++++++++++++++++++++++++++++++++++++------------
 post/tests.c          |   13 ++++++++
 3 files changed, 73 insertions(+), 19 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Immortality consists largely of boredom.
	-- Zefrem Cochrane, "Metamorphosis", stardate 3219.8
#13 lore raw

PATCH v4 7/8 km_arm: change CONFIG_SYS_TEXT_BASE to end of RAM

In reply to Valentin Longchamp

This allows to test a larger part of the RAM in the memory tests.

---
Changes for v4:
- fixed wrong comment

---
 include/configs/km/km_arm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/configs/km/km_arm.h +1 -1
index f185019..a3725c0 100644
@@ -54,7 +54,7 @@
 
 #include "asm/arch/config.h"
 
-#define CONFIG_SYS_TEXT_BASE	0x04000000	/* code address after reloc */
+#define CONFIG_SYS_TEXT_BASE	0x07d00000	/* code address before reloc */
 #define CONFIG_SYS_MEMTEST_START 0x00400000	/* 4M */
 #define CONFIG_SYS_MEMTEST_END	0x007fffff	/*(_8M -1) */
 #define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
Signature · 1 line
1.7.1
#14 lore raw

PATCH v4 7/8 km_arm: change CONFIG_SYS_TEXT_BASE to end of RAM

Dear Valentin Longchamp,

Quoted 6 lines · In message <[email protected]>…

This allows to test a larger part of the RAM in the memory tests.

Quoted 6 lines

---
Changes for v4:
- fixed wrong comment

---
 include/configs/km/km_arm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
What is wanted is not the will to believe,  but the will to find out,
which is the exact opposite.
		        -- Bertrand Russell, "Skeptical Essays", 1928
#15 lore raw

PATCH v4 8/8 km_arm: enable POST for these boards

In reply to Valentin Longchamp

The current km_arm boards have a Power-On test jumper. When this jumper is set, this triggers some Power-On tests on the board.

This patch enables the support of this jumper for starting the memory_regions test when the jumper is set.

---
Changes for v2:
- adapted to CONFIG_POST_EXTERNAL_WORD_FUNCS
- implemented suggestion from Sergei
Changes for v3:
- moved arch_memory_test_prepare from post/board/km_arm to board/keymile/km_arm/km_arm.c
Changes for v4:
- moved post_word adress because of conflict with bootcounter

---
 board/keymile/km_arm/km_arm.c |   33 +++++++++++++++++++++++++++++++++
 include/configs/km/km_arm.h   |    6 ++++++
 2 files changed, 39 insertions(+), 0 deletions(-)
board/keymile/km_arm/km_arm.c +33 -0
index 8670567..b057182 100644
@@ -488,6 +488,39 @@ int get_scl(void)
 }
 #endif
 
+#if defined(CONFIG_POST)
+
+#define KM_POST_EN_L	44
+#define POST_WORD_OFF	8
+
+int post_hotkeys_pressed(void)
+{
+	return !kw_gpio_get_value(KM_POST_EN_L);
+}
+
+ulong post_word_load(void)
+{
+	volatile void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
+	return in_le32(addr);
+
+}
+void post_word_store(ulong value)
+{
+	volatile void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
+	out_le32(addr, value);
+}
+
+int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
+{
+	*vstart = CONFIG_SYS_SDRAM_BASE;
+
+	/* we go up to relocation plus a 1 MB margin */
+	*size = CONFIG_SYS_TEXT_BASE - (1<<20);
+
+	return 0;
+}
+#endif
+
 #if defined(CONFIG_SYS_EEPROM_WREN)
 int eeprom_write_enable(unsigned dev_addr, int state)
 {
include/configs/km/km_arm.h +6 -0
index a3725c0..0271e7e 100644
@@ -272,4 +272,10 @@ int get_scl(void);
 /* address for the bootcount (taken from end of RAM) */
 #define BOOTCOUNT_ADDR          (CONFIG_KM_RESERVED_PRAM)
 
+/* enable POST tests */
+#define CONFIG_POST	(CONFIG_SYS_POST_MEM_REGIONS)
+#define CONFIG_POST_SKIP_ENV_FLAGS
+#define CONFIG_POST_EXTERNAL_WORD_FUNCS
+#define CONFIG_CMD_DIAG
+
 #endif /* _CONFIG_KM_ARM_H */
Signature · 1 line
1.7.1
#16 lore raw

PATCH v4 8/8 km_arm: enable POST for these boards

Dear Valentin Longchamp,

Quoted 18 lines · In message <[email protected]>…

The current km_arm boards have a Power-On test jumper. When this jumper is set, this triggers some Power-On tests on the board.

This patch enables the support of this jumper for starting the memory_regions test when the jumper is set.

---
Changes for v2:
- adapted to CONFIG_POST_EXTERNAL_WORD_FUNCS
- implemented suggestion from Sergei
Changes for v3:
- moved arch_memory_test_prepare from post/board/km_arm to board/keymile/km_arm/km_arm.c
Changes for v4:
- moved post_word adress because of conflict with bootcounter

Quoted 4 lines
---
 board/keymile/km_arm/km_arm.c |   33 +++++++++++++++++++++++++++++++++
 include/configs/km/km_arm.h   |    6 ++++++
 2 files changed, 39 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Only two things are infinite,  the universe and human stupidity,  and
I'm not sure about the former.                     -- Albert Einstein
#17 lore raw

v4 cover POST: support for km_arm and mem_regions test definition

In reply to Valentin Longchamp
Quoted 7 lines · On Monday, September 12, 2011 10:18:34 Valentin Longchamp wrote:

This series adds support for POST on the km_arm boards. These boards use a jumper to run some self-tests at the board power-up. There are some adaptations for POST to run on the ARM architecture.

This series defines a new mem_regions POST test. This test also takes place before relocation, but it only tests some regions of the RAM so that it is quicker.

i dont see any issues now, so it's up to wolfgang to cherry pick during the next merge window
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110913/87affe17/attachment.pgp