From: Frieder Schrempf <[email protected]>

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 <[email protected]>
---
 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 890c5b4..aad5f14 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->bbt_options |= NAND_BBT_SCAN2NDPAGE;
+               /*
+                * 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->bbt_options |= NAND_BBT_SCAN2NDPAGE |
+                                    NAND_BBT_SCANLASTPAGE;
 
        return 0;
 }
-- 
2.7.4

Reply via email to