All of lore.kernel.org
 help / color / mirror / Atom feed
From: Schrempf Frieder <frieder.schrempf@kontron.de>
To: "miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "peron.clem@gmail.com" <peron.clem@gmail.com>,
	Schrempf Frieder <frieder.schrempf@kontron.de>,
	Boris Brezillon <boris.brezillon@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: [PATCH v2] mtd: spinand: Fix ECC status and OOB layout for Toshiba TC58CVG2S0H
Date: Wed, 28 Nov 2018 13:18:48 +0000	[thread overview]
Message-ID: <1543411097-24229-1-git-send-email-frieder.schrempf@kontron.de> (raw)

When reading the status of the on-chip ECC, the Toshiba chip returns
two different states for reporting corrected bitflips. We should check
for both of them.

Also return the free OOB bytes as one contiguous area, instead of
multiple sections.

Suggested-by: Clément Péron <peron.clem@gmail.com>
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 drivers/mtd/nand/spi/toshiba.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
index 294bcf6..9731752 100644
--- a/drivers/mtd/nand/spi/toshiba.c
+++ b/drivers/mtd/nand/spi/toshiba.c
@@ -11,6 +11,7 @@
 #include <linux/mtd/spinand.h>
 
 #define SPINAND_MFR_TOSHIBA		0x98
+#define TOSH_STATUS_ECC_HAS_BITFLIPS_T	(3 << 4)
 
 static SPINAND_OP_VARIANTS(read_cache_variants,
 		SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
@@ -33,19 +34,17 @@ static int tc58cvg2s0h_ooblayout_ecc(struct mtd_info *mtd, int section,
 	region->offset = 128 + 16 * section;
 	region->length = 16;
 
-
 	return 0;
 }
 
 static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section,
 				      struct mtd_oob_region *region)
 {
-	if (section > 7)
+	if (section > 0)
 		return -ERANGE;
 
-	region->offset = 2 + 16 * section;
-	region->length = 14;
-
+	region->offset = 2;
+	region->length = 126;
 
 	return 0;
 }
@@ -70,6 +69,7 @@ static int tc58cvg2s0h_ecc_get_status(struct spinand_device *spinand,
 		return -EBADMSG;
 
 	case STATUS_ECC_HAS_BITFLIPS:
+	case TOSH_STATUS_ECC_HAS_BITFLIPS_T:
 		/*
 		 * Let's try to retrieve the real maximum number of bitflips
 		 * in order to avoid forcing the wear-leveling layer to move
-- 
2.7.4

             reply	other threads:[~2018-11-28 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 13:18 Schrempf Frieder [this message]
2018-11-29  9:56 ` [PATCH v2] mtd: spinand: Fix ECC status and OOB layout for Toshiba TC58CVG2S0H Clément Péron

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=1543411097-24229-1-git-send-email-frieder.schrempf@kontron.de \
    --to=frieder.schrempf@kontron.de \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=peron.clem@gmail.com \
    --cc=richard@nod.at \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.