aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/fsmc_nand.c
diff options
context:
space:
mode:
authorMike Dunn <mikedunn@newsguy.com>2012-04-25 15:06:09 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-05-14 00:12:06 -0400
commit3f91e94f7f511de74c0d2abe08672ccdbdd1961c (patch)
treed33e95596bbebc824a1331c83951a25d2118fd36 /drivers/mtd/nand/fsmc_nand.c
parentd062d4ede877fcd2ecc4c6262abad09a6f32950a (diff)
mtd: nand: read_page() returns max_bitflips
The ecc.read_page() method for nand drivers is changed to return the maximum number of bitflips that were corrected on any one region covering an ecc step, This patch doesn't change what the nand code returns to mtd. This v2 includes the change to the fsl_ifc_nand driver requested by Scott¹. ¹ http://lists.infradead.org/pipermail/linux-mtd/2012-April/040883.html Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Acked-by (freescale changes): Scott Wood <scottwood@freescale.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/fsmc_nand.c')
-rw-r--r--drivers/mtd/nand/fsmc_nand.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 9d7f4171e077..6bf59fdde263 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -720,6 +720,7 @@ static int fsmc_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
720 */ 720 */
721 uint16_t ecc_oob[7]; 721 uint16_t ecc_oob[7];
722 uint8_t *oob = (uint8_t *)&ecc_oob[0]; 722 uint8_t *oob = (uint8_t *)&ecc_oob[0];
723 unsigned int max_bitflips = 0;
723 724
724 for (i = 0, s = 0; s < eccsteps; s++, i += eccbytes, p += eccsize) { 725 for (i = 0, s = 0; s < eccsteps; s++, i += eccbytes, p += eccsize) {
725 chip->cmdfunc(mtd, NAND_CMD_READ0, s * eccsize, page); 726 chip->cmdfunc(mtd, NAND_CMD_READ0, s * eccsize, page);
@@ -748,13 +749,15 @@ static int fsmc_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
748 chip->ecc.calculate(mtd, p, &ecc_calc[i]); 749 chip->ecc.calculate(mtd, p, &ecc_calc[i]);
749 750
750 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); 751 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
751 if (stat < 0) 752 if (stat < 0) {
752 mtd->ecc_stats.failed++; 753 mtd->ecc_stats.failed++;
753 else 754 } else {
754 mtd->ecc_stats.corrected += stat; 755 mtd->ecc_stats.corrected += stat;
756 max_bitflips = max_t(unsigned int, max_bitflips, stat);
757 }
755 } 758 }
756 759
757 return 0; 760 return max_bitflips;
758} 761}
759 762
760/* 763/*