From: Kamal Dasu <kdasu.kdev@gmail.com>
To: linux-mtd@lists.infradead.org, computersforpeace@gmail.com
Cc: f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com,
Kamal Dasu <kdasu.kdev@gmail.com>
Subject: [PATCH 2/2] mtd: brcmnand: Detect sticky ucorr ecc error on dma reads
Date: Fri, 29 Apr 2016 16:21:25 -0400 [thread overview]
Message-ID: <1461961285-24159-2-git-send-email-kdasu.kdev@gmail.com> (raw)
In-Reply-To: <1461961285-24159-1-git-send-email-kdasu.kdev@gmail.com>
This change provides a fix for controller bug where nand
controller could have a possible sticky error after a PIO
followed by a DMA read. The fix retries a read if we see
a uncorr_ecc after read to detect such sticky errors.
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
---
drivers/mtd/nand/brcmnand/brcmnand.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c
index 29a9abd..13c7784 100644
--- a/drivers/mtd/nand/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/brcmnand/brcmnand.c
@@ -1555,9 +1555,11 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip,
struct brcmnand_controller *ctrl = host->ctrl;
u64 err_addr = 0;
int err;
+ bool retry = true;
dev_dbg(ctrl->dev, "read %llx -> %p\n", (unsigned long long)addr, buf);
+try_dmaread:
brcmnand_write_reg(ctrl, BRCMNAND_UNCORR_COUNT, 0);
if (has_flash_dma(ctrl) && !oob && flash_dma_buf_ok(buf)) {
@@ -1579,7 +1581,18 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip,
if (mtd_is_eccerr(err)) {
int ret;
-
+ /*
+ * On controller version >=7.0 if we are doing a DMA read
+ * after a prior PIO read that reported uncorrectable error,
+ * the DMA engine captures this error following DMA read
+ * cleared only on subsequent DMA read, so just retry once
+ * to clear a possible false error reported for current DMA
+ * read
+ */
+ if ((ctrl->nand_version >= 0x0700) && retry) {
+ retry = false;
+ goto try_dmaread;
+ }
ret = brcmstb_nand_verify_erased_page(mtd, chip, buf, addr);
if (ret < 0) {
dev_dbg(ctrl->dev, "uncorrectable error at 0x%llx\n",
--
1.9.1
next prev parent reply other threads:[~2016-04-29 20:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 20:21 [PATCH 1/2] mtd: brcmnand: Add check for erased page bitflips Kamal Dasu
2016-04-29 20:21 ` Kamal Dasu [this message]
2016-05-30 8:50 ` [PATCH 2/2] mtd: brcmnand: Detect sticky ucorr ecc error on dma reads Boris Brezillon
2016-06-01 16:50 ` Kamal Dasu
2016-06-01 17:20 ` Boris Brezillon
2016-06-01 20:37 ` Boris Brezillon
2016-06-02 18:55 ` Kamal Dasu
2016-05-30 8:42 ` [PATCH 1/2] mtd: brcmnand: Add check for erased page bitflips Boris Brezillon
2016-06-01 16:46 ` Kamal Dasu
2016-06-01 17:14 ` Brian Norris
2016-06-01 17:22 ` Boris Brezillon
2016-06-01 17:27 ` Kamal Dasu
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=1461961285-24159-2-git-send-email-kdasu.kdev@gmail.com \
--to=kdasu.kdev@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=computersforpeace@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/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).