From 135846d6ecaad255ad28d93ebbb78b3d5da68cdc Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Tue, 29 Apr 2008 13:36:51 +0200 Subject: ppc4xx: Change ECC initialization on lwmon5 to use clean_dcache_range() As it seems the "old" ECC initialization routine by using dflush() didn't write all lines in the dcache back to memory on lwmon5. This could lead to ECC error upon Linux booting. This patch changes the program_ecc() routine to now use clean_dcache_range() instead of dflush(). clean_dcache_range() uses dcbst which is exactly what we want in this case. Since dflush() is known is cause problems, this routine will be removed completely and replaced by clean_dcache_range() with an additional patch. Signed-off-by: Stefan Roese --- board/lwmon5/sdram.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'board') diff --git a/board/lwmon5/sdram.c b/board/lwmon5/sdram.c index 7c3cf49..36b5100 100644 --- a/board/lwmon5/sdram.c +++ b/board/lwmon5/sdram.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -59,7 +60,6 @@ extern int denali_wait_for_dlllock(void); extern void denali_core_search_data_eye(void); extern void dcbz_area(u32 start_address, u32 num_bytes); -extern void dflush(void); static u32 is_ecc_enabled(void) { @@ -106,6 +106,7 @@ static void program_ecc(u32 start_address, { u32 val; u32 current_addr = start_address; + u32 size; int bytes_remaining; sync(); @@ -123,12 +124,18 @@ static void program_ecc(u32 start_address, * watchdog. */ while (bytes_remaining > 0) { - dcbz_area(current_addr, min((64 << 20), bytes_remaining)); + size = min((64 << 20), bytes_remaining); + + /* Write zero's to SDRAM */ + dcbz_area(current_addr, size); + + /* Write modified dcache lines back to memory */ + clean_dcache_range(current_addr, current_addr + size); + current_addr += 64 << 20; bytes_remaining -= 64 << 20; WATCHDOG_RESET(); } - dflush(); sync(); wait_ddr_idle(); -- cgit v1.1 From 85ad184b3b2b0f8af9228477303c55dca1b52ed7 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Tue, 29 Apr 2008 13:57:07 +0200 Subject: ppc4xx: Complete remove bogus dflush() Since the current dflush() implementation is know to have some problems (as seem on lwmon5 ECC init) this patch removes it completely and replaces it by using clean_dcache_range(). Tested on Katmai with ECC DIMM. Signed-off-by: Stefan Roese --- board/netstal/hcu5/sdram.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'board') diff --git a/board/netstal/hcu5/sdram.c b/board/netstal/hcu5/sdram.c index 0b16b505..6b1b53a 100644 --- a/board/netstal/hcu5/sdram.c +++ b/board/netstal/hcu5/sdram.c @@ -34,11 +34,11 @@ #include #include #include +#include #include void hcu_led_set(u32 value); void dcbz_area(u32 start_address, u32 num_bytes); -void dflush(void); #define DDR_DCR_BASE 0x10 #define ddrcfga (DDR_DCR_BASE+0x0) /* DDR configuration address reg */ @@ -185,14 +185,14 @@ static void program_ecc(unsigned long start_address, unsigned long num_bytes) #endif sync(); - eieio(); puts(str); /* ECC bit set method for cached memory */ /* Fast method, no noticeable delay */ dcbz_area(start_address, num_bytes); - dflush(); + /* Write modified dcache lines back to memory */ + clean_dcache_range(start_address, start_address + num_bytes); blank_string(strlen(str)); /* Clear error status */ -- cgit v1.1