static int amd_nand_init(struct nand_chip *chip)
{
if (nand_is_slc(chip))
- chip->options |= NAND_BBM_SECONDPAGE;
+ chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
return 0;
}
ofs += mtd->erasesize - mtd->writesize;
page = (int)(ofs >> chip->page_shift) & chip->pagemask;
- page_end = page + ((chip->options & NAND_BBM_SECONDPAGE) ? 2 : 1);
+ page_end = page + (((chip->options & NAND_BBM_FIRSTPAGE) &&
+ (chip->options & NAND_BBM_SECONDPAGE)) ? 2 : 1);
for (; page < page_end; page++) {
res = chip->ecc.read_oob(chip, page);
i++;
ofs += mtd->writesize;
- } while ((chip->options & NAND_BBM_SECONDPAGE) && i < 2);
+ } while ((chip->options & NAND_BBM_FIRSTPAGE) &&
+ (chip->options & NAND_BBM_SECONDPAGE) && i < 2);
return ret;
}
pr_info("Scanning device for bad blocks\n");
- if (this->options & NAND_BBM_SECONDPAGE)
+ if ((this->options & NAND_BBM_FIRSTPAGE) &&
+ (this->options & NAND_BBM_SECONDPAGE))
numpages = 2;
else
numpages = 1;
static int esmt_nand_init(struct nand_chip *chip)
{
if (nand_is_slc(chip))
- chip->options |= NAND_BBM_SECONDPAGE;
+ chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
return 0;
}
if (!nand_is_slc(chip))
chip->options |= NAND_BBM_LASTPAGE;
else
- chip->options |= NAND_BBM_SECONDPAGE;
+ chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
hynix = kzalloc(sizeof(*hynix), GFP_KERNEL);
if (!hynix)
static int macronix_nand_init(struct nand_chip *chip)
{
if (nand_is_slc(chip))
- chip->options |= NAND_BBM_SECONDPAGE;
+ chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
macronix_nand_fix_broken_get_timings(chip);
goto err_free_manuf_data;
if (mtd->writesize == 2048)
- chip->options |= NAND_BBM_SECONDPAGE;
+ chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
ondie = micron_supports_on_die_ecc(chip);
if (!nand_is_slc(chip))
chip->options |= NAND_BBM_LASTPAGE;
else
- chip->options |= NAND_BBM_SECONDPAGE;
+ chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
return 0;
}
static int toshiba_nand_init(struct nand_chip *chip)
{
if (nand_is_slc(chip))
- chip->options |= NAND_BBM_SECONDPAGE;
+ chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
/* Check that chip is BENAND and ECC mode is on-die */
if (nand_is_slc(chip) && chip->ecc.mode == NAND_ECC_ON_DIE &&
if (pdata->flcmncr_val & SEL_16BIT)
nand->options |= NAND_BUSWIDTH_16;
- nand->options |= NAND_BBM_SECONDPAGE;
+ nand->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
pm_runtime_enable(&pdev->dev);
pm_runtime_resume(&pdev->dev);
* Position within the block: Each of these pages needs to be checked for a
* bad block marking pattern.
*/
+#define NAND_BBM_FIRSTPAGE 0x01000000
#define NAND_BBM_SECONDPAGE 0x02000000
#define NAND_BBM_LASTPAGE 0x04000000