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>
This commit is contained in:

committed by
David Woodhouse

parent
d062d4ede8
commit
3f91e94f7f
@@ -335,6 +335,7 @@ static int atmel_nand_read_page(struct mtd_info *mtd,
|
||||
uint8_t *oob = chip->oob_poi;
|
||||
uint8_t *ecc_pos;
|
||||
int stat;
|
||||
unsigned int max_bitflips = 0;
|
||||
|
||||
/*
|
||||
* Errata: ALE is incorrectly wired up to the ECC controller
|
||||
@@ -371,10 +372,12 @@ static int atmel_nand_read_page(struct mtd_info *mtd,
|
||||
/* check if there's an error */
|
||||
stat = chip->ecc.correct(mtd, p, oob, NULL);
|
||||
|
||||
if (stat < 0)
|
||||
if (stat < 0) {
|
||||
mtd->ecc_stats.failed++;
|
||||
else
|
||||
} else {
|
||||
mtd->ecc_stats.corrected += stat;
|
||||
max_bitflips = max_t(unsigned int, max_bitflips, stat);
|
||||
}
|
||||
|
||||
/* get back to oob start (end of page) */
|
||||
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
|
||||
@@ -382,7 +385,7 @@ static int atmel_nand_read_page(struct mtd_info *mtd,
|
||||
/* read the oob */
|
||||
chip->read_buf(mtd, oob, mtd->oobsize);
|
||||
|
||||
return 0;
|
||||
return max_bitflips;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user