]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
* Prepare for release
authorwdenk <wdenk>
Wed, 29 Oct 2003 23:18:55 +0000 (23:18 +0000)
committerwdenk <wdenk>
Wed, 29 Oct 2003 23:18:55 +0000 (23:18 +0000)
* Fix problems in memory test on some boards (which was not
  non-destructive as intended)

* Patch by Gary Jennejohn, 28 Oct 2003:
  Change fs/fat/fat.c to put I/O buffers in BSS instead on the stack
  to prevent stack overflow on ARM systems

12 files changed:
CHANGELOG
board/RRvision/RRvision.c
board/atc/atc.c
board/c2mon/c2mon.c
board/etx094/etx094.c
board/evb64260/flash.c
board/rmu/rmu.c
board/tqm8260/tqm8260.c
board/tqm8xx/tqm8xx.c
fs/fat/fat.c
include/version.h
lib_arm/board.c

index b391732e6d352f0ba993d8cbde2e0e4ffa5fa55a..b8d8f49c56fe7e8a9ac7b1313d7e563c87f7aafe 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,13 @@
 Changes for U-Boot 1.0.0:
 ======================================================================
 
+* Fix problems in memory test on some boards (which was not
+  non-destructive as intended)
+
+* Patch by Gary Jennejohn, 28 Oct 2003:
+  Change fs/fat/fat.c to put I/O buffers in BSS instead on the stack
+  to prevent stack overflow on ARM systems
+
 * Patch by Stephan Linz, 28 Oct 2003:
   fix init sequence error for NIOS port
 
index d6f5c2a0d563b2122b5b765641f8ddc0e625564b..8ed561d87bb0ca5156d73ae2c859062eee7e3d90 100644 (file)
@@ -230,8 +230,8 @@ 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 */
+       ulong cnt, val, size;
+       ulong save[32];                 /* to make test non-destructive */
        unsigned char i = 0;
 
        memctl->memc_mamr = mamr_value;
@@ -250,7 +250,13 @@ static long int dram_size (long int mamr_value, long int *base,
 
        /* check at base address */
        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);
        }
 
@@ -261,7 +267,14 @@ static long int dram_size (long int mamr_value, long int *base,
                *addr = save[--i];
 
                if (val != (~cnt)) {
-                       return (cnt * sizeof (long));
+                       size = cnt * sizeof (long);
+                       /* Restore the original data before returning
+                        */
+                       for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
+                               addr  = (volatile ulong *) base + cnt;
+                               *addr = save[--i];
+                       }
+                       return (size);
                }
        }
        return (maxsize);
index 9aa942fcfc6a116c5cf99fb31b41e3fa8b477fd1..fad7646afd1d6566230c902f422059264a98a037 100644 (file)
@@ -269,7 +269,7 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
                          ulong orx, volatile uchar * base)
 {
        volatile uchar c = 0xff;
-       ulong cnt, val;
+       ulong cnt, val, size;
        volatile ulong *addr;
        volatile uint *sdmr_ptr;
        volatile uint *orx_ptr;
@@ -344,7 +344,13 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
        *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);
        }
 
@@ -353,10 +359,17 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
                val = *addr;
                *addr = save[--i];
                if (val != ~cnt) {
+                       size = cnt * sizeof (long);
+                       /* Restore the original data before returning
+                        */
+                       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 | ~(cnt * sizeof (long) - 1);
-                       return (cnt * sizeof (long));
+                       *orx_ptr = orx | ~(size - 1);
+                       return (size);
                }
        }
        return (maxsize);
index 171d06eba0a057b85b04e024b8e296bbdbe0a315..0fdcebe373d481b5b1816c11231055c7ab53d214 100644 (file)
@@ -228,8 +228,8 @@ 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 */
+       ulong cnt, val, size;
+       ulong save[32];                 /* to make test non-destructive */
        unsigned char i = 0;
 
        memctl->memc_mamr = mamr_value;
@@ -248,7 +248,13 @@ static long int dram_size (long int mamr_value, long int *base,
 
        /* check at base address */
        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);
        }
 
@@ -259,7 +265,14 @@ static long int dram_size (long int mamr_value, long int *base,
                *addr = save[--i];
 
                if (val != (~cnt)) {
-                       return (cnt * sizeof (long));
+                       size = cnt * sizeof (long);
+                       /* Restore the original data before returning
+                        */
+                       for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
+                               addr  = (volatile ulong *) base + cnt;
+                               *addr = save[--i];
+                       }
+                       return (size);
                }
        }
        return (maxsize);
