aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/nand_base.c10
-rw-r--r--drivers/mtd/nand/nand_bbt.c5
-rw-r--r--include/linux/mtd/nand.h4
3 files changed, 11 insertions, 8 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index bb2e24b2d6c4..3a9a8fc6a36c 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -344,7 +344,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
344 struct nand_chip *chip = mtd->priv; 344 struct nand_chip *chip = mtd->priv;
345 u16 bad; 345 u16 bad;
346 346
347 if (chip->options & NAND_BBT_SCANLASTPAGE) 347 if (chip->bbt_options & NAND_BBT_SCANLASTPAGE)
348 ofs += mtd->erasesize - mtd->writesize; 348 ofs += mtd->erasesize - mtd->writesize;
349 349
350 page = (int)(ofs >> chip->page_shift) & chip->pagemask; 350 page = (int)(ofs >> chip->page_shift) & chip->pagemask;
@@ -396,7 +396,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
396 uint8_t buf[2] = { 0, 0 }; 396 uint8_t buf[2] = { 0, 0 };
397 int block, ret, i = 0; 397 int block, ret, i = 0;
398 398
399 if (chip->options & NAND_BBT_SCANLASTPAGE) 399 if (chip->bbt_options & NAND_BBT_SCANLASTPAGE)
400 ofs += mtd->erasesize - mtd->writesize; 400 ofs += mtd->erasesize - mtd->writesize;
401 401
402 /* Get block number */ 402 /* Get block number */
@@ -426,7 +426,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
426 426
427 i++; 427 i++;
428 ofs += mtd->writesize; 428 ofs += mtd->writesize;
429 } while (!ret && (chip->options & NAND_BBT_SCAN2NDPAGE) && 429 } while (!ret && (chip->bbt_options & NAND_BBT_SCAN2NDPAGE) &&
430 i < 2); 430 i < 2);
431 431
432 nand_release_device(mtd); 432 nand_release_device(mtd);
@@ -3117,7 +3117,7 @@ ident_done:
3117 if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) && 3117 if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
3118 (*maf_id == NAND_MFR_SAMSUNG || 3118 (*maf_id == NAND_MFR_SAMSUNG ||
3119 *maf_id == NAND_MFR_HYNIX)) 3119 *maf_id == NAND_MFR_HYNIX))
3120 chip->options |= NAND_BBT_SCANLASTPAGE; 3120 chip->bbt_options |= NAND_BBT_SCANLASTPAGE;
3121 else if ((!(chip->cellinfo & NAND_CI_CELLTYPE_MSK) && 3121 else if ((!(chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
3122 (*maf_id == NAND_MFR_SAMSUNG || 3122 (*maf_id == NAND_MFR_SAMSUNG ||
3123 *maf_id == NAND_MFR_HYNIX || 3123 *maf_id == NAND_MFR_HYNIX ||
@@ -3125,7 +3125,7 @@ ident_done:
3125 *maf_id == NAND_MFR_AMD)) || 3125 *maf_id == NAND_MFR_AMD)) ||
3126 (mtd->writesize == 2048 && 3126 (mtd->writesize == 2048 &&
3127 *maf_id == NAND_MFR_MICRON)) 3127 *maf_id == NAND_MFR_MICRON))
3128 chip->options |= NAND_BBT_SCAN2NDPAGE; 3128 chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;
3129 3129
3130 /* Check for AND chips with 4 page planes */ 3130 /* Check for AND chips with 4 page planes */
3131 if (chip->options & NAND_4PAGE_ARRAY) 3131 if (chip->options & NAND_4PAGE_ARRAY)
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 5ffb9a4632ca..5df01d8efd92 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -517,7 +517,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
517 from = (loff_t)startblock << (this->bbt_erase_shift - 1); 517 from = (loff_t)startblock << (this->bbt_erase_shift - 1);
518 } 518 }
519 519
520 if (this->options & NAND_BBT_SCANLASTPAGE) 520 if (this->bbt_options & NAND_BBT_SCANLASTPAGE)
521 from += mtd->erasesize - (mtd->writesize * len); 521 from += mtd->erasesize - (mtd->writesize * len);
522 522
523 for (i = startblock; i < numblocks;) { 523 for (i = startblock; i < numblocks;) {
@@ -1301,7 +1301,6 @@ static struct nand_bbt_descr bbt_mirror_no_bbt_descr = {
1301 .pattern = mirror_pattern 1301 .pattern = mirror_pattern
1302}; 1302};
1303 1303
1304#define BBT_SCAN_OPTIONS (NAND_BBT_SCANLASTPAGE | NAND_BBT_SCAN2NDPAGE)
1305/** 1304/**
1306 * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure 1305 * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure
1307 * @this: NAND chip to create descriptor for 1306 * @this: NAND chip to create descriptor for
@@ -1324,7 +1323,7 @@ static int nand_create_default_bbt_descr(struct nand_chip *this)
1324 printk(KERN_ERR "nand_create_default_bbt_descr: Out of memory\n"); 1323 printk(KERN_ERR "nand_create_default_bbt_descr: Out of memory\n");
1325 return -ENOMEM; 1324 return -ENOMEM;
1326 } 1325 }
1327 bd->options = this->options & BBT_SCAN_OPTIONS; 1326 bd->options = this->bbt_options;
1328 bd->offs = this->badblockpos; 1327 bd->offs = this->badblockpos;
1329 bd->len = (this->options & NAND_BUSWIDTH_16) ? 2 : 1; 1328 bd->len = (this->options & NAND_BUSWIDTH_16) ? 2 : 1;
1330 bd->pattern = scan_ff_pattern; 1329 bd->pattern = scan_ff_pattern;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index c2b9ac4fbc4a..42f70e2d33af 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -449,6 +449,9 @@ struct nand_buffers {
449 * @options: [BOARDSPECIFIC] various chip options. They can partly 449 * @options: [BOARDSPECIFIC] various chip options. They can partly
450 * be set to inform nand_scan about special functionality. 450 * be set to inform nand_scan about special functionality.
451 * See the defines for further explanation. 451 * See the defines for further explanation.
452 * @bbt_options: [INTERN] bad block specific options. All options used
453 * here must come from bbm.h. By default, these options
454 * will be copied to the appropriate nand_bbt_descr's.
452 * @badblockpos: [INTERN] position of the bad block marker in the oob 455 * @badblockpos: [INTERN] position of the bad block marker in the oob
453 * area. 456 * area.
454 * @badblockbits: [INTERN] number of bits to left-shift the bad block 457 * @badblockbits: [INTERN] number of bits to left-shift the bad block
@@ -509,6 +512,7 @@ struct nand_chip {
509 512
510 int chip_delay; 513 int chip_delay;
511 unsigned int options; 514 unsigned int options;
515 unsigned int bbt_options;
512 516
513 int page_shift; 517 int page_shift;
514 int phys_erase_shift; 518 int phys_erase_shift;