aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bbt.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-05-31 19:31:22 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:01:56 -0400
commita40f73419f02e40555f692785ea1c1813d5b4c12 (patch)
tree81f3eeb517d6480d8535ac769202eb8e26de53c4 /drivers/mtd/nand/nand_bbt.c
parent5fb1549dfc40f3b589dae560ea21535cdc5f64e0 (diff)
mtd: nand: consolidate redundant flash-based BBT flags
This patch works with the following three flags from two headers (nand.h and bbm.h): (1) NAND_USE_FLASH_BBT (nand.h) (2) NAND_USE_FLASH_BBT_NO_OOB (nand.h) (3) NAND_BBT_NO_OOB (bbm.h) These flags are all related and interdependent, yet they were in different headers. Flag (2) is simply the combination of (1) and (3) and can be eliminated. This patch accomplishes the following: * eliminate NAND_USE_FLASH_BBT_NO_OOB (i.e., flag (2)) * move NAND_USE_FLASH_BBT (i.e., flag (1)) to bbm.h It's important to note that because (1) and (3) are now both found in bbm.h, they should NOT be used in the "nand_chip.options" field. I removed a small section from the mtdnand DocBook because it referes to NAND_USE_FLASH_BBT in nand.h, which has been moved to bbm.h. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r--drivers/mtd/nand/nand_bbt.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 5df01d8efd92..66f93e2ac16b 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -36,9 +36,9 @@
36 * The table is marked in the OOB area with an ident pattern and a version 36 * The table is marked in the OOB area with an ident pattern and a version
37 * number which indicates which of both tables is more up to date. If the NAND 37 * number which indicates which of both tables is more up to date. If the NAND
38 * controller needs the complete OOB area for the ECC information then the 38 * controller needs the complete OOB area for the ECC information then the
39 * option NAND_USE_FLASH_BBT_NO_OOB should be used: it moves the ident pattern 39 * option NAND_BBT_NO_OOB should be used (along with NAND_USE_FLASH_BBT, of
40 * and the version byte into the data area and the OOB area will remain 40 * course): it moves the ident pattern and the version byte into the data area
41 * untouched. 41 * and the OOB area will remain untouched.
42 * 42 *
43 * The table uses 2 bits per block 43 * The table uses 2 bits per block
44 * 11b: block is good 44 * 11b: block is good
@@ -1082,16 +1082,16 @@ static void verify_bbt_descr(struct mtd_info *mtd, struct nand_bbt_descr *bd)
1082 pattern_len = bd->len; 1082 pattern_len = bd->len;
1083 bits = bd->options & NAND_BBT_NRBITS_MSK; 1083 bits = bd->options & NAND_BBT_NRBITS_MSK;
1084 1084
1085 BUG_ON((this->options & NAND_USE_FLASH_BBT_NO_OOB) && 1085 BUG_ON((this->bbt_options & NAND_BBT_NO_OOB) &&
1086 !(this->options & NAND_USE_FLASH_BBT)); 1086 !(this->bbt_options & NAND_USE_FLASH_BBT));
1087 BUG_ON(!bits); 1087 BUG_ON(!bits);
1088 1088
1089 if (bd->options & NAND_BBT_VERSION) 1089 if (bd->options & NAND_BBT_VERSION)
1090 pattern_len++; 1090 pattern_len++;
1091 1091
1092 if (bd->options & NAND_BBT_NO_OOB) { 1092 if (bd->options & NAND_BBT_NO_OOB) {
1093 BUG_ON(!(this->options & NAND_USE_FLASH_BBT)); 1093 BUG_ON(!(this->bbt_options & NAND_USE_FLASH_BBT));
1094 BUG_ON(!(this->options & NAND_USE_FLASH_BBT_NO_OOB)); 1094 BUG_ON(!(this->bbt_options & NAND_BBT_NO_OOB));
1095 BUG_ON(bd->offs); 1095 BUG_ON(bd->offs);
1096 if (bd->options & NAND_BBT_VERSION) 1096 if (bd->options & NAND_BBT_VERSION)
1097 BUG_ON(bd->veroffs != bd->len); 1097 BUG_ON(bd->veroffs != bd->len);
@@ -1357,15 +1357,15 @@ int nand_default_bbt(struct mtd_info *mtd)
1357 this->bbt_td = &bbt_main_descr; 1357 this->bbt_td = &bbt_main_descr;
1358 this->bbt_md = &bbt_mirror_descr; 1358 this->bbt_md = &bbt_mirror_descr;
1359 } 1359 }
1360 this->options |= NAND_USE_FLASH_BBT; 1360 this->bbt_options |= NAND_USE_FLASH_BBT;
1361 return nand_scan_bbt(mtd, &agand_flashbased); 1361 return nand_scan_bbt(mtd, &agand_flashbased);
1362 } 1362 }
1363 1363
1364 /* Is a flash based bad block table requested ? */ 1364 /* Is a flash based bad block table requested ? */
1365 if (this->options & NAND_USE_FLASH_BBT) { 1365 if (this->bbt_options & NAND_USE_FLASH_BBT) {
1366 /* Use the default pattern descriptors */ 1366 /* Use the default pattern descriptors */
1367 if (!this->bbt_td) { 1367 if (!this->bbt_td) {
1368 if (this->options & NAND_USE_FLASH_BBT_NO_OOB) { 1368 if (this->bbt_options & NAND_BBT_NO_OOB) {
1369 this->bbt_td = &bbt_main_no_bbt_descr; 1369 this->bbt_td = &bbt_main_no_bbt_descr;
1370 this->bbt_md = &bbt_mirror_no_bbt_descr; 1370 this->bbt_md = &bbt_mirror_no_bbt_descr;
1371 } else { 1371 } else {