index d48772be6c3e947b0926a37f2c0eb657baab0ae5..e52ca85741354e85a879bd4b262cfdc6571adbd3 100644 (file)
@@ -321,8 +321,8 @@ 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 */
+       ulong cnt, val, size;
+       ulong save[32];                 /* to make test non-destructive */
        unsigned char i = 0;
 
        memctl->memc_mamr = mamr_value;
@@ -341,7 +341,13 @@ static long int dram_size (long int mamr_value, long int *base,
 
        /* check at base address */
        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);
        }
 
@@ -352,7 +358,14 @@ static long int dram_size (long int mamr_value, long int *base,
                *addr = save[--i];
 
                if (val != (~cnt)) {
-                       return (cnt * sizeof (long));
+                       size = cnt * sizeof (long);
+                       /* Restore the original data before returning
+                        */
+                       for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
+                               addr  = (volatile ulong *) base + cnt;
+                               *addr = save[--i];
+                       }
+                       return (size);
                }
        }
        return (maxsize);
index bc52c12786488d9a4f12648f66c7630ad7f06bce..7ca6f0ae73d53127d35f34649211fbd8870b86a4 100644 (file)
@@ -97,7 +97,7 @@ flash_init (void)
 #ifndef CONFIG_P3G4
            printf("[");
            print_size (size, "");
-           printf("@%08lX] ", size>>20, base);
+           printf("@%08lX] ", base);
 #endif
 
            if (flash_info[i].flash_id == FLASH_UNKNOWN) {
index 331fb9877a9627dca6f7996a04b0865fba562b79..5fda4c061b550f7488f01b543a68e9038412d69c 100644 (file)
@@ -94,39 +94,41 @@ int checkboard (void)
 
 long int initdram (int board_type)
 {
-    volatile immap_t     *immap  = (immap_t *)CFG_IMMR;
-    volatile memctl8xx_t *memctl = &immap->im_memctl;
-    long int size9 ;
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile memctl8xx_t *memctl = &immap->im_memctl;
+       long int size9;
 
-    upmconfig(UPMA, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint));
+       upmconfig (UPMA, (uint *) sdram_table,
+                  sizeof (sdram_table) / sizeof (uint));
 
        /* Refresh clock prescalar */
-    memctl->memc_mptpr = CFG_MPTPR ;
+       memctl->memc_mptpr = CFG_MPTPR;
 
-    memctl->memc_mar  = 0x00000088;
+       memctl->memc_mar = 0x00000088;
 
        /* Map controller banks 1 to the SDRAM bank */
-    memctl->memc_or1 = CFG_OR1_PRELIM;
-    memctl->memc_br1 = CFG_BR1_PRELIM;
+       memctl->memc_or1 = CFG_OR1_PRELIM;
+       memctl->memc_br1 = CFG_BR1_PRELIM;
 
-    memctl->memc_mamr = CFG_MAMR_9COL & (~(MAMR_PTAE)); /* no refresh yet */
+       memctl->memc_mamr = CFG_MAMR_9COL & (~(MAMR_PTAE));     /* no refresh yet */
 
-    udelay(200);
+       udelay (200);
 
-    /* perform SDRAM initializsation sequence */
+       /* perform SDRAM initializsation sequence */
 
-       memctl->memc_mcr  = 0x80002136 ; /* SDRAM bank 0 */
-    udelay(1);
+       memctl->memc_mcr = 0x80002136;  /* SDRAM bank 0 */
+       udelay (1);
 
-    memctl->memc_mamr |= MAMR_PTAE;    /* enable refresh */
+       memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
 
-    udelay (1000);
+       udelay (1000);
 
        /* Check Bank 0 Memory Size,
         * 9 column mode
         */
 
-       size9 = dram_size (CFG_MAMR_9COL, (ulong *)SDRAM_BASE_PRELIM, SDRAM_MAX_SIZE) ;
+       size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE_PRELIM,
+                          SDRAM_MAX_SIZE);
 
        /*
         * Final mapping:
@@ -135,7 +137,7 @@ long int initdram (int board_type)
        memctl->memc_or1 = ((-size9) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
        udelay (1000);
 
-    return (size9);
+       return (size9);
 }
 
 /* ------------------------------------------------------------------------- */
@@ -148,44 +150,58 @@ long int initdram (int board_type)
  * - short between data lines
  */
 
-static long int dram_size (long int mamr_value, long int *base, long int maxsize)
+static long int dram_size (long int mamr_value, long int *base,
+                          long int maxsize)
 {
-    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! */
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile memctl8xx_t *memctl = &immap->im_memctl;
+       volatile long int *addr;
+       ulong cnt, val, size;
+       ulong save[32];         /* to make test non-destructive */
+       unsigned char i = 0;
 
-       save[i++] = *addr;
-       *addr = ~cnt;
-    }
+       memctl->memc_mamr = mamr_value;
 
