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 <sr@denx.de>
master
Stefan Roese 17 years ago
parent eea5a743a2
commit 135846d6ec
  1. 13
      board/lwmon5/sdram.c

@ -34,6 +34,7 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/cache.h>
#include <ppc440.h> #include <ppc440.h>
#include <watchdog.h> #include <watchdog.h>
@ -59,7 +60,6 @@
extern int denali_wait_for_dlllock(void); extern int denali_wait_for_dlllock(void);
extern void denali_core_search_data_eye(void); extern void denali_core_search_data_eye(void);
extern void dcbz_area(u32 start_address, u32 num_bytes); extern void dcbz_area(u32 start_address, u32 num_bytes);
extern void dflush(void);
static u32 is_ecc_enabled(void) static u32 is_ecc_enabled(void)
{ {
@ -106,6 +106,7 @@ static void program_ecc(u32 start_address,
{ {
u32 val; u32 val;
u32 current_addr = start_address; u32 current_addr = start_address;
u32 size;
int bytes_remaining; int bytes_remaining;
sync(); sync();
@ -123,12 +124,18 @@ static void program_ecc(u32 start_address,
* watchdog. * watchdog.
*/ */
while (bytes_remaining > 0) { 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; current_addr += 64 << 20;
bytes_remaining -= 64 << 20; bytes_remaining -= 64 << 20;
WATCHDOG_RESET(); WATCHDOG_RESET();
} }
dflush();
sync(); sync();
wait_ddr_idle(); wait_ddr_idle();

Loading…
Cancel
Save