Big white-space cleanup.
[oweals/u-boot.git] / board / tqm8260 / tqm8260.c
index 784d72e3301a8af5ec1d2118fd88058c3bc5b3e4..736c410ede8facfec6039f4949c89fa9d2c19460 100644 (file)
@@ -195,12 +195,12 @@ const iop_conf_t iop_conf_tab[4][32] = {
  */
 int checkboard (void)
 {
-       unsigned char str[64];
+       char str[64];
        int i = getenv_r ("serial#", str, sizeof (str));
 
        puts ("Board: ");
 
-       if (!i || strncmp (str, "TQM8260", 7)) {
+       if (!i || strncmp (str, "TQM82", 5)) {
                puts ("### No HW ID - assuming TQM8260\n");
                return (0);
        }
@@ -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;
+       ulong maxsize, size;
        int i;
-       ulong save[32];                         /* to make test non-destructive */
-       ulong maxsize;
 
        /* 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,41 +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;
-       }
-
-       addr = (volatile ulong *) base;
-       save[i] = *addr;
-       *addr = 0;
+       size = get_ram_size((long *)base, maxsize);
+       *orx_ptr = orx | ~(size - 1);
 
-       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
-                        */
-                       *orx_ptr = orx | ~(cnt * sizeof (long) - 1);
-                       return (cnt * sizeof (long));
-               }
-       }
-       return (maxsize);
+       return (size);
 }
 
 long int initdram (int board_type)
@@ -338,7 +304,7 @@ long int initdram (int board_type)
     ulong start =  memctl->memc_ ## brX & 0xFFFF8000;  \
     ulong sizem = ~memctl->memc_ ## orX | 0x00007FFF;  \
     printf ("\n"                                       \
-           #brX " 0x%08x  " #orX " 0x%08x "            \
+           #brX " 0x%08x  " #orX " 0x%08x "            \
            "==> 0x%08lx ... 0x%08lx = %ld MB\n",       \
        memctl->memc_ ## brX, memctl->memc_ ## orX,     \
        start, start+sizem, (sizem+1)>>20);             \