summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-04-29 10:53:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-04-29 16:12:33 +0200
commiteecac38c2ca17f49c67429b94fded33f46406702 (patch)
tree33a93ca9b813201a1eecca7cf07429cd833b602a
parent3fafc8e5c702828b783f6b66bccfd5c40db98fd9 (diff)
downloadbarebox-eecac38c2ca17f49c67429b94fded33f46406702.tar.gz
mtd: nand-mxs: Return bitflips
The read_page hook shall return the number of bitflips. Implement that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mtd/nand/nand_mxs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index b06b558..d5428bc 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -661,6 +661,7 @@ static int mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand,
uint32_t channel = nand_info->dma_channel_base + nand_info->cur_chip;
uint32_t corrected = 0, failed = 0;
uint8_t *status;
+ unsigned int max_bitflips = 0;
int i, ret;
/* Compile the DMA descriptor - wait for ready. */
@@ -766,6 +767,7 @@ static int mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand,
}
corrected += status[i];
+ max_bitflips = max_t(unsigned int, max_bitflips, status[i]);
}
/* Propagate ECC status to the owning MTD. */
@@ -787,10 +789,11 @@ static int mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand,
memcpy(buf, nand_info->data_buf, mtd->writesize);
+ ret = 0;
rtn:
mxs_nand_return_dma_descs(nand_info);
- return ret;
+ return ret ? ret : max_bitflips;
}
/*