diff options
author | wdenk <wdenk> | 2004-01-06 22:38:14 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2004-01-06 22:38:14 +0000 |
commit | c83bf6a2d00ef846c1fb2b0c60540f03ef203125 (patch) | |
tree | e410334c86d491dbbec765a5765eef9cccd3135a /board/iphase4539 | |
parent | b299e41a0d34bf96202d9bbb72739bdd9414b0cc (diff) |
Add a common get_ram_size() function and modify the the
board-specific files to invoke that common implementation.
Diffstat (limited to 'board/iphase4539')
-rw-r--r-- | board/iphase4539/iphase4539.c | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/board/iphase4539/iphase4539.c b/board/iphase4539/iphase4539.c index 45f3dad36ad..e50250e4567 100644 --- a/board/iphase4539/iphase4539.c +++ b/board/iphase4539/iphase4539.c @@ -198,9 +198,8 @@ long int initdram (int board_type) volatile immap_t *immap = (immap_t *) CFG_IMMR; volatile memctl8260_t *memctl = &immap->im_memctl; volatile uchar *base; - volatile ulong *addr, cnt, val; - ulong save[32]; /* to make test non-destructive */ - int i, maxsize; + ulong maxsize; + int i; memctl->memc_psrt = CFG_PSRT; memctl->memc_mptpr = CFG_MPTPR; @@ -237,43 +236,10 @@ long int initdram (int board_type) */ maxsize = (1 + (~memctl->memc_or1 | 0x7fff)) / 2; - /* - * Check memory range for valid RAM. A simple memory test determines - * the actually available RAM size between addresses `base' and - * `base + maxsize'. Some (not all) hardware errors are detected: - * - short between address lines - * - short between data lines - */ - i = 0; - for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) { - addr = (volatile ulong *) base + cnt; /* pointer arith! */ - save[i++] = *addr; - *addr = ~cnt; - } + maxsize = get_ram_size((long *)base, maxsize); - addr = (volatile ulong *) base; - save[i] = *addr; - *addr = 0; - - if ((val = *addr) != 0) { - *addr = save[i]; - return (0); - } - - for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) { - addr = (volatile ulong *) base + cnt; /* pointer arith! */ - val = *addr; - *addr = save[--i]; - if (val != ~cnt) { - /* Write the actual size to ORx - */ - memctl->memc_or1 |= ~(cnt * sizeof (long) - 1); - maxsize = cnt * sizeof (long) / 2; - break; - } - } + memctl->memc_or1 |= ~(maxsize - 1); - maxsize *= 2; if (maxsize != hwc_main_sdram_size ()) printf ("Oops: memory test has not found all memory!\n"); #endif |