From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: Huang Shijie <b32955@freescale.com>,
Brian Norris <computersforpeace@gmail.com>,
Pekon Gupta <pekon@ti.com>
Subject: [PATCH v3 1/5] mtd: nand: localize ECC failures per page
Date: Fri, 3 Jan 2014 16:37:04 -0800 [thread overview]
Message-ID: <1388795828-24808-1-git-send-email-computersforpeace@gmail.com> (raw)
ECC failures can be tracked at the page level, not the do_read_ops level
(i.e., a potentially multi-page transaction).
This helps prepare for READ RETRY support.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
No changes since v1
drivers/mtd/nand/nand_base.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 9b3bb3c519e9..e85b07f4293d 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1422,7 +1422,6 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
{
int chipnr, page, realpage, col, bytes, aligned, oob_required;
struct nand_chip *chip = mtd->priv;
- struct mtd_ecc_stats stats;
int ret = 0;
uint32_t readlen = ops->len;
uint32_t oobreadlen = ops->ooblen;
@@ -1432,7 +1431,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
uint8_t *bufpoi, *oob, *buf;
unsigned int max_bitflips = 0;
- stats = mtd->ecc_stats;
+ bool ecc_fail = false;
chipnr = (int)(from >> chip->chip_shift);
chip->select_chip(mtd, chipnr);
@@ -1447,6 +1446,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
oob_required = oob ? 1 : 0;
while (1) {
+ unsigned int ecc_failures = mtd->ecc_stats.failed;
bytes = min(mtd->writesize - col, readlen);
aligned = (bytes == mtd->writesize);
@@ -1483,7 +1483,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
/* Transfer not aligned data */
if (!aligned) {
if (!NAND_HAS_SUBPAGE_READ(chip) && !oob &&
- !(mtd->ecc_stats.failed - stats.failed) &&
+ !(mtd->ecc_stats.failed - ecc_failures) &&
(ops->mode != MTD_OPS_RAW)) {
chip->pagebuf = realpage;
chip->pagebuf_bitflips = ret;
@@ -1513,6 +1513,9 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
else
nand_wait_ready(mtd);
}
+
+ if (mtd->ecc_stats.failed - ecc_failures)
+ ecc_fail = true;
} else {
memcpy(buf, chip->buffers->databuf + col, bytes);
buf += bytes;
@@ -1547,7 +1550,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
if (ret < 0)
return ret;
- if (mtd->ecc_stats.failed - stats.failed)
+ if (ecc_fail)
return -EBADMSG;
return max_bitflips;
--
1.8.3.2
next reply other threads:[~2014-01-04 0:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-04 0:37 Brian Norris [this message]
2014-01-04 0:37 ` [PATCH v3 2/5] mtd: nand: add ONFI vendor block for Micron Brian Norris
2014-01-07 5:52 ` Huang Shijie
2014-01-04 0:37 ` [PATCH v3 3/5] mtd: nand: add generic READ RETRY support Brian Norris
2014-01-07 6:17 ` Huang Shijie
2014-01-13 8:04 ` Brian Norris
2014-01-13 7:36 ` Huang Shijie
2014-01-07 8:21 ` Huang Shijie
2014-01-04 0:37 ` [PATCH v3 4/5] mtd: nand: support Micron READ RETRY Brian Norris
2014-01-04 12:49 ` Huang Shijie
2014-01-07 6:54 ` Huang Shijie
2014-01-04 0:37 ` [PATCH v3 5/5] mtd: nand: use __packed shorthand Brian Norris
2014-01-07 5:52 ` Huang Shijie
2014-01-07 7:02 ` [PATCH v3 1/5] mtd: nand: localize ECC failures per page Huang Shijie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1388795828-24808-1-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=b32955@freescale.com \
--cc=linux-mtd@lists.infradead.org \
--cc=pekon@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).