Fix some more printf() format issues.
[platform/kernel/u-boot.git] / board / etx094 / etx094.c
index d48772b..7806519 100644 (file)
@@ -24,6 +24,8 @@
 #include <common.h>
 #include <mpc8xx.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* ------------------------------------------------------------------------- */
 
 static long int dram_size (long int, long int *, long int);
@@ -90,10 +92,8 @@ const uint sdram_table[] = {
 
 int checkboard (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
-       unsigned char *s = getenv ("serial#");
-       unsigned char *e;
+       char *s = getenv ("serial#");
+       char *e;
 
        puts ("Board: ");
 
@@ -125,7 +125,7 @@ int checkboard (void)
 
 /* ------------------------------------------------------------------------- */
 
-long int initdram (int board_type)
+phys_size_t initdram (int board_type)
 {
        volatile immap_t *immap = (immap_t *) CFG_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
@@ -186,7 +186,7 @@ long int initdram (int board_type)
         *
         * try 8 column mode
         */
-       size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
+       size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE2_PRELIM,
                                           SDRAM_MAX_SIZE);
 
        udelay (1000);
@@ -194,7 +194,7 @@ long int initdram (int board_type)
        /*
         * try 9 column mode
         */
-       size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
+       size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE2_PRELIM,
                                           SDRAM_MAX_SIZE);
 
        if (size8 < size9) {            /* leave configuration at 9 columns */
@@ -215,7 +215,7 @@ long int initdram (int board_type)
                 *  but then only half the real size will be used.]
                 */
                size_b1 =
-                               dram_size (memctl->memc_mamr, (ulong *) SDRAM_BASE3_PRELIM,
+                               dram_size (memctl->memc_mamr, (long *) SDRAM_BASE3_PRELIM,
                                                   SDRAM_MAX_SIZE);
 /*     debug ("SDRAM Bank 1: %ld MB\n", size8 >> 20);  */
        } else {
@@ -320,42 +320,10 @@ static long int dram_size (long int mamr_value, long int *base,
 {
        volatile immap_t *immap = (immap_t *) CFG_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
-       volatile long int *addr;
-       ulong cnt, val;
-       ulong save[32];                 /* to make test non-destructive */
-       unsigned char i = 0;
 
        memctl->memc_mamr = mamr_value;
 
-       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);
+       return (get_ram_size(base, maxsize));
 }
 
 /* ------------------------------------------------------------------------- */