summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/nand_amd.c
diff options
context:
space:
mode:
authorFrieder Schrempf <frieder.schrempf@kontron.de>2019-04-17 14:36:37 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2019-04-18 08:54:08 +0200
commit598dce7068179d49b78d116fcb74422beeb3efd7 (patch)
treec265e019431f005c50fbb16dc1a61477de80890a /drivers/mtd/nand/raw/nand_amd.c
parentmtd: rawnand: ESMT: Also use the last page for bad block markers (diff)
downloadlinux-598dce7068179d49b78d116fcb74422beeb3efd7.tar.xz
linux-598dce7068179d49b78d116fcb74422beeb3efd7.zip
mtd: rawnand: AMD: Also use the last page for bad block markers
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> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/nand_amd.c')
-rw-r--r--drivers/mtd/nand/raw/nand_amd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/nand_amd.c b/drivers/mtd/nand/raw/nand_amd.c
index 1417559d3057..6217555c19a6 100644
--- a/drivers/mtd/nand/raw/nand_amd.c
+++ b/drivers/mtd/nand/raw/nand_amd.c
@@ -45,7 +45,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;
}