From: Frieder Schrempf Date: Wed, 17 Apr 2019 12:36:37 +0000 (+0000) Subject: mtd: rawnand: AMD: Also use the last page for bad block markers X-Git-Tag: v5.2-rc1~86^2~30^2~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=598dce7068179d49b78d116fcb74422beeb3efd7;p=users%2Fjedix%2Flinux-maple.git 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 Reviewed-by: Boris Brezillon Reviewed-by: Miquel Raynal Signed-off-by: Miquel Raynal --- 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; }