aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bbt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r--drivers/mtd/nand/nand_bbt.c263
1 files changed, 131 insertions, 132 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index ccc48a4a6ad0..9adc6d62332a 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -48,7 +48,7 @@
48 * 48 *
49 * Following assumptions are made: 49 * Following assumptions are made:
50 * - bbts start at a page boundary, if autolocated on a block boundary 50 * - bbts start at a page boundary, if autolocated on a block boundary
51 * - the space neccecary for a bbt in FLASH does not exceed a block boundary 51 * - the space necessary for a bbt in FLASH does not exceed a block boundary
52 * 52 *
53 */ 53 */
54 54
@@ -75,7 +75,7 @@
75 * pattern area contain 0xff 75 * pattern area contain 0xff
76 * 76 *
77*/ 77*/
78static int check_pattern (uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td) 78static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td)
79{ 79{
80 int i, end = 0; 80 int i, end = 0;
81 uint8_t *p = buf; 81 uint8_t *p = buf;
@@ -116,7 +116,7 @@ static int check_pattern (uint8_t *buf, int len, int paglen, struct nand_bbt_des
116 * no optional empty check 116 * no optional empty check
117 * 117 *
118*/ 118*/
119static int check_short_pattern (uint8_t *buf, struct nand_bbt_descr *td) 119static int check_short_pattern(uint8_t *buf, struct nand_bbt_descr *td)
120{ 120{
121 int i; 121 int i;
122 uint8_t *p = buf; 122 uint8_t *p = buf;
@@ -142,8 +142,8 @@ static int check_short_pattern (uint8_t *buf, struct nand_bbt_descr *td)
142 * Read the bad block table starting from page. 142 * Read the bad block table starting from page.
143 * 143 *
144 */ 144 */
145static int read_bbt (struct mtd_info *mtd, uint8_t *buf, int page, int num, 145static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
146 int bits, int offs, int reserved_block_code) 146 int bits, int offs, int reserved_block_code)
147{ 147{
148 int res, i, j, act = 0; 148 int res, i, j, act = 0;
149 struct nand_chip *this = mtd->priv; 149 struct nand_chip *this = mtd->priv;
@@ -152,17 +152,17 @@ static int read_bbt (struct mtd_info *mtd, uint8_t *buf, int page, int num,
152 uint8_t msk = (uint8_t) ((1 << bits) - 1); 152 uint8_t msk = (uint8_t) ((1 << bits) - 1);
153 153
154 totlen = (num * bits) >> 3; 154 totlen = (num * bits) >> 3;
155 from = ((loff_t)page) << this->page_shift; 155 from = ((loff_t) page) << this->page_shift;
156 156
157 while (totlen) { 157 while (totlen) {
158 len = min (totlen, (size_t) (1 << this->bbt_erase_shift)); 158 len = min(totlen, (size_t) (1 << this->bbt_erase_shift));
159 res = mtd->read_ecc (mtd, from, len, &retlen, buf, NULL, this->autooob); 159 res = mtd->read_ecc(mtd, from, len, &retlen, buf, NULL, this->autooob);
160 if (res < 0) { 160 if (res < 0) {
161 if (retlen != len) { 161 if (retlen != len) {
162 printk (KERN_INFO "nand_bbt: Error reading bad block table\n"); 162 printk(KERN_INFO "nand_bbt: Error reading bad block table\n");
163 return res; 163 return res;
164 } 164 }
165 printk (KERN_WARNING "nand_bbt: ECC error while reading bad block table\n"); 165 printk(KERN_WARNING "nand_bbt: ECC error while reading bad block table\n");
166 } 166 }
167 167
168 /* Analyse data */ 168 /* Analyse data */
@@ -172,17 +172,16 @@ static int read_bbt (struct mtd_info *mtd, uint8_t *buf, int page, int num,
172 uint8_t tmp = (dat >> j) & msk; 172 uint8_t tmp = (dat >> j) & msk;
173 if (tmp == msk) 173 if (tmp == msk)
174 continue; 174 continue;
175 if (reserved_block_code && 175 if (reserved_block_code && (tmp == reserved_block_code)) {
176 (tmp == reserved_block_code)) { 176 printk(KERN_DEBUG "nand_read_bbt: Reserved block at 0x%08x\n",
177 printk (KERN_DEBUG "nand_read_bbt: Reserved block at 0x%08x\n", 177 ((offs << 2) + (act >> 1)) << this->bbt_erase_shift);
178 ((offs << 2) + (act >> 1)) << this->bbt_erase_shift);
179 this->bbt[offs + (act >> 3)] |= 0x2 << (act & 0x06); 178 this->bbt[offs + (act >> 3)] |= 0x2 << (act & 0x06);
180 continue; 179 continue;
181 } 180 }
182 /* Leave it for now, if its matured we can move this 181 /* Leave it for now, if its matured we can move this
183 * message to MTD_DEBUG_LEVEL0 */ 182 * message to MTD_DEBUG_LEVEL0 */
184 printk (KERN_DEBUG "nand_read_bbt: Bad block at 0x%08x\n", 183 printk(KERN_DEBUG "nand_read_bbt: Bad block at 0x%08x\n",
185 ((offs << 2) + (act >> 1)) << this->bbt_erase_shift); 184 ((offs << 2) + (act >> 1)) << this->bbt_erase_shift);
186 /* Factory marked bad or worn out ? */ 185 /* Factory marked bad or worn out ? */
187 if (tmp == 0) 186 if (tmp == 0)
188 this->bbt[offs + (act >> 3)] |= 0x3 << (act & 0x06); 187 this->bbt[offs + (act >> 3)] |= 0x3 << (act & 0x06);
@@ -207,7 +206,7 @@ static int read_bbt (struct mtd_info *mtd, uint8_t *buf, int page, int num,
207 * Read the bad block table for all chips starting at a given page 206 * Read the bad block table for all chips starting at a given page
208 * We assume that the bbt bits are in consecutive order. 207 * We assume that the bbt bits are in consecutive order.
209*/ 208*/
210static int read_abs_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td, int chip) 209static int read_abs_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td, int chip)
211{ 210{
212 struct nand_chip *this = mtd->priv; 211 struct nand_chip *this = mtd->priv;
213 int res = 0, i; 212 int res = 0, i;
@@ -242,23 +241,22 @@ static int read_abs_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_des
242 * We assume that the bbt bits are in consecutive order. 241 * We assume that the bbt bits are in consecutive order.
243 * 242 *
244*/ 243*/
245static int read_abs_bbts (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td, 244static int read_abs_bbts(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td, struct nand_bbt_descr *md)
246 struct nand_bbt_descr *md)
247{ 245{
248 struct nand_chip *this = mtd->priv; 246 struct nand_chip *this = mtd->priv;
249 247
250 /* Read the primary version, if available */ 248 /* Read the primary version, if available */
251 if (td->options & NAND_BBT_VERSION) { 249 if (td->options & NAND_BBT_VERSION) {
252 nand_read_raw (mtd, buf, td->pages[0] << this->page_shift, mtd->oobblock, mtd->oobsize); 250 nand_read_raw(mtd, buf, td->pages[0] << this->page_shift, mtd->oobblock, mtd->oobsize);
253 td->version[0] = buf[mtd->oobblock + td->veroffs]; 251 td->version[0] = buf[mtd->oobblock + td->veroffs];
254 printk (KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", td->pages[0], td->version[0]); 252 printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", td->pages[0], td->version[0]);
255 } 253 }
256 254
257 /* Read the mirror version, if available */ 255 /* Read the mirror version, if available */
258 if (md && (md->options & NAND_BBT_VERSION)) { 256 if (md && (md->options & NAND_BBT_VERSION)) {
259 nand_read_raw (mtd, buf, md->pages[0] << this->page_shift, mtd->oobblock, mtd->oobsize); 257 nand_read_raw(mtd, buf, md->pages[0] << this->page_shift, mtd->oobblock, mtd->oobsize);
260 md->version[0] = buf[mtd->oobblock + md->veroffs]; 258 md->version[0] = buf[mtd->oobblock + md->veroffs];
261 printk (KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", md->pages[0], md->version[0]); 259 printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", md->pages[0], md->version[0]);
262 } 260 }
263 261
264 return 1; 262 return 1;
@@ -275,7 +273,7 @@ static int read_abs_bbts (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_de
275 * Create a bad block table by scanning the device 273 * Create a bad block table by scanning the device
276 * for the given good/bad block identify pattern 274 * for the given good/bad block identify pattern
277 */ 275 */
278static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd, int chip) 276static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd, int chip)
279{ 277{
280 struct nand_chip *this = mtd->priv; 278 struct nand_chip *this = mtd->priv;
281 int i, j, numblocks, len, scanlen; 279 int i, j, numblocks, len, scanlen;
@@ -283,7 +281,7 @@ static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
283 loff_t from; 281 loff_t from;
284 size_t readlen, ooblen; 282 size_t readlen, ooblen;
285 283
286 printk (KERN_INFO "Scanning device for bad blocks\n"); 284 printk(KERN_INFO "Scanning device for bad blocks\n");
287 285
288 if (bd->options & NAND_BBT_SCANALLPAGES) 286 if (bd->options & NAND_BBT_SCANALLPAGES)
289 len = 1 << (this->bbt_erase_shift - this->page_shift); 287 len = 1 << (this->bbt_erase_shift - this->page_shift);
@@ -300,7 +298,7 @@ static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
300 readlen = bd->len; 298 readlen = bd->len;
301 } else { 299 } else {
302 /* Full page content should be read */ 300 /* Full page content should be read */
303 scanlen = mtd->oobblock + mtd->oobsize; 301 scanlen = mtd->oobblock + mtd->oobsize;
304 readlen = len * mtd->oobblock; 302 readlen = len * mtd->oobblock;
305 ooblen = len * mtd->oobsize; 303 ooblen = len * mtd->oobsize;
306 } 304 }
@@ -313,8 +311,8 @@ static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
313 from = 0; 311 from = 0;
314 } else { 312 } else {
315 if (chip >= this->numchips) { 313 if (chip >= this->numchips) {
316 printk (KERN_WARNING "create_bbt(): chipnr (%d) > available chips (%d)\n", 314 printk(KERN_WARNING "create_bbt(): chipnr (%d) > available chips (%d)\n",
317 chip + 1, this->numchips); 315 chip + 1, this->numchips);
318 return -EINVAL; 316 return -EINVAL;
319 } 317 }
320 numblocks = this->chipsize >> (this->bbt_erase_shift - 1); 318 numblocks = this->chipsize >> (this->bbt_erase_shift - 1);
@@ -327,7 +325,7 @@ static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
327 int ret; 325 int ret;
328 326
329 if (bd->options & NAND_BBT_SCANEMPTY) 327 if (bd->options & NAND_BBT_SCANEMPTY)
330 if ((ret = nand_read_raw (mtd, buf, from, readlen, ooblen))) 328 if ((ret = nand_read_raw(mtd, buf, from, readlen, ooblen)))
331 return ret; 329 return ret;
332 330
333 for (j = 0; j < len; j++) { 331 for (j = 0; j < len; j++) {
@@ -336,22 +334,21 @@ static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
336 334
337 /* Read the full oob until read_oob is fixed to 335 /* Read the full oob until read_oob is fixed to
338 * handle single byte reads for 16 bit buswidth */ 336 * handle single byte reads for 16 bit buswidth */
339 ret = mtd->read_oob(mtd, from + j * mtd->oobblock, 337 ret = mtd->read_oob(mtd, from + j * mtd->oobblock, mtd->oobsize, &retlen, buf);
340 mtd->oobsize, &retlen, buf);
341 if (ret) 338 if (ret)
342 return ret; 339 return ret;
343 340
344 if (check_short_pattern (buf, bd)) { 341 if (check_short_pattern(buf, bd)) {
345 this->bbt[i >> 3] |= 0x03 << (i & 0x6); 342 this->bbt[i >> 3] |= 0x03 << (i & 0x6);
346 printk (KERN_WARNING "Bad eraseblock %d at 0x%08x\n", 343 printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
347 i >> 1, (unsigned int) from); 344 i >> 1, (unsigned int)from);
348 break; 345 break;
349 } 346 }
350 } else { 347 } else {
351 if (check_pattern (&buf[j * scanlen], scanlen, mtd->oobblock, bd)) { 348 if (check_pattern(&buf[j * scanlen], scanlen, mtd->oobblock, bd)) {
352 this->bbt[i >> 3] |= 0x03 << (i & 0x6); 349 this->bbt[i >> 3] |= 0x03 << (i & 0x6);
353 printk (KERN_WARNING "Bad eraseblock %d at 0x%08x\n", 350 printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
354 i >> 1, (unsigned int) from); 351 i >> 1, (unsigned int)from);
355 break; 352 break;
356 } 353 }
357 } 354 }
@@ -374,12 +371,12 @@ static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
374 * block. 371 * block.
375 * If the option NAND_BBT_PERCHIP is given, each chip is searched 372 * If the option NAND_BBT_PERCHIP is given, each chip is searched
376 * for a bbt, which contains the bad block information of this chip. 373 * for a bbt, which contains the bad block information of this chip.
377 * This is neccecary to provide support for certain DOC devices. 374 * This is necessary to provide support for certain DOC devices.
378 * 375 *
379 * The bbt ident pattern resides in the oob area of the first page 376 * The bbt ident pattern resides in the oob area of the first page
380 * in a block. 377 * in a block.
381 */ 378 */
382static int search_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td) 379static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *td)
383{ 380{
384 struct nand_chip *this = mtd->priv; 381 struct nand_chip *this = mtd->priv;
385 int i, chips; 382 int i, chips;
@@ -389,7 +386,7 @@ static int search_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
389 386
390 /* Search direction top -> down ? */ 387 /* Search direction top -> down ? */
391 if (td->options & NAND_BBT_LASTBLOCK) { 388 if (td->options & NAND_BBT_LASTBLOCK) {
392 startblock = (mtd->size >> this->bbt_erase_shift) -1; 389 startblock = (mtd->size >> this->bbt_erase_shift) - 1;
393 dir = -1; 390 dir = -1;
394 } else { 391 } else {
395 startblock = 0; 392 startblock = 0;
@@ -417,7 +414,7 @@ static int search_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
417 for (block = 0; block < td->maxblocks; block++) { 414 for (block = 0; block < td->maxblocks; block++) {
418 int actblock = startblock + dir * block; 415 int actblock = startblock + dir * block;
419 /* Read first page */ 416 /* Read first page */
420 nand_read_raw (mtd, buf, actblock << this->bbt_erase_shift, mtd->oobblock, mtd->oobsize); 417 nand_read_raw(mtd, buf, actblock << this->bbt_erase_shift, mtd->oobblock, mtd->oobsize);
421 if (!check_pattern(buf, scanlen, mtd->oobblock, td)) { 418 if (!check_pattern(buf, scanlen, mtd->oobblock, td)) {
422 td->pages[i] = actblock << (this->bbt_erase_shift - this->page_shift); 419 td->pages[i] = actblock << (this->bbt_erase_shift - this->page_shift);
423 if (td->options & NAND_BBT_VERSION) { 420 if (td->options & NAND_BBT_VERSION) {
@@ -431,9 +428,10 @@ static int search_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
431 /* Check, if we found a bbt for each requested chip */ 428 /* Check, if we found a bbt for each requested chip */
432 for (i = 0; i < chips; i++) { 429 for (i = 0; i < chips; i++) {
433 if (td->pages[i] == -1) 430 if (td->pages[i] == -1)
434 printk (KERN_WARNING "Bad block table not found for chip %d\n", i); 431 printk(KERN_WARNING "Bad block table not found for chip %d\n", i);
435 else 432 else
436 printk (KERN_DEBUG "Bad block table found at page %d, version 0x%02X\n", td->pages[i], td->version[i]); 433 printk(KERN_DEBUG "Bad block table found at page %d, version 0x%02X\n", td->pages[i],
434 td->version[i]);
437 } 435 }
438 return 0; 436 return 0;
439} 437}
@@ -447,21 +445,19 @@ static int search_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
447 * 445 *
448 * Search and read the bad block table(s) 446 * Search and read the bad block table(s)
449*/ 447*/
450static int search_read_bbts (struct mtd_info *mtd, uint8_t *buf, 448static int search_read_bbts(struct mtd_info *mtd, uint8_t * buf, struct nand_bbt_descr *td, struct nand_bbt_descr *md)
451 struct nand_bbt_descr *td, struct nand_bbt_descr *md)
452{ 449{
453 /* Search the primary table */ 450 /* Search the primary table */
454 search_bbt (mtd, buf, td); 451 search_bbt(mtd, buf, td);
455 452
456 /* Search the mirror table */ 453 /* Search the mirror table */
457 if (md) 454 if (md)
458 search_bbt (mtd, buf, md); 455 search_bbt(mtd, buf, md);
459 456
460 /* Force result check */ 457 /* Force result check */
461 return 1; 458 return 1;
462} 459}
463 460
464
465/** 461/**
466 * write_bbt - [GENERIC] (Re)write the bad block table 462 * write_bbt - [GENERIC] (Re)write the bad block table
467 * 463 *
@@ -474,8 +470,8 @@ static int search_read_bbts (struct mtd_info *mtd, uint8_t *buf,
474 * (Re)write the bad block table 470 * (Re)write the bad block table
475 * 471 *
476*/ 472*/
477static int write_bbt (struct mtd_info *mtd, uint8_t *buf, 473static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
478 struct nand_bbt_descr *td, struct nand_bbt_descr *md, int chipsel) 474 struct nand_bbt_descr *td, struct nand_bbt_descr *md, int chipsel)
479{ 475{
480 struct nand_chip *this = mtd->priv; 476 struct nand_chip *this = mtd->priv;
481 struct nand_oobinfo oobinfo; 477 struct nand_oobinfo oobinfo;
@@ -492,7 +488,7 @@ static int write_bbt (struct mtd_info *mtd, uint8_t *buf,
492 rcode = 0xff; 488 rcode = 0xff;
493 /* Write bad block table per chip rather than per device ? */ 489 /* Write bad block table per chip rather than per device ? */
494 if (td->options & NAND_BBT_PERCHIP) { 490 if (td->options & NAND_BBT_PERCHIP) {
495 numblocks = (int) (this->chipsize >> this->bbt_erase_shift); 491 numblocks = (int)(this->chipsize >> this->bbt_erase_shift);
496 /* Full device write or specific chip ? */ 492 /* Full device write or specific chip ? */
497 if (chipsel == -1) { 493 if (chipsel == -1) {
498 nrchips = this->numchips; 494 nrchips = this->numchips;
@@ -501,7 +497,7 @@ static int write_bbt (struct mtd_info *mtd, uint8_t *buf,
501 chip = chipsel; 497 chip = chipsel;
502 } 498 }
503 } else { 499 } else {
504 numblocks = (int) (mtd->size >> this->bbt_erase_shift); 500 numblocks = (int)(mtd->size >> this->bbt_erase_shift);
505 nrchips = 1; 501 nrchips = 1;
506 } 502 }
507 503
@@ -540,9 +536,9 @@ static int write_bbt (struct mtd_info *mtd, uint8_t *buf,
540 if (!md || md->pages[chip] != page) 536 if (!md || md->pages[chip] != page)
541 goto write; 537 goto write;
542 } 538 }
543 printk (KERN_ERR "No space left to write bad block table\n"); 539 printk(KERN_ERR "No space left to write bad block table\n");
544 return -ENOSPC; 540 return -ENOSPC;
545write: 541 write:
546 542
547 /* Set up shift count and masks for the flash table */ 543 /* Set up shift count and masks for the flash table */
548 bits = td->options & NAND_BBT_NRBITS_MSK; 544 bits = td->options & NAND_BBT_NRBITS_MSK;
@@ -558,7 +554,7 @@ write:
558 554
559 to = ((loff_t) page) << this->page_shift; 555 to = ((loff_t) page) << this->page_shift;
560 556
561 memcpy (&oobinfo, this->autooob, sizeof(oobinfo)); 557 memcpy(&oobinfo, this->autooob, sizeof(oobinfo));
562 oobinfo.useecc = MTD_NANDECC_PLACEONLY; 558 oobinfo.useecc = MTD_NANDECC_PLACEONLY;
563 559
564 /* Must we save the block contents ? */ 560 /* Must we save the block contents ? */
@@ -566,22 +562,23 @@ write:
566 /* Make it block aligned */ 562 /* Make it block aligned */
567 to &= ~((loff_t) ((1 << this->bbt_erase_shift) - 1)); 563 to &= ~((loff_t) ((1 << this->bbt_erase_shift) - 1));
568 len = 1 << this->bbt_erase_shift; 564 len = 1 << this->bbt_erase_shift;
569 res = mtd->read_ecc (mtd, to, len, &retlen, buf, &buf[len], &oobinfo); 565 res = mtd->read_ecc(mtd, to, len, &retlen, buf, &buf[len], &oobinfo);
570 if (res < 0) { 566 if (res < 0) {
571 if (retlen != len) { 567 if (retlen != len) {
572 printk (KERN_INFO "nand_bbt: Error reading block for writing the bad block table\n"); 568 printk(KERN_INFO
569 "nand_bbt: Error reading block for writing the bad block table\n");
573 return res; 570 return res;
574 } 571 }
575 printk (KERN_WARNING "nand_bbt: ECC error while reading block for writing bad block table\n"); 572 printk(KERN_WARNING "nand_bbt: ECC error while reading block for writing bad block table\n");
576 } 573 }
577 /* Calc the byte offset in the buffer */ 574 /* Calc the byte offset in the buffer */
578 pageoffs = page - (int)(to >> this->page_shift); 575 pageoffs = page - (int)(to >> this->page_shift);
579 offs = pageoffs << this->page_shift; 576 offs = pageoffs << this->page_shift;
580 /* Preset the bbt area with 0xff */ 577 /* Preset the bbt area with 0xff */
581 memset (&buf[offs], 0xff, (size_t)(numblocks >> sft)); 578 memset(&buf[offs], 0xff, (size_t) (numblocks >> sft));
582 /* Preset the bbt's oob area with 0xff */ 579 /* Preset the bbt's oob area with 0xff */
583 memset (&buf[len + pageoffs * mtd->oobsize], 0xff, 580 memset(&buf[len + pageoffs * mtd->oobsize], 0xff,
584 ((len >> this->page_shift) - pageoffs) * mtd->oobsize); 581 ((len >> this->page_shift) - pageoffs) * mtd->oobsize);
585 if (td->options & NAND_BBT_VERSION) { 582 if (td->options & NAND_BBT_VERSION) {
586 buf[len + (pageoffs * mtd->oobsize) + td->veroffs] = td->version[chip]; 583 buf[len + (pageoffs * mtd->oobsize) + td->veroffs] = td->version[chip];
587 } 584 }
@@ -589,22 +586,22 @@ write:
589 /* Calc length */ 586 /* Calc length */
590 len = (size_t) (numblocks >> sft); 587 len = (size_t) (numblocks >> sft);
591 /* Make it page aligned ! */ 588 /* Make it page aligned ! */
592 len = (len + (mtd->oobblock-1)) & ~(mtd->oobblock-1); 589 len = (len + (mtd->oobblock - 1)) & ~(mtd->oobblock - 1);
593 /* Preset the buffer with 0xff */ 590 /* Preset the buffer with 0xff */
594 memset (buf, 0xff, len + (len >> this->page_shift) * mtd->oobsize); 591 memset(buf, 0xff, len + (len >> this->page_shift) * mtd->oobsize);
595 offs = 0; 592 offs = 0;
596 /* Pattern is located in oob area of first page */ 593 /* Pattern is located in oob area of first page */
597 memcpy (&buf[len + td->offs], td->pattern, td->len); 594 memcpy(&buf[len + td->offs], td->pattern, td->len);
598 if (td->options & NAND_BBT_VERSION) { 595 if (td->options & NAND_BBT_VERSION) {
599 buf[len + td->veroffs] = td->version[chip]; 596 buf[len + td->veroffs] = td->version[chip];
600 } 597 }
601 } 598 }
602 599
603 /* walk through the memory table */ 600 /* walk through the memory table */
604 for (i = 0; i < numblocks; ) { 601 for (i = 0; i < numblocks;) {
605 uint8_t dat; 602 uint8_t dat;
606 dat = this->bbt[bbtoffs + (i >> 2)]; 603 dat = this->bbt[bbtoffs + (i >> 2)];
607 for (j = 0; j < 4; j++ , i++) { 604 for (j = 0; j < 4; j++, i++) {
608 int sftcnt = (i << (3 - sft)) & sftmsk; 605 int sftcnt = (i << (3 - sft)) & sftmsk;
609 /* Do not store the reserved bbt blocks ! */ 606 /* Do not store the reserved bbt blocks ! */
610 buf[offs + (i >> sft)] &= ~(msk[dat & 0x03] << sftcnt); 607 buf[offs + (i >> sft)] &= ~(msk[dat & 0x03] << sftcnt);
@@ -612,23 +609,23 @@ write:
612 } 609 }
613 } 610 }
614 611
615 memset (&einfo, 0, sizeof (einfo)); 612 memset(&einfo, 0, sizeof(einfo));
616 einfo.mtd = mtd; 613 einfo.mtd = mtd;
617 einfo.addr = (unsigned long) to; 614 einfo.addr = (unsigned long)to;
618 einfo.len = 1 << this->bbt_erase_shift; 615 einfo.len = 1 << this->bbt_erase_shift;
619 res = nand_erase_nand (mtd, &einfo, 1); 616 res = nand_erase_nand(mtd, &einfo, 1);
620 if (res < 0) { 617 if (res < 0) {
621 printk (KERN_WARNING "nand_bbt: Error during block erase: %d\n", res); 618 printk(KERN_WARNING "nand_bbt: Error during block erase: %d\n", res);
622 return res; 619 return res;
623 } 620 }
624 621
625 res = mtd->write_ecc (mtd, to, len, &retlen, buf, &buf[len], &oobinfo); 622 res = mtd->write_ecc(mtd, to, len, &retlen, buf, &buf[len], &oobinfo);
626 if (res < 0) { 623 if (res < 0) {
627 printk (KERN_WARNING "nand_bbt: Error while writing bad block table %d\n", res); 624 printk(KERN_WARNING "nand_bbt: Error while writing bad block table %d\n", res);
628 return res; 625 return res;
629 } 626 }
630 printk (KERN_DEBUG "Bad block table written to 0x%08x, version 0x%02X\n", 627 printk(KERN_DEBUG "Bad block table written to 0x%08x, version 0x%02X\n",
631 (unsigned int) to, td->version[chip]); 628 (unsigned int)to, td->version[chip]);
632 629
633 /* Mark it as used */ 630 /* Mark it as used */
634 td->pages[chip] = page; 631 td->pages[chip] = page;
@@ -644,27 +641,27 @@ write:
644 * The function creates a memory based bbt by scanning the device 641 * The function creates a memory based bbt by scanning the device
645 * for manufacturer / software marked good / bad blocks 642 * for manufacturer / software marked good / bad blocks
646*/ 643*/
647static inline int nand_memory_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd) 644static inline int nand_memory_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
648{ 645{
649 struct nand_chip *this = mtd->priv; 646 struct nand_chip *this = mtd->priv;
650 647
651 bd->options &= ~NAND_BBT_SCANEMPTY; 648 bd->options &= ~NAND_BBT_SCANEMPTY;
652 return create_bbt (mtd, this->data_buf, bd, -1); 649 return create_bbt(mtd, this->data_buf, bd, -1);
653} 650}
654 651
655/** 652/**
656 * check_create - [GENERIC] create and write bbt(s) if neccecary 653 * check_create - [GENERIC] create and write bbt(s) if necessary
657 * @mtd: MTD device structure 654 * @mtd: MTD device structure
658 * @buf: temporary buffer 655 * @buf: temporary buffer
659 * @bd: descriptor for the good/bad block search pattern 656 * @bd: descriptor for the good/bad block search pattern
660 * 657 *
661 * The function checks the results of the previous call to read_bbt 658 * The function checks the results of the previous call to read_bbt
662 * and creates / updates the bbt(s) if neccecary 659 * and creates / updates the bbt(s) if necessary
663 * Creation is neccecary if no bbt was found for the chip/device 660 * Creation is necessary if no bbt was found for the chip/device
664 * Update is neccecary if one of the tables is missing or the 661 * Update is necessary if one of the tables is missing or the
665 * version nr. of one table is less than the other 662 * version nr. of one table is less than the other
666*/ 663*/
667static int check_create (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd) 664static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd)
668{ 665{
669 int i, chips, writeops, chipsel, res; 666 int i, chips, writeops, chipsel, res;
670 struct nand_chip *this = mtd->priv; 667 struct nand_chip *this = mtd->priv;
@@ -732,35 +729,35 @@ static int check_create (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_des
732 rd = td; 729 rd = td;
733 goto writecheck; 730 goto writecheck;
734 } 731 }
735create: 732 create:
736 /* Create the bad block table by scanning the device ? */ 733 /* Create the bad block table by scanning the device ? */
737 if (!(td->options & NAND_BBT_CREATE)) 734 if (!(td->options & NAND_BBT_CREATE))
738 continue; 735 continue;
739 736
740 /* Create the table in memory by scanning the chip(s) */ 737 /* Create the table in memory by scanning the chip(s) */
741 create_bbt (mtd, buf, bd, chipsel); 738 create_bbt(mtd, buf, bd, chipsel);
742 739
743 td->version[i] = 1; 740 td->version[i] = 1;
744 if (md) 741 if (md)
745 md->version[i] = 1; 742 md->version[i] = 1;
746writecheck: 743 writecheck:
747 /* read back first ? */ 744 /* read back first ? */
748 if (rd) 745 if (rd)
749 read_abs_bbt (mtd, buf, rd, chipsel); 746 read_abs_bbt(mtd, buf, rd, chipsel);
750 /* If they weren't versioned, read both. */ 747 /* If they weren't versioned, read both. */
751 if (rd2) 748 if (rd2)
752 read_abs_bbt (mtd, buf, rd2, chipsel); 749 read_abs_bbt(mtd, buf, rd2, chipsel);
753 750
754 /* Write the bad block table to the device ? */ 751 /* Write the bad block table to the device ? */
755 if ((writeops & 0x01) && (td->options & NAND_BBT_WRITE)) { 752 if ((writeops & 0x01) && (td->options & NAND_BBT_WRITE)) {
756 res = write_bbt (mtd, buf, td, md, chipsel); 753 res = write_bbt(mtd, buf, td, md, chipsel);
757 if (res < 0) 754 if (res < 0)
758 return res; 755 return res;
759 } 756 }
760 757
761 /* Write the mirror bad block table to the device ? */ 758 /* Write the mirror bad block table to the device ? */
762 if ((writeops & 0x02) && md && (md->options & NAND_BBT_WRITE)) { 759 if ((writeops & 0x02) && md && (md->options & NAND_BBT_WRITE)) {
763 res = write_bbt (mtd, buf, md, td, chipsel); 760 res = write_bbt(mtd, buf, md, td, chipsel);
764 if (res < 0) 761 if (res < 0)
765 return res; 762 return res;
766 } 763 }
@@ -777,7 +774,7 @@ writecheck:
777 * accidental erasures / writes. The regions are identified by 774 * accidental erasures / writes. The regions are identified by
778 * the mark 0x02. 775 * the mark 0x02.
779*/ 776*/
780static void mark_bbt_region (struct mtd_info *mtd, struct nand_bbt_descr *td) 777static void mark_bbt_region(struct mtd_info *mtd, struct nand_bbt_descr *td)
781{ 778{
782 struct nand_chip *this = mtd->priv; 779 struct nand_chip *this = mtd->priv;
783 int i, j, chips, block, nrblocks, update; 780 int i, j, chips, block, nrblocks, update;
@@ -795,7 +792,8 @@ static void mark_bbt_region (struct mtd_info *mtd, struct nand_bbt_descr *td)
795 for (i = 0; i < chips; i++) { 792 for (i = 0; i < chips; i++) {
796 if ((td->options & NAND_BBT_ABSPAGE) || 793 if ((td->options & NAND_BBT_ABSPAGE) ||
797 !(td->options & NAND_BBT_WRITE)) { 794 !(td->options & NAND_BBT_WRITE)) {
798 if (td->pages[i] == -1) continue; 795 if (td->pages[i] == -1)
796 continue;
799 block = td->pages[i] >> (this->bbt_erase_shift - this->page_shift); 797 block = td->pages[i] >> (this->bbt_erase_shift - this->page_shift);
800 block <<= 1; 798 block <<= 1;
801 oldval = this->bbt[(block >> 3)]; 799 oldval = this->bbt[(block >> 3)];
@@ -815,7 +813,8 @@ static void mark_bbt_region (struct mtd_info *mtd, struct nand_bbt_descr *td)
815 oldval = this->bbt[(block >> 3)]; 813 oldval = this->bbt[(block >> 3)];
816 newval = oldval | (0x2 << (block & 0x06)); 814 newval = oldval | (0x2 << (block & 0x06));
817 this->bbt[(block >> 3)] = newval; 815 this->bbt[(block >> 3)] = newval;
818 if (oldval != newval) update = 1; 816 if (oldval != newval)
817 update = 1;
819 block += 2; 818 block += 2;
820 } 819 }
821 /* If we want reserved blocks to be recorded to flash, and some 820 /* If we want reserved blocks to be recorded to flash, and some
@@ -840,7 +839,7 @@ static void mark_bbt_region (struct mtd_info *mtd, struct nand_bbt_descr *td)
840 * by calling the nand_free_bbt function. 839 * by calling the nand_free_bbt function.
841 * 840 *
842*/ 841*/
843int nand_scan_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd) 842int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
844{ 843{
845 struct nand_chip *this = mtd->priv; 844 struct nand_chip *this = mtd->priv;
846 int len, res = 0; 845 int len, res = 0;
@@ -850,21 +849,21 @@ int nand_scan_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd)
850 849
851 len = mtd->size >> (this->bbt_erase_shift + 2); 850 len = mtd->size >> (this->bbt_erase_shift + 2);
852 /* Allocate memory (2bit per block) */ 851 /* Allocate memory (2bit per block) */
853 this->bbt = kmalloc (len, GFP_KERNEL); 852 this->bbt = kmalloc(len, GFP_KERNEL);
854 if (!this->bbt) { 853 if (!this->bbt) {
855 printk (KERN_ERR "nand_scan_bbt: Out of memory\n"); 854 printk(KERN_ERR "nand_scan_bbt: Out of memory\n");
856 return -ENOMEM; 855 return -ENOMEM;
857 } 856 }
858 /* Clear the memory bad block table */ 857 /* Clear the memory bad block table */
859 memset (this->bbt, 0x00, len); 858 memset(this->bbt, 0x00, len);
860 859
861 /* If no primary table decriptor is given, scan the device 860 /* If no primary table decriptor is given, scan the device
862 * to build a memory based bad block table 861 * to build a memory based bad block table
863 */ 862 */
864 if (!td) { 863 if (!td) {
865 if ((res = nand_memory_bbt(mtd, bd))) { 864 if ((res = nand_memory_bbt(mtd, bd))) {
866 printk (KERN_ERR "nand_bbt: Can't scan flash and build the RAM-based BBT\n"); 865 printk(KERN_ERR "nand_bbt: Can't scan flash and build the RAM-based BBT\n");
867 kfree (this->bbt); 866 kfree(this->bbt);
868 this->bbt = NULL; 867 this->bbt = NULL;
869 } 868 }
870 return res; 869 return res;
@@ -875,33 +874,32 @@ int nand_scan_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd)
875 len += (len >> this->page_shift) * mtd->oobsize; 874 len += (len >> this->page_shift) * mtd->oobsize;
876 buf = vmalloc(len); 875 buf = vmalloc(len);
877 if (!buf) { 876 if (!buf) {
878 printk (KERN_ERR "nand_bbt: Out of memory\n"); 877 printk(KERN_ERR "nand_bbt: Out of memory\n");
879 kfree (this->bbt); 878 kfree(this->bbt);
880 this->bbt = NULL; 879 this->bbt = NULL;
881 return -ENOMEM; 880 return -ENOMEM;
882 } 881 }
883 882
884 /* Is the bbt at a given page ? */ 883 /* Is the bbt at a given page ? */
885 if (td->options & NAND_BBT_ABSPAGE) { 884 if (td->options & NAND_BBT_ABSPAGE) {
886 res = read_abs_bbts (mtd, buf, td, md); 885 res = read_abs_bbts(mtd, buf, td, md);
887 } else { 886 } else {
888 /* Search the bad block table using a pattern in oob */ 887 /* Search the bad block table using a pattern in oob */
889 res = search_read_bbts (mtd, buf, td, md); 888 res = search_read_bbts(mtd, buf, td, md);
890 } 889 }
891 890
892 if (res) 891 if (res)
893 res = check_create (mtd, buf, bd); 892 res = check_create(mtd, buf, bd);
894 893
895 /* Prevent the bbt regions from erasing / writing */ 894 /* Prevent the bbt regions from erasing / writing */
896 mark_bbt_region (mtd, td); 895 mark_bbt_region(mtd, td);
897 if (md) 896 if (md)
898 mark_bbt_region (mtd, md); 897 mark_bbt_region(mtd, md);
899 898
900 vfree (buf); 899 vfree(buf);
901 return res; 900 return res;
902} 901}
903 902
904
905/** 903/**
906 * nand_update_bbt - [NAND Interface] update bad block table(s) 904 * nand_update_bbt - [NAND Interface] update bad block table(s)
907 * @mtd: MTD device structure 905 * @mtd: MTD device structure
@@ -909,7 +907,7 @@ int nand_scan_bbt (struct mtd_info *mtd, struct nand_bbt_descr *bd)
909 * 907 *
910 * The function updates the bad block table(s) 908 * The function updates the bad block table(s)
911*/ 909*/
912int nand_update_bbt (struct mtd_info *mtd, loff_t offs) 910int nand_update_bbt(struct mtd_info *mtd, loff_t offs)
913{ 911{
914 struct nand_chip *this = mtd->priv; 912 struct nand_chip *this = mtd->priv;
915 int len, res = 0, writeops = 0; 913 int len, res = 0, writeops = 0;
@@ -925,9 +923,9 @@ int nand_update_bbt (struct mtd_info *mtd, loff_t offs)
925 /* Allocate a temporary buffer for one eraseblock incl. oob */ 923 /* Allocate a temporary buffer for one eraseblock incl. oob */
926 len = (1 << this->bbt_erase_shift); 924 len = (1 << this->bbt_erase_shift);
927 len += (len >> this->page_shift) * mtd->oobsize; 925 len += (len >> this->page_shift) * mtd->oobsize;
928 buf = kmalloc (len, GFP_KERNEL); 926 buf = kmalloc(len, GFP_KERNEL);
929 if (!buf) { 927 if (!buf) {
930 printk (KERN_ERR "nand_update_bbt: Out of memory\n"); 928 printk(KERN_ERR "nand_update_bbt: Out of memory\n");
931 return -ENOMEM; 929 return -ENOMEM;
932 } 930 }
933 931
@@ -935,7 +933,7 @@ int nand_update_bbt (struct mtd_info *mtd, loff_t offs)
935 933
936 /* Do we have a bbt per chip ? */ 934 /* Do we have a bbt per chip ? */
937 if (td->options & NAND_BBT_PERCHIP) { 935 if (td->options & NAND_BBT_PERCHIP) {
938 chip = (int) (offs >> this->chip_shift); 936 chip = (int)(offs >> this->chip_shift);
939 chipsel = chip; 937 chipsel = chip;
940 } else { 938 } else {
941 chip = 0; 939 chip = 0;
@@ -948,17 +946,17 @@ int nand_update_bbt (struct mtd_info *mtd, loff_t offs)
948 946
949 /* Write the bad block table to the device ? */ 947 /* Write the bad block table to the device ? */
950 if ((writeops & 0x01) && (td->options & NAND_BBT_WRITE)) { 948 if ((writeops & 0x01) && (td->options & NAND_BBT_WRITE)) {
951 res = write_bbt (mtd, buf, td, md, chipsel); 949 res = write_bbt(mtd, buf, td, md, chipsel);
952 if (res < 0) 950 if (res < 0)
953 goto out; 951 goto out;
954 } 952 }
955 /* Write the mirror bad block table to the device ? */ 953 /* Write the mirror bad block table to the device ? */
956 if ((writeops & 0x02) && md && (md->options & NAND_BBT_WRITE)) { 954 if ((writeops & 0x02) && md && (md->options & NAND_BBT_WRITE)) {
957 res = write_bbt (mtd, buf, md, td, chipsel); 955 res = write_bbt(mtd, buf, md, td, chipsel);
958 } 956 }
959 957
960out: 958 out:
961 kfree (buf); 959 kfree(buf);
962 return res; 960 return res;
963} 961}
964 962
@@ -1036,7 +1034,7 @@ static struct nand_bbt_descr bbt_mirror_descr = {
1036 * support for the device and calls the nand_scan_bbt function 1034 * support for the device and calls the nand_scan_bbt function
1037 * 1035 *
1038*/ 1036*/
1039int nand_default_bbt (struct mtd_info *mtd) 1037int nand_default_bbt(struct mtd_info *mtd)
1040{ 1038{
1041 struct nand_chip *this = mtd->priv; 1039 struct nand_chip *this = mtd->priv;
1042 1040
@@ -1046,7 +1044,7 @@ int nand_default_bbt (struct mtd_info *mtd)
1046 * of the good / bad information, so we _must_ store 1044 * of the good / bad information, so we _must_ store
1047 * this information in a good / bad table during 1045 * this information in a good / bad table during
1048 * startup 1046 * startup
1049 */ 1047 */
1050 if (this->options & NAND_IS_AND) { 1048 if (this->options & NAND_IS_AND) {
1051 /* Use the default pattern descriptors */ 1049 /* Use the default pattern descriptors */
1052 if (!this->bbt_td) { 1050 if (!this->bbt_td) {
@@ -1054,10 +1052,9 @@ int nand_default_bbt (struct mtd_info *mtd)
1054 this->bbt_md = &bbt_mirror_descr; 1052 this->bbt_md = &bbt_mirror_descr;
1055 } 1053 }
1056 this->options |= NAND_USE_FLASH_BBT; 1054 this->options |= NAND_USE_FLASH_BBT;
1057 return nand_scan_bbt (mtd, &agand_flashbased); 1055 return nand_scan_bbt(mtd, &agand_flashbased);
1058 } 1056 }
1059 1057
1060
1061 /* Is a flash based bad block table requested ? */ 1058 /* Is a flash based bad block table requested ? */
1062 if (this->options & NAND_USE_FLASH_BBT) { 1059 if (this->options & NAND_USE_FLASH_BBT) {
1063 /* Use the default pattern descriptors */ 1060 /* Use the default pattern descriptors */
@@ -1066,18 +1063,17 @@ int nand_default_bbt (struct mtd_info *mtd)
1066 this->bbt_md = &bbt_mirror_descr; 1063 this->bbt_md = &bbt_mirror_descr;
1067 } 1064 }
1068 if (!this->badblock_pattern) { 1065 if (!this->badblock_pattern) {
1069 this->badblock_pattern = (mtd->oobblock > 512) ? 1066 this->badblock_pattern = (mtd->oobblock > 512) ? &largepage_flashbased : &smallpage_flashbased;
1070 &largepage_flashbased : &smallpage_flashbased;
1071 } 1067 }
1072 } else { 1068 } else {
1073 this->bbt_td = NULL; 1069 this->bbt_td = NULL;
1074 this->bbt_md = NULL; 1070 this->bbt_md = NULL;
1075 if (!this->badblock_pattern) { 1071 if (!this->badblock_pattern) {
1076 this->badblock_pattern = (mtd->oobblock > 512) ? 1072 this->badblock_pattern = (mtd->oobblock > 512) ?
1077 &largepage_memorybased : &smallpage_memorybased; 1073 &largepage_memorybased : &smallpage_memorybased;
1078 } 1074 }
1079 } 1075 }
1080 return nand_scan_bbt (mtd, this->badblock_pattern); 1076 return nand_scan_bbt(mtd, this->badblock_pattern);
1081} 1077}
1082 1078
1083/** 1079/**
@@ -1087,26 +1083,29 @@ int nand_default_bbt (struct mtd_info *mtd)
1087 * @allowbbt: allow access to bad block table region 1083 * @allowbbt: allow access to bad block table region
1088 * 1084 *
1089*/ 1085*/
1090int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt) 1086int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
1091{ 1087{
1092 struct nand_chip *this = mtd->priv; 1088 struct nand_chip *this = mtd->priv;
1093 int block; 1089 int block;
1094 uint8_t res; 1090 uint8_t res;
1095 1091
1096 /* Get block number * 2 */ 1092 /* Get block number * 2 */
1097 block = (int) (offs >> (this->bbt_erase_shift - 1)); 1093 block = (int)(offs >> (this->bbt_erase_shift - 1));
1098 res = (this->bbt[block >> 3] >> (block & 0x06)) & 0x03; 1094 res = (this->bbt[block >> 3] >> (block & 0x06)) & 0x03;
1099 1095
1100 DEBUG (MTD_DEBUG_LEVEL2, "nand_isbad_bbt(): bbt info for offs 0x%08x: (block %d) 0x%02x\n", 1096 DEBUG(MTD_DEBUG_LEVEL2, "nand_isbad_bbt(): bbt info for offs 0x%08x: (block %d) 0x%02x\n",
1101 (unsigned int)offs, block >> 1, res); 1097 (unsigned int)offs, block >> 1, res);
1102 1098
1103 switch ((int)res) { 1099 switch ((int)res) {
1104 case 0x00: return 0; 1100 case 0x00:
1105 case 0x01: return 1; 1101 return 0;
1106 case 0x02: return allowbbt ? 0 : 1; 1102 case 0x01:
1103 return 1;
1104 case 0x02:
1105 return allowbbt ? 0 : 1;
1107 } 1106 }
1108 return 1; 1107 return 1;
1109} 1108}
1110 1109
1111EXPORT_SYMBOL (nand_scan_bbt); 1110EXPORT_SYMBOL(nand_scan_bbt);
1112EXPORT_SYMBOL (nand_default_bbt); 1111EXPORT_SYMBOL(nand_default_bbt);