summaryrefslogtreecommitdiff
path: root/board/tqm8260/tqm8260.c
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/tqm8260/tqm8260.c
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/tqm8260/tqm8260.c')
-rw-r--r--board/tqm8260/tqm8260.c53
1 files changed, 4 insertions, 49 deletions
diff --git a/board/tqm8260/tqm8260.c b/board/tqm8260/tqm8260.c
index f716cf2..2291987 100644
--- a/board/tqm8260/tqm8260.c
+++ b/board/tqm8260/tqm8260.c
@@ -224,13 +224,10 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
ulong orx, volatile uchar * base)
{
volatile uchar c = 0xff;
- ulong cnt, val;
- volatile ulong *addr;
volatile uint *sdmr_ptr;
volatile uint *orx_ptr;
- int i;
- ulong save[32]; /* to make test non-destructive */
ulong maxsize, size;
+ int i;
/* We must be able to test a location outsize the maximum legal size
* to find out THAT we are outside; but this address still has to be
@@ -280,52 +277,10 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
*sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
*base = c;
- /*
- * 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;
- }
+ size = get_ram_size((long *)base, maxsize);
+ *orx_ptr = orx | ~(size - 1);
- addr = (volatile ulong *) base;
- save[i] = *addr;
- *addr = 0;
-
- if ((val = *addr) != 0) {
- /* Restore the original data before leaving the function. */
- *addr = save[i];
- for (cnt = 1; cnt <= maxsize / sizeof(long); cnt <<= 1) {
- addr = (volatile ulong *) base + cnt;
- *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) {
- size = cnt * sizeof (long);
- /* Restore the original data before leaving the function. */
- for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
- addr = (volatile ulong *) base + cnt;
- *addr = save[--i];
- }
- /* Write the actual size to ORx
- */
- *orx_ptr = orx | ~(size - 1);
- return (size);
- }
- }
- return (maxsize);
+ return (size);
}
long int initdram (int board_type)