-    /* write 0 to base address */
-    addr = base;
-    save[i] = *addr;
-    *addr = 0;
+       for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
+               addr = base + cnt;      /* pointer arith! */
 
-    /* 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! */
+               save[i++] = *addr;
+               *addr = ~cnt;
+       }
 
-       val = *addr;
-       *addr = save[--i];
+       /* write 0 to base address */
+       addr = base;
+       save[i] = *addr;
+       *addr = 0;
+
+       /* check at base address */
+       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);
+       }
 
-       if (val != (~cnt)) {
-           return (cnt * sizeof(long));
+       for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
+               addr = base + cnt;      /* pointer arith! */
+
+               val = *addr;
+               *addr = save[--i];
+
+               if (val != (~cnt)) {
+                       size = cnt * sizeof (long);
+                       /* Restore the original data before returning
+                        */
+                       for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
+                               addr  = (volatile ulong *) base + cnt;
+                               *addr = save[--i];
+                       }
+                       return (size);
+               }
        }
-    }
-    return (maxsize);
+       return (maxsize);
 }
index 556a1e3e7ba7849b075ef8f464688a4dd14addc2..a0a38caf2c5ad46f718d0ffa212b14f6b4fa0573 100644 (file)
@@ -230,7 +230,7 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
        volatile uint *orx_ptr;
        int i;
        ulong save[32];                         /* to make test non-destructive */
-       ulong maxsize;
+       ulong maxsize, size;
 
        /* 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
@@ -299,7 +299,13 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
        *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);
        }
 
@@ -308,10 +314,17 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
                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 | ~(cnt * sizeof (long) - 1);
-                       return (cnt * sizeof (long));
+                       *orx_ptr = orx | ~(size - 1);
+                       return (size);
                }
        }
        return (maxsize);
index 53f1f2abbe957fbfb91a1d80fe5e94be2d9f4693..badc7940116e4c395d66fe4cd02186b6c0270a96 100644 (file)
@@ -389,8 +389,8 @@ 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 */
+       ulong cnt, val, size;
+       ulong save[32];                 /* to make test non-destructive */
        unsigned char i = 0;
 
        memctl->memc_mamr = mamr_value;
@@ -409,7 +409,13 @@ static long int dram_size (long int mamr_value, long int *base,
 
        /* check at base address */
        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);
        }
 
@@ -420,7 +426,14 @@ static long int dram_size (long int mamr_value, long int *base,
                *addr = save[--i];
 
                if (val != (~cnt)) {
-                       return (cnt * sizeof (long));
+                       size = cnt * sizeof (long);
+                       /* Restore the original data before returning
+                        */
+                       for (cnt <<= 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
+                               addr  = (volatile ulong *) base + cnt;
+                               *addr = save[--i];
+                       }
+                       return (size);
                }
        }
        return (maxsize);
index 1f271332681c445415130dadf8d93798b2c41445..29eea4582ffe3a01eeca3ba588ce4ed71ba7de66 100644 (file)
 
 #if (CONFIG_COMMANDS & CFG_CMD_FAT)
 
-#ifdef CONFIG_AUTO_UPDATE
-/* the VFAT code has a bug which breaks auto update */
-#undef CONFIG_SUPPORT_VFAT
-#endif
-
 /*
  * Convert a string to lowercase.
  */
@@ -429,6 +424,7 @@ slot2str(dir_slot *slotptr, char *l_name, int *idx)
  * into 'retdent'
  * Return 0 on success, -1 otherwise.
  */
+__u8    get_vfatname_block[MAX_CLUSTSIZE];
 static int
 get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
             dir_entry *retdent, char *l_name)
@@ -447,7 +443,6 @@ get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
        }
 
        if ((__u8*)slotptr >= nextclust) {
-               __u8     block[MAX_CLUSTSIZE];
                dir_slot *slotptr2;
 
                slotptr--;
@@ -457,18 +452,18 @@ get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
                        FAT_ERROR("Invalid FAT entry\n");
                        return -1;
                }
