Re: [U-Boot] [PATCH 35/56] board/etx094/flash.c: Fix flash initialization

2011-11-07 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1320458160-23136-36-git-send-email...@denx.de> you wrote:
> 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 
> ---
>  board/etx094/flash.c |   54 ++---
>  1 files changed, 3 insertions(+), 51 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Quote from the Boss after overriding the decision of a task force  he
created  to  find  a  solution:  "I'm  sorry  if  I ever gave you the
impression your input would have any effect on my  decision  for  the
outcome of this project!"
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 35/56] board/etx094/flash.c: Fix flash initialization

2011-11-04 Thread Wolfgang Denk
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 
---
 board/etx094/flash.c |   54 ++---
 1 files changed, 3 insertions(+), 51 deletions(-)

diff --git a/board/etx094/flash.c b/board/etx094/flash.c
index c1bd13c..0958e73 100644
--- a/board/etx094/flash.c
+++ b/board/etx094/flash.c
@@ -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 & 0x8000);
 #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 & 0x8000);
-#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;
 }
 
 /*---
-- 
1.7.6.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot