From patchwork Thu Dec 5 20:58:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 297395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 891C52C007A for ; Fri, 6 Dec 2013 07:59:18 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vog0t-0002Y2-73; Thu, 05 Dec 2013 20:59:11 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vog0r-0005VO-FH; Thu, 05 Dec 2013 20:59:09 +0000 Received: from mail-ob0-f170.google.com ([209.85.214.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vog0p-0005Uo-E0 for linux-mtd@lists.infradead.org; Thu, 05 Dec 2013 20:59:08 +0000 Received: by mail-ob0-f170.google.com with SMTP id wp18so18606779obc.29 for ; Thu, 05 Dec 2013 12:58:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=JqnTz9rzSqNqhU6zui/adjrqZD51kGsXRleyZ8tCvcI=; b=ENfHqUS7orcCaO96dwKXmtB+Dq064fa+/Ruq/0yznwtBnTvpxLIyMw5T7Xo1YV8j7D KhU8UNmFWWzuNb8WBBhm5oW9ulEDA2bJgo2bcl6b04Zvihzw7VwXNGdemiL2tuvllcaY TKrLy46p6tYHmYuNLQDVPnMTaZAkuRKTlUVUWlxbOrI1gh61pZjKnS/nj0Te5Qig6uhM V94i6ZToDAzjhShTtuebv054l3MMAFC/7Ir1V0gpkZivoEfbB/aVIt9FMDmUexuC2loD SKRw3DzcqqRvqaJ2lsLFDDADzm18x1+nReuJDsf0NG6lC/yKJdZfHQSRCg+Ruf7jGq6H a5Ig== X-Received: by 10.182.143.103 with SMTP id sd7mr2014361obb.70.1386277121951; Thu, 05 Dec 2013 12:58:41 -0800 (PST) Received: from ld-irv-0074.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPSA id tr10sm79589047obb.6.2013.12.05.12.58.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 05 Dec 2013 12:58:41 -0800 (PST) Date: Thu, 5 Dec 2013 12:58:38 -0800 From: Brian Norris To: linux-mtd@lists.infradead.org Subject: Re: [PATCH 3/4] mtd: nand: support Micron READ RETRY Message-ID: <20131205205838.GL27149@ld-irv-0074.broadcom.com> References: <1386274800-22013-1-git-send-email-computersforpeace@gmail.com> <1386274800-22013-3-git-send-email-computersforpeace@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1386274800-22013-3-git-send-email-computersforpeace@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131205_155907_541083_E000FFC3 X-CRM114-Status: GOOD ( 16.67 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.170 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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: --- Brian 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);