aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bbt.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-05-31 19:31:20 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:01:46 -0400
commita0dc552951dcbb2b28a8a2ffb5fa966613e8c025 (patch)
tree62c71971d00f60fedcb5b265614c8925493877ad /drivers/mtd/nand/nand_bbt.c
parent1c3bd14bb0e10ce69761662d575d454f12070838 (diff)
mtd: nand: remove NAND_BBT_SCANBYTE1AND6 option
This patch reverts most of: commit 58373ff0afff4cc8ac40608872995f4d87eb72ec mtd: nand: more BB Detection refactoring and dynamic scan options According to the discussion at: http://lists.infradead.org/pipermail/linux-mtd/2011-May/035696.html the NAND_BBT_SCANBYTE1AND6 flag, although technically valid, can break some existing ECC layouts that use the 6th byte in the OOB for ECC data. Furthermore, we apparently do not need to scan both bytes 1 and 6 in the OOB region of the devices under consideration; instead, we only need to scan one or the other. Thus, the NAND_BBT_SCANBYTE1AND6 flag is at best unnecessary and at worst a regression. 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.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index ccbeaa1e4a8e..5ffb9a4632ca 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -114,28 +114,6 @@ static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_desc
114 return -1; 114 return -1;
115 } 115 }
116 116
117 /* Check both positions 1 and 6 for pattern? */
118 if (td->options & NAND_BBT_SCANBYTE1AND6) {
119 if (td->options & NAND_BBT_SCANEMPTY) {
120 p += td->len;
121 end += NAND_SMALL_BADBLOCK_POS - td->offs;
122 /* Check region between positions 1 and 6 */
123 for (i = 0; i < NAND_SMALL_BADBLOCK_POS - td->offs - td->len;
124 i++) {
125 if (*p++ != 0xff)
126 return -1;
127 }
128 }
129 else {
130 p += NAND_SMALL_BADBLOCK_POS - td->offs;
131 }
132 /* Compare the pattern */
133 for (i = 0; i < td->len; i++) {
134 if (p[i] != td->pattern[i])
135 return -1;
136 }
137 }
138
139 if (td->options & NAND_BBT_SCANEMPTY) { 117 if (td->options & NAND_BBT_SCANEMPTY) {
140 p += td->len; 118 p += td->len;
141 end += td->len; 119 end += td->len;
@@ -167,13 +145,6 @@ static int check_short_pattern(uint8_t *buf, struct nand_bbt_descr *td)
167 if (p[td->offs + i] != td->pattern[i]) 145 if (p[td->offs + i] != td->pattern[i])
168 return -1; 146 return -1;
169 } 147 }
170 /* Need to check location 1 AND 6? */
171 if (td->options & NAND_BBT_SCANBYTE1AND6) {
172 for (i = 0; i < td->len; i++) {
173 if (p[NAND_SMALL_BADBLOCK_POS + i] != td->pattern[i])
174 return -1;
175 }
176 }
177 return 0; 148 return 0;
178} 149}
179 150
@@ -1330,8 +1301,7 @@ static struct nand_bbt_descr bbt_mirror_no_bbt_descr = {
1330 .pattern = mirror_pattern 1301 .pattern = mirror_pattern
1331}; 1302};
1332 1303
1333#define BBT_SCAN_OPTIONS (NAND_BBT_SCANLASTPAGE | NAND_BBT_SCAN2NDPAGE | \ 1304#define BBT_SCAN_OPTIONS (NAND_BBT_SCANLASTPAGE | NAND_BBT_SCAN2NDPAGE)
1334 NAND_BBT_SCANBYTE1AND6)
1335/** 1305/**
1336 * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure 1306 * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure
1337 * @this: NAND chip to create descriptor for 1307 * @this: NAND chip to create descriptor for