All of lore.kernel.org
 help / color / mirror / Atom feed
From: Schrempf Frieder <frieder.schrempf@kontron.de>
To: "bbrezillon@kernel.org" <bbrezillon@kernel.org>,
	"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
	"richard@nod.at" <richard@nod.at>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"Schrempf Frieder" <frieder.schrempf@kontron.de>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>
Subject: [PATCH v4 7/7] mtd: rawnand: AMD: Also use the last page for bad block markers
Date: Mon, 18 Feb 2019 10:42:46 +0000	[thread overview]
Message-ID: <20190218104122.18788-8-frieder.schrempf@kontron.de> (raw)
In-Reply-To: <20190218104122.18788-1-frieder.schrempf@kontron.de>

From: Frieder Schrempf <frieder.schrempf@kontron.de>

According to the datasheet of some Cypress SLC NANDs, the bad
block markers can be in the first, second or last page of a block.
So let's check all three locations.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Boris Brezillon <bbrezillon@kernel.org>
---
 drivers/mtd/nand/raw/nand_amd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/nand_amd.c b/drivers/mtd/nand/raw/nand_amd.c
index 6202cbf7ee8d..2ffcddff3e27 100644
--- a/drivers/mtd/nand/raw/nand_amd.c
+++ b/drivers/mtd/nand/raw/nand_amd.c
@@ -40,7 +40,13 @@ static void amd_nand_decode_id(struct nand_chip *chip)
 static int amd_nand_init(struct nand_chip *chip)
 {
 	if (nand_is_slc(chip))
-		chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
+		/*
+		 * According to the datasheet of some Cypress SLC NANDs,
+		 * the bad block markers can be in the first, second or last
+		 * page of a block. So let's check all three locations.
+		 */
+		chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE |
+				 NAND_BBM_LASTPAGE;
 
 	return 0;
 }
-- 
2.17.1

WARNING: multiple messages have this Message-ID (diff)
From: Schrempf Frieder <frieder.schrempf@kontron.de>
To: "bbrezillon@kernel.org" <bbrezillon@kernel.org>,
	"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
	"richard@nod.at" <richard@nod.at>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Schrempf Frieder <frieder.schrempf@kontron.de>,
	Marek Vasut <marek.vasut@gmail.com>
Subject: [PATCH v4 7/7] mtd: rawnand: AMD: Also use the last page for bad block markers
Date: Mon, 18 Feb 2019 10:42:46 +0000	[thread overview]
Message-ID: <20190218104122.18788-8-frieder.schrempf@kontron.de> (raw)
In-Reply-To: <20190218104122.18788-1-frieder.schrempf@kontron.de>

From: Frieder Schrempf <frieder.schrempf@kontron.de>

According to the datasheet of some Cypress SLC NANDs, the bad
block markers can be in the first, second or last page of a block.
So let's check all three locations.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Boris Brezillon <bbrezillon@kernel.org>
---
 drivers/mtd/nand/raw/nand_amd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/nand_amd.c b/drivers/mtd/nand/raw/nand_amd.c
index 6202cbf7ee8d..2ffcddff3e27 100644
--- a/drivers/mtd/nand/raw/nand_amd.c
+++ b/drivers/mtd/nand/raw/nand_amd.c
@@ -40,7 +40,13 @@ static void amd_nand_decode_id(struct nand_chip *chip)
 static int amd_nand_init(struct nand_chip *chip)
 {
 	if (nand_is_slc(chip))
-		chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
+		/*
+		 * According to the datasheet of some Cypress SLC NANDs,
+		 * the bad block markers can be in the first, second or last
+		 * page of a block. So let's check all three locations.
+		 */
+		chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE |
+				 NAND_BBM_LASTPAGE;
 
 	return 0;
 }
-- 
2.17.1

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2019-02-18 10:43 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 10:42 [PATCH v4 0/7] mtd: rawnand: Support bad block markers in first, second or last page Schrempf Frieder
2019-02-18 10:42 ` Schrempf Frieder
2019-02-18 10:42 ` [PATCH v4 1/7] mtd: rawnand: Always store info about bad block markers in chip struct Schrempf Frieder
2019-02-18 10:42   ` Schrempf Frieder
2019-04-17 10:03   ` Miquel Raynal
2019-04-17 10:03     ` Miquel Raynal
2019-02-18 10:42 ` [PATCH v4 2/7] mtd: onenand: Store bad block marker position " Schrempf Frieder
2019-02-18 10:42   ` Schrempf Frieder
2019-03-04 10:58   ` Miquel Raynal
2019-03-04 10:58     ` Miquel Raynal
2019-03-21  8:47     ` Schrempf Frieder
2019-03-21  8:47       ` Schrempf Frieder
2019-04-17 10:04       ` Miquel Raynal
2019-04-17 10:04         ` Miquel Raynal
2019-02-18 10:42 ` [PATCH v4 3/7] mtd: nand: Cleanup flags and fields for bad block marker position Schrempf Frieder
2019-02-18 10:42   ` Schrempf Frieder
2019-04-17 10:05   ` Miquel Raynal
2019-04-17 10:05     ` Miquel Raynal
2019-02-18 10:42 ` [PATCH v4 4/7] mtd: nand: Make flags for bad block marker position more granular Schrempf Frieder
2019-02-18 10:42   ` Schrempf Frieder
2019-04-17 10:05   ` Miquel Raynal
2019-04-17 10:05     ` Miquel Raynal
2019-02-18 10:42 ` [PATCH v4 5/7] mtd: rawnand: Support bad block markers in first, second or last page Schrempf Frieder
2019-02-18 10:42   ` Schrempf Frieder
2019-03-04 11:21   ` Miquel Raynal
2019-03-04 11:21     ` Miquel Raynal
2019-03-21  9:04     ` Schrempf Frieder
2019-03-21  9:04       ` Schrempf Frieder
2019-02-18 10:42 ` [PATCH v4 6/7] mtd: rawnand: ESMT: Also use the last page for bad block markers Schrempf Frieder
2019-02-18 10:42   ` Schrempf Frieder
2019-04-17 10:08   ` Miquel Raynal
2019-04-17 10:08     ` Miquel Raynal
2019-02-18 10:42 ` Schrempf Frieder [this message]
2019-02-18 10:42   ` [PATCH v4 7/7] mtd: rawnand: AMD: " Schrempf Frieder
2019-04-17 10:08   ` Miquel Raynal
2019-04-17 10:08     ` Miquel Raynal

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=20190218104122.18788-8-frieder.schrempf@kontron.de \
    --to=frieder.schrempf@kontron.de \
    --cc=bbrezillon@kernel.org \
    --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=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.