diff options
| author | Brian Norris <computersforpeace@gmail.com> | 2013-07-30 20:53:00 -0400 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2013-08-30 11:48:37 -0400 |
| commit | dad2256269cb2ee3a72baefc5eb6e02ae1de2cfe (patch) | |
| tree | 03c8fcf44feffb85f3d37af3a21b71caa48dcce9 | |
| parent | b32843b772db6024336e36c39359d8edc3b416ab (diff) | |
mtd: nand: remove NAND_BBT_SCANEMPTY
NAND_BBT_SCANEMPTY is a strange, badly-supported option with omap as its
single remaining user.
NAND_BBT_SCANEMPTY was likely used by accident in omap2[1]. And anyway,
omap2 doesn't scan the chip for bad blocks (courtesy of
NAND_SKIP_BBTSCAN), and so its use of this option is irrelevant.
This patch drops the NAND_BBT_SCANEMPTY option.
[1] http://lists.infradead.org/pipermail/linux-mtd/2012-July/042902.html
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Ivan Djelic <ivan.djelic@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
| -rw-r--r-- | Documentation/DocBook/mtdnand.tmpl | 2 | ||||
| -rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 33 | ||||
| -rw-r--r-- | drivers/mtd/nand/omap2.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/onenand/onenand_bbt.c | 1 | ||||
| -rw-r--r-- | include/linux/mtd/bbm.h | 2 |
5 files changed, 6 insertions, 34 deletions
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl index fe122d6e686f..a248f42a121e 100644 --- a/Documentation/DocBook/mtdnand.tmpl +++ b/Documentation/DocBook/mtdnand.tmpl | |||
| @@ -1224,8 +1224,6 @@ in this page</entry> | |||
| 1224 | #define NAND_BBT_CREATE 0x00000200 | 1224 | #define NAND_BBT_CREATE 0x00000200 |
| 1225 | /* Search good / bad pattern through all pages of a block */ | 1225 | /* Search good / bad pattern through all pages of a block */ |
| 1226 | #define NAND_BBT_SCANALLPAGES 0x00000400 | 1226 | #define NAND_BBT_SCANALLPAGES 0x00000400 |
| 1227 | /* Scan block empty during good / bad block scan */ | ||
| 1228 | #define NAND_BBT_SCANEMPTY 0x00000800 | ||
| 1229 | /* Write bbt if neccecary */ | 1227 | /* Write bbt if neccecary */ |
| 1230 | #define NAND_BBT_WRITE 0x00001000 | 1228 | #define NAND_BBT_WRITE 0x00001000 |
| 1231 | /* Read and write back block contents when writing bbt */ | 1229 | /* Read and write back block contents when writing bbt */ |
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index ae3fb58591cf..bc06196d5739 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
| @@ -110,33 +110,17 @@ static int check_pattern_no_oob(uint8_t *buf, struct nand_bbt_descr *td) | |||
| 110 | * @td: search pattern descriptor | 110 | * @td: search pattern descriptor |
| 111 | * | 111 | * |
| 112 | * Check for a pattern at the given place. Used to search bad block tables and | 112 | * Check for a pattern at the given place. Used to search bad block tables and |
| 113 | * good / bad block identifiers. If the SCAN_EMPTY option is set then check, if | 113 | * good / bad block identifiers. |
| 114 | * all bytes except the pattern area contain 0xff. | ||
| 115 | */ | 114 | */ |
| 116 | static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td) | 115 | static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td) |
| 117 | { | 116 | { |
| 118 | int end = 0; | ||
| 119 | uint8_t *p = buf; | ||
| 120 | |||
| 121 | if (td->options & NAND_BBT_NO_OOB) | 117 | if (td->options & NAND_BBT_NO_OOB) |
| 122 | return check_pattern_no_oob(buf, td); | 118 | return check_pattern_no_oob(buf, td); |
| 123 | 119 | ||
| 124 | end = paglen + td->offs; | ||
| 125 | if (td->options & NAND_BBT_SCANEMPTY) | ||
| 126 | if (memchr_inv(p, 0xff, end)) | ||
| 127 | return -1; | ||
| 128 | p += end; | ||
| 129 | |||
| 130 | /* Compare the pattern */ | 120 | /* Compare the pattern */ |
| 131 | if (memcmp(p, td->pattern, td->len)) | 121 | if (memcmp(buf + paglen + td->offs, td->pattern, td->len)) |
| 132 | return -1; | 122 | return -1; |
| 133 | 123 | ||
| 134 | if (td->options & NAND_BBT_SCANEMPTY) { | ||
| 135 | p += td->len; | ||
| 136 | end += td->len; | ||
| 137 | if (memchr_inv(p, 0xff, len - end)) | ||
| 138 | return -1; | ||
| 139 | } | ||
| 140 | return 0; | 124 | return 0; |
| 141 | } | 125 | } |
| 142 | 126 | ||
| @@ -507,15 +491,9 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
| 507 | else | 491 | else |
| 508 | numpages = 1; | 492 | numpages = 1; |
| 509 | 493 | ||
| 510 | if (!(bd->options & NAND_BBT_SCANEMPTY)) { | 494 | /* We need only read few bytes from the OOB area */ |
| 511 | /* We need only read few bytes from the OOB area */ | 495 | scanlen = 0; |
| 512 | scanlen = 0; | 496 | readlen = bd->len; |
| 513 | readlen = bd->len; | ||
| 514 | } else { | ||
| 515 | /* Full page content should be read */ | ||
| 516 | scanlen = mtd->writesize + mtd->oobsize; | ||
| 517 | readlen = numpages * mtd->writesize; | ||
| 518 | } | ||
| 519 | 497 | ||
| 520 | if (chip == -1) { | 498 | if (chip == -1) { |
| 521 | numblocks = mtd->size >> this->bbt_erase_shift; | 499 | numblocks = mtd->size >> this->bbt_erase_shift; |
| @@ -882,7 +860,6 @@ static inline int nand_memory_bbt(struct mtd_info *mtd, struct nand_bbt_descr *b | |||
| 882 | { | 860 | { |
| 883 | struct nand_chip *this = mtd->priv; | 861 | struct nand_chip *this = mtd->priv; |
| 884 | 862 | ||
| 885 | bd->options &= ~NAND_BBT_SCANEMPTY; | ||
| 886 | return create_bbt(mtd, this->buffers->databuf, bd, -1); | 863 | return create_bbt(mtd, this->buffers->databuf, bd, -1); |
| 887 | } | 864 | } |
| 888 | 865 | ||
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index daa3dfc2bda8..cb40f87ee93c 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
| @@ -154,7 +154,7 @@ static struct nand_ecclayout omap_oobinfo; | |||
| 154 | */ | 154 | */ |
| 155 | static uint8_t scan_ff_pattern[] = { 0xff }; | 155 | static uint8_t scan_ff_pattern[] = { 0xff }; |
| 156 | static struct nand_bbt_descr bb_descrip_flashbased = { | 156 | static struct nand_bbt_descr bb_descrip_flashbased = { |
| 157 | .options = NAND_BBT_SCANEMPTY | NAND_BBT_SCANALLPAGES, | 157 | .options = NAND_BBT_SCANALLPAGES, |
| 158 | .offs = 0, | 158 | .offs = 0, |
| 159 | .len = 1, | 159 | .len = 1, |
| 160 | .pattern = scan_ff_pattern, | 160 | .pattern = scan_ff_pattern, |
diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c index 66fe3b7e7851..08d0085f3e93 100644 --- a/drivers/mtd/onenand/onenand_bbt.c +++ b/drivers/mtd/onenand/onenand_bbt.c | |||
| @@ -133,7 +133,6 @@ static inline int onenand_memory_bbt (struct mtd_info *mtd, struct nand_bbt_desc | |||
| 133 | { | 133 | { |
| 134 | struct onenand_chip *this = mtd->priv; | 134 | struct onenand_chip *this = mtd->priv; |
| 135 | 135 | ||
| 136 | bd->options &= ~NAND_BBT_SCANEMPTY; | ||
| 137 | return create_bbt(mtd, this->page_buf, bd, -1); | 136 | return create_bbt(mtd, this->page_buf, bd, -1); |
| 138 | } | 137 | } |
| 139 | 138 | ||
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 211ff67e8b0d..95fc482cef36 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
| @@ -93,8 +93,6 @@ struct nand_bbt_descr { | |||
| 93 | #define NAND_BBT_CREATE_EMPTY 0x00000400 | 93 | #define NAND_BBT_CREATE_EMPTY 0x00000400 |
| 94 | /* Search good / bad pattern through all pages of a block */ | 94 | /* Search good / bad pattern through all pages of a block */ |
| 95 | #define NAND_BBT_SCANALLPAGES 0x00000800 | 95 | #define NAND_BBT_SCANALLPAGES 0x00000800 |
| 96 | /* Scan block empty during good / bad block scan */ | ||
| 97 | #define NAND_BBT_SCANEMPTY 0x00001000 | ||
| 98 | /* Write bbt if neccecary */ | 96 | /* Write bbt if neccecary */ |
| 99 | #define NAND_BBT_WRITE 0x00002000 | 97 | #define NAND_BBT_WRITE 0x00002000 |
| 100 | /* Read and write back block contents when writing bbt */ | 98 | /* Read and write back block contents when writing bbt */ |
