mtd: rawnand: AMD: Also use the last page for bad block markers
authorFrieder Schrempf <frieder.schrempf@kontron.de>
Wed, 17 Apr 2019 12:36:37 +0000 (12:36 +0000)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 18 Apr 2019 06:54:08 +0000 (08:54 +0200)
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>
drivers/mtd/nand/raw/nand_amd.c

index 1417559d30578b9c9a891931b61198ed8478940b..6217555c19a6b95da0fae8a717a5f3012645d1fe 100644 (file)
@@ -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;
 }