mtd: rawnand: ESMT: 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)
It is known that some ESMT SLC NANDs have been shipped
with the factory bad block markers in the first or last page
of the block, instead of the first or second page. To be on
the safe side, 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_esmt.c

index 58646ed663aca564d8c3cd85028e0d6088d73a81..3338c68aaaf12af5c337bb8add06b43b66884085 100644 (file)
@@ -36,7 +36,14 @@ static void esmt_nand_decode_id(struct nand_chip *chip)
 static int esmt_nand_init(struct nand_chip *chip)
 {
        if (nand_is_slc(chip))
-               chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
+               /*
+                * It is known that some ESMT SLC NANDs have been shipped
+                * with the factory bad block markers in the first or last page
+                * of the block, instead of the first or second page. To be on
+                * the safe side, let's check all three locations.
+                */
+               chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE |
+                                NAND_BBM_LASTPAGE;
 
        return 0;
 }