]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
board/etx094/flash.c: Fix flash initialization
authorWolfgang Denk <wd@denx.de>
Fri, 4 Nov 2011 15:55:39 +0000 (15:55 +0000)
committerWolfgang Denk <wd@denx.de>
Mon, 7 Nov 2011 21:14:17 +0000 (22:14 +0100)
The ETX094 has only one NOR flash bank.  Remove all code trying to
deal with a second bank.  This also fixes a number of GCC 4.6 build
warnings:
flash.c: In function 'flash_init':
flash.c:68:13: warning: array subscript is above array bounds
[-Warray-bounds]
flash.c:70:13: warning: array subscript is above array bounds
[-Warray-bounds]
flash.c:72:13: warning: array subscript is above array bounds
[-Warray-bounds]
flash.c:128:13: warning: array subscript is above array bounds
[-Warray-bounds]
flash.c:129:13: warning: array subscript is above array bounds
[-Warray-bounds]
flash.c:133:12: warning: array subscript is above array bounds
[-Warray-bounds]

Signed-off-by: Wolfgang Denk <wd@denx.de>
board/etx094/flash.c

index c1bd13c29cc798c29d71233564955898a51779d9..0958e73d60cfe9cc6562592b8edaf54924327d8b 100644 (file)
@@ -40,7 +40,7 @@ unsigned long flash_init(void)
 {
        volatile immap_t     *immap  = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8xx_t *memctl = &immap->im_memctl;
-       unsigned long size_b0, size_b1;
+       unsigned long size_b0;
        int i;
 
        /* Init: no FLASHes known */
@@ -56,23 +56,6 @@ unsigned long flash_init(void)
                        size_b0, size_b0<<20);
        }
 
-       size_b1 = flash_get_size((vu_long *)FLASH_BASE1_PRELIM, &flash_info[1]);
-
-       if (size_b1 > size_b0) {
-               printf("## ERROR: "
-                       "Bank 1 (0x%08lx = %ld MB) > Bank 0 (0x%08lx = %ld MB)\n",
-                       size_b1, size_b1<<20,
-                       size_b0, size_b0<<20
-               );
-               flash_info[0].flash_id  = FLASH_UNKNOWN;
-               flash_info[1].flash_id  = FLASH_UNKNOWN;
-               flash_info[0].sector_count      = -1;
-               flash_info[1].sector_count      = -1;
-               flash_info[0].size              = 0;
-               flash_info[1].size              = 0;
-               return 0;
-       }
-
        /* Remap FLASH according to real size */
        memctl->memc_or0 = CONFIG_SYS_OR_TIMING_FLASH | (-size_b0 & 0xFFFF8000);
 #ifdef CONFIG_FLASH_16BIT
@@ -97,42 +80,11 @@ unsigned long flash_init(void)
                      &flash_info[0]);
 #endif
 
-       if (size_b1) {
-               memctl->memc_or1 = CONFIG_SYS_OR_TIMING_FLASH |
-                       (-size_b1 & 0xFFFF8000);
-#ifdef CONFIG_FLASH_16BIT
-               memctl->memc_br1 = ((CONFIG_SYS_FLASH_BASE + size_b0) &
-                       BR_BA_MSK) | BR_MS_GPCM | BR_V | BR_PS_16;
-#else
-               memctl->memc_br1 = ((CONFIG_SYS_FLASH_BASE + size_b0) &
-                       BR_BA_MSK) | BR_MS_GPCM | BR_V;
-#endif
-
-               /* Re-do sizing to get full correct info */
-               size_b1 = flash_get_size((vu_long *)(CONFIG_SYS_FLASH_BASE +
-                               size_b0), &flash_info[1]);
-
-               flash_get_offsets(CONFIG_SYS_FLASH_BASE + size_b0,
-                               &flash_info[1]);
-
-#if CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE
-               /* monitor protection ON by default */
-               flash_protect(FLAG_PROTECT_SET,
-                             CONFIG_SYS_MONITOR_BASE,
-                             CONFIG_SYS_MONITOR_BASE+monitor_flash_len-1,
-                             &flash_info[1]);
-#endif
-       } else {
-               memctl->memc_br1 = 0;           /* invalidate bank */
-
-               flash_info[1].flash_id = FLASH_UNKNOWN;
-               flash_info[1].sector_count = -1;
-       }
+       memctl->memc_br1 = 0;           /* invalidate bank 1 */
 
        flash_info[0].size = size_b0;
-       flash_info[1].size = size_b1;
 
-       return size_b0 + size_b1;
+       return size_b0;
 }
 
 /*-----------------------------------------------------------------------