diff options
author | Scott Wood <scottwood@freescale.com> | 2015-03-19 09:20:49 -0700 |
---|---|---|
committer | York Sun <yorksun@freescale.com> | 2015-04-23 08:55:53 -0700 |
commit | 585acc9de65554e2d77dc3d30a65d59b8766ba39 (patch) | |
tree | 7c6a79ed3ca8ed3b779ca01bb36f993572f0adb3 | |
parent | 45bc6fd10819b07b83558d753cf169d9369af823 (diff) | |
download | u-boot-585acc9de65554e2d77dc3d30a65d59b8766ba39.tar.gz u-boot-585acc9de65554e2d77dc3d30a65d59b8766ba39.tar.bz2 u-boot-585acc9de65554e2d77dc3d30a65d59b8766ba39.zip |
nand/fsl_ifc: Increase eccstat[] for IFC 2.0
IFC 2.0 doubled the SRAM size, which means double the number of
ECCSTAT registers. Fix the resulting array overflow.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
-rw-r--r-- | drivers/mtd/nand/fsl_ifc_nand.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c index 7903eebd53..28f197ed9e 100644 --- a/drivers/mtd/nand/fsl_ifc_nand.c +++ b/drivers/mtd/nand/fsl_ifc_nand.c @@ -292,7 +292,7 @@ static int fsl_ifc_run_command(struct mtd_info *mtd) struct fsl_ifc *ifc = ctrl->regs; u32 timeo = (CONFIG_SYS_HZ * 10) / 1000; u32 time_start; - u32 eccstat[4] = {0}; + u32 eccstat[8] = {0}; int i; /* set the chip select for NAND Transaction */ @@ -325,8 +325,15 @@ static int fsl_ifc_run_command(struct mtd_info *mtd) int sector = bufnum * chip->ecc.steps; int sector_end = sector + chip->ecc.steps - 1; - for (i = sector / 4; i <= sector_end / 4; i++) + for (i = sector / 4; i <= sector_end / 4; i++) { + if (i >= ARRAY_SIZE(eccstat)) { + printf("%s: eccstat too small for %d\n", + __func__, i); + return -EIO; + } + eccstat[i] = ifc_in32(&ifc->ifc_nand.nand_eccstat[i]); + } for (i = sector; i <= sector_end; i++) { errors = check_read_ecc(mtd, ctrl, eccstat, i); |