public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 3/4] mtd: nand: support Micron READ RETRY
Date: Thu, 5 Dec 2013 12:58:38 -0800	[thread overview]
Message-ID: <20131205205838.GL27149@ld-irv-0074.broadcom.com> (raw)
In-Reply-To: <1386274800-22013-3-git-send-email-computersforpeace@gmail.com>

Caught a simple bug when testing with a non-READ_RETRY NAND. See below.

On Thu, Dec 05, 2013 at 12:19:59PM -0800, Brian Norris wrote:
...
> One thing I'm not sure about: do all relevant (i.e., ONFI-capable) NAND drivers
> support SET_FEATURES properly? If not, then it's possible that this could break
> nand_do_read_ops for such drivers. Not sure what the best method of handling
> that would be.
...
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
...
> @@ -1512,8 +1535,27 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
>  					nand_wait_ready(mtd);
>  			}
>  
> -			if (mtd->ecc_stats.failed - ecc_failures)
> -				ecc_fail = true;
> +			if (mtd->ecc_stats.failed - ecc_failures) {
> +				retry_mode++;

This increment shouldn't be done for all ECC failures, but only for
failures where there are remaining read-retry modes (i.e., flash that
support read retry).

> +				if (retry_mode < chip->read_retries) {
> +					pr_debug("ECC error; performing READ RETRY %d\n",
> +							retry_mode);
> +
> +					ret = nand_set_read_retry(mtd,
> +							retry_mode);
> +					if (ret < 0)
> +						break;
> +
> +					/* Reset failures */
> +					mtd->ecc_stats.failed = ecc_failures;
> +					continue;
> +				} else {
> +					/* No more retry modes; real failure */
> +					ecc_fail = true;
> +				}
> +			}
> +
> +			buf += bytes;
>  		} else {
>  			memcpy(buf, chip->buffers->databuf + col, bytes);
>  			buf += bytes;

I'll send a v2 with the following extra diff:

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 82efd819f31b..aeafcdce6cc0 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1536,8 +1536,8 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
 			}
 
 			if (mtd->ecc_stats.failed - ecc_failures) {
-				retry_mode++;
-				if (retry_mode < chip->read_retries) {
+				if (retry_mode + 1 < chip->read_retries) {
+					retry_mode++;
 					pr_debug("ECC error; performing READ RETRY %d\n",
 							retry_mode);
 
---

Brian

  reply	other threads:[~2013-12-05 20:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05 20:19 [PATCH 1/4] mtd: nand: localize ECC failures per page Brian Norris
2013-12-05 20:19 ` [PATCH 2/4] mtd: nand: add ONFI vendor block for Micron Brian Norris
2013-12-05 20:19 ` [PATCH 3/4] mtd: nand: support Micron READ RETRY Brian Norris
2013-12-05 20:58   ` Brian Norris [this message]
2013-12-06  8:48     ` Huang Shijie
2013-12-05 20:20 ` [PATCH 4/4] mtd: nand: use __packed shorthand Brian Norris

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=20131205205838.GL27149@ld-irv-0074.broadcom.com \
    --to=computersforpeace@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