-               if (get_cluster(mydata, curclust, block,
+               if (get_cluster(mydata, curclust, get_vfatname_block,
                                mydata->clust_size * SECTOR_SIZE) != 0) {
                        FAT_DPRINT("Error: reading directory block\n");
                        return -1;
                }
-               slotptr2 = (dir_slot*) block;
+               slotptr2 = (dir_slot*) get_vfatname_block;
                while (slotptr2->id > 0x01) {
                        slotptr2++;
                }
                /* Save the real directory entry */
                realdent = (dir_entry*)slotptr2 + 1;
-               while ((__u8*)slotptr2 >= block) {
+               while ((__u8*)slotptr2 >= get_vfatname_block) {
                        slot2str(slotptr2, l_name, &idx);
                        slotptr2--;
                }
@@ -514,12 +509,12 @@ mkcksum(const char *str)
  * Get the directory entry associated with 'filename' from the directory
  * starting at 'startsect'
  */
+__u8 get_dentfromdir_block[MAX_CLUSTSIZE];
 static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
                                   char *filename, dir_entry * retdent,
                                   int dols)
 {
     __u16 prevcksum = 0xffff;
-    __u8 block[MAX_CLUSTSIZE];
     __u32 curclust = START (retdent);
     int files = 0, dirs = 0;
 
@@ -528,12 +523,12 @@ static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
        dir_entry *dentptr;
        int i;
 
-       if (get_cluster (mydata, curclust, block,
+       if (get_cluster (mydata, curclust, get_dentfromdir_block,
                 mydata->clust_size * SECTOR_SIZE) != 0) {
            FAT_DPRINT ("Error: reading directory block\n");
            return NULL;
        }
-       dentptr = (dir_entry *) block;
+       dentptr = (dir_entry *) get_dentfromdir_block;
        for (i = 0; i < DIRENTSPERCLUST; i++) {
            char s_name[14], l_name[256];
 
@@ -544,7 +539,7 @@ static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
                    (dentptr->name[0] & 0x40)) {
                    prevcksum = ((dir_slot *) dentptr)
                            ->alias_checksum;
-                   get_vfatname (mydata, curclust, block,
+                   get_vfatname (mydata, curclust, get_dentfromdir_block,
                                  dentptr, l_name);
                    if (dols) {
                        int isdir = (dentptr->attr & ATTR_DIR);
@@ -716,11 +711,11 @@ read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
 }
 
 
+__u8 do_fat_read_block[MAX_CLUSTSIZE];  /* Block buffer */
 static long
 do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
             int dols)
 {
-    __u8 block[MAX_CLUSTSIZE];  /* Block buffer */
     char fnamecopy[2048];
     boot_sector bs;
     volume_info volinfo;
@@ -792,11 +787,11 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
     while (1) {
        int i;
 
-       if (disk_read (cursect, mydata->clust_size, block) < 0) {
+       if (disk_read (cursect, mydata->clust_size, do_fat_read_block) < 0) {
            FAT_DPRINT ("Error: reading rootdir block\n");
            return -1;
        }
-       dentptr = (dir_entry *) block;
+       dentptr = (dir_entry *) do_fat_read_block;
        for (i = 0; i < DIRENTSPERBLOCK; i++) {
            char s_name[14], l_name[256];
 
@@ -806,7 +801,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
                if ((dentptr->attr & ATTR_VFAT) &&
                    (dentptr->name[0] & 0x40)) {
                    prevcksum = ((dir_slot *) dentptr)->alias_checksum;
-                   get_vfatname (mydata, 0, block, dentptr, l_name);
+                   get_vfatname (mydata, 0, do_fat_read_block, dentptr, l_name);
                    if (dols == LS_ROOT) {
                        int isdir = (dentptr->attr & ATTR_DIR);
                        char dirc;
index ef22f7ac0a8a150e053a727604c3e634562c6ef7..b4ee13a40a16fb164a9e06e6088a9516288d1fb2 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef        __VERSION_H__
 #define        __VERSION_H__
 
-#define        U_BOOT_VERSION  "U-Boot 1.0.0-pre"
+#define        U_BOOT_VERSION  "U-Boot 1.0.0"
 
 #endif /* __VERSION_H__ */
index f3f831f4fbeb4657b99c3f3bdbf0e6a38152b5dd..a6029b0f200977ac13da0fe59e5a726107e65cdc 100644 (file)
@@ -111,9 +111,9 @@ static int init_baudrate (void)
 
 static int display_banner (void)
 {
+#ifdef CONFIG_SILENT_CONSOLE
        DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_SILENT_CONSOLE
        if (gd->flags & GD_FLG_SILENT)
                return (0);
 #endif
@@ -161,9 +161,9 @@ static int display_dram_config (void)
 
 static void display_flash_config (ulong size)
 {
+#ifdef CONFIG_SILENT_CONSOLE
        DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_SILENT_CONSOLE
        if (gd->flags & GD_FLG_SILENT)
                return;
 #endif