diff options
author | Brian Norris <computersforpeace@gmail.com> | 2013-10-30 00:41:30 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2013-11-07 02:33:14 -0500 |
commit | 5961ad2cb4dd14933889f5219e0d8505669d752d (patch) | |
tree | c6e9ce9741873ff0f3f5111e2de86b9ddbc407a1 /drivers/mtd | |
parent | 9650b9bec61d861b6b59d09eb389410b05d196e4 (diff) |
mtd: nand_bbt: kill NAND_BBT_SCANALLPAGES
Now that the last user of NAND_BBT_SCANALLPAGES has been removed, let's
kill this peculiar BBT feature flag.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index c75b6a7c6ea4..c0615d1526f9 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -412,25 +412,6 @@ static void read_abs_bbts(struct mtd_info *mtd, uint8_t *buf, | |||
412 | } | 412 | } |
413 | } | 413 | } |
414 | 414 | ||
415 | /* Scan a given block full */ | ||
416 | static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd, | ||
417 | loff_t offs, uint8_t *buf, size_t readlen, | ||
418 | int scanlen, int numpages) | ||
419 | { | ||
420 | int ret, j; | ||
421 | |||
422 | ret = scan_read_oob(mtd, buf, offs, readlen); | ||
423 | /* Ignore ECC errors when checking for BBM */ | ||
424 | if (ret && !mtd_is_bitflip_or_eccerr(ret)) | ||
425 | return ret; | ||
426 | |||
427 | for (j = 0; j < numpages; j++, buf += scanlen) { | ||
428 | if (check_pattern(buf, scanlen, mtd->writesize, bd)) | ||
429 | return 1; | ||
430 | } | ||
431 | return 0; | ||
432 | } | ||
433 | |||
434 | /* Scan a given block partially */ | 415 | /* Scan a given block partially */ |
435 | static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd, | 416 | static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd, |
436 | loff_t offs, uint8_t *buf, int numpages) | 417 | loff_t offs, uint8_t *buf, int numpages) |
@@ -477,24 +458,17 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
477 | struct nand_bbt_descr *bd, int chip) | 458 | struct nand_bbt_descr *bd, int chip) |
478 | { | 459 | { |
479 | struct nand_chip *this = mtd->priv; | 460 | struct nand_chip *this = mtd->priv; |
480 | int i, numblocks, numpages, scanlen; | 461 | int i, numblocks, numpages; |
481 | int startblock; | 462 | int startblock; |
482 | loff_t from; | 463 | loff_t from; |
483 | size_t readlen; | ||
484 | 464 | ||
485 | pr_info("Scanning device for bad blocks\n"); | 465 | pr_info("Scanning device for bad blocks\n"); |
486 | 466 | ||
487 | if (bd->options & NAND_BBT_SCANALLPAGES) | 467 | if (bd->options & NAND_BBT_SCAN2NDPAGE) |
488 | numpages = 1 << (this->bbt_erase_shift - this->page_shift); | ||
489 | else if (bd->options & NAND_BBT_SCAN2NDPAGE) | ||
490 | numpages = 2; | 468 | numpages = 2; |
491 | else | 469 | else |
492 | numpages = 1; | 470 | numpages = 1; |
493 | 471 | ||
494 | /* We need only read few bytes from the OOB area */ | ||
495 | scanlen = 0; | ||
496 | readlen = bd->len; | ||
497 | |||
498 | if (chip == -1) { | 472 | if (chip == -1) { |
499 | numblocks = mtd->size >> this->bbt_erase_shift; | 473 | numblocks = mtd->size >> this->bbt_erase_shift; |
500 | startblock = 0; | 474 | startblock = 0; |
@@ -519,12 +493,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
519 | 493 | ||
520 | BUG_ON(bd->options & NAND_BBT_NO_OOB); | 494 | BUG_ON(bd->options & NAND_BBT_NO_OOB); |
521 | 495 | ||
522 | if (bd->options & NAND_BBT_SCANALLPAGES) | 496 | ret = scan_block_fast(mtd, bd, from, buf, numpages); |
523 | ret = scan_block_full(mtd, bd, from, buf, readlen, | ||
524 | scanlen, numpages); | ||
525 | else | ||
526 | ret = scan_block_fast(mtd, bd, from, buf, numpages); | ||
527 | |||
528 | if (ret < 0) | 497 | if (ret < 0) |
529 | return ret; | 498 | return ret; |
530 | 499 | ||