summaryrefslogtreecommitdiff
path: root/board/fads
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-01-06 22:38:14 +0000
committerwdenk <wdenk>2004-01-06 22:38:14 +0000
commitc83bf6a2d00ef846c1fb2b0c60540f03ef203125 (patch)
treee410334c86d491dbbec765a5765eef9cccd3135a /board/fads
parentb299e41a0d34bf96202d9bbb72739bdd9414b0cc (diff)
downloadu-boot-imx-c83bf6a2d00ef846c1fb2b0c60540f03ef203125.zip
u-boot-imx-c83bf6a2d00ef846c1fb2b0c60540f03ef203125.tar.gz
u-boot-imx-c83bf6a2d00ef846c1fb2b0c60540f03ef203125.tar.bz2
Add a common get_ram_size() function and modify the the
board-specific files to invoke that common implementation.
Diffstat (limited to 'board/fads')
-rw-r--r--board/fads/fads.c43
1 files changed, 2 insertions, 41 deletions
diff --git a/board/fads/fads.c b/board/fads/fads.c
index 3083740..1507146 100644
--- a/board/fads/fads.c
+++ b/board/fads/fads.c
@@ -187,45 +187,6 @@ static const uint edo_70ns[] =
#endif
/* ------------------------------------------------------------------------- */
-static long int dram_size (long int *base, long int maxsize)
-{
- volatile long int *addr=base;
- ulong cnt, val;
- ulong save[32]; /* to make test non-destructive */
- unsigned char i = 0;
-
- for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
- addr = base + cnt; /* pointer arith! */
-
- save[i++] = *addr;
- *addr = ~cnt;
- }
-
- /* write 0 to base address */
- addr = base;
- save[i] = *addr;
- *addr = 0;
-
- /* check at base address */
- if ((val = *addr) != 0) {
- *addr = save[i];
- return (0);
- }
-
- for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
- addr = base + cnt; /* pointer arith! */
-
- val = *addr;
- *addr = save[--i];
-
- if (val != (~cnt)) {
- return (cnt * sizeof (long));
- }
- }
- return (maxsize);
-}
-
-/* ------------------------------------------------------------------------- */
static int _draminit (uint base, uint noMbytes, uint edo, uint delay)
{
volatile immap_t *immap = (immap_t *) CFG_IMMR;
@@ -306,10 +267,10 @@ static int _draminit (uint base, uint noMbytes, uint edo, uint delay)
/* if no dimm is inserted, noMbytes is still detected as 8m, so
* sanity check top and bottom of memory */
- /* check bytes / 2 because dram_size tests at base+bytes, which
+ /* check bytes / 2 because get_ram_size tests at base+bytes, which
* is not mapped */
if (noMbytes == 8)
- if (dram_size ((long *) base, noMbytes << 19) != noMbytes << 19) {
+ if (get_ram_size ((long *) base, noMbytes << 19) != noMbytes << 19) {
*((uint *) BCSR1) |= BCSR1_DRAM_EN; /* disable dram */
return -1;
}