diff options
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index 9adc6d62332a..fbccb2a25186 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -247,15 +247,15 @@ static int read_abs_bbts(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_des | |||
247 | 247 | ||
248 | /* Read the primary version, if available */ | 248 | /* Read the primary version, if available */ |
249 | if (td->options & NAND_BBT_VERSION) { | 249 | if (td->options & NAND_BBT_VERSION) { |
250 | 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->writesize, mtd->oobsize); |
251 | td->version[0] = buf[mtd->oobblock + td->veroffs]; | 251 | td->version[0] = buf[mtd->writesize + td->veroffs]; |
252 | 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]); |
253 | } | 253 | } |
254 | 254 | ||
255 | /* Read the mirror version, if available */ | 255 | /* Read the mirror version, if available */ |
256 | if (md && (md->options & NAND_BBT_VERSION)) { | 256 | if (md && (md->options & NAND_BBT_VERSION)) { |
257 | 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->writesize, mtd->oobsize); |
258 | md->version[0] = buf[mtd->oobblock + md->veroffs]; | 258 | md->version[0] = buf[mtd->writesize + md->veroffs]; |
259 | 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]); |
260 | } | 260 | } |
261 | 261 | ||
@@ -298,8 +298,8 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr | |||
298 | readlen = bd->len; | 298 | readlen = bd->len; |
299 | } else { | 299 | } else { |
300 | /* Full page content should be read */ | 300 | /* Full page content should be read */ |
301 | scanlen = mtd->oobblock + mtd->oobsize; | 301 | scanlen = mtd->writesize + mtd->oobsize; |
302 | readlen = len * mtd->oobblock; | 302 | readlen = len * mtd->writesize; |
303 | ooblen = len * mtd->oobsize; | 303 | ooblen = len * mtd->oobsize; |
304 | } | 304 | } |
305 | 305 | ||
@@ -334,7 +334,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr | |||
334 | 334 | ||
335 | /* Read the full oob until read_oob is fixed to | 335 | /* Read the full oob until read_oob is fixed to |
336 | * handle single byte reads for 16 bit buswidth */ | 336 | * handle single byte reads for 16 bit buswidth */ |
337 | ret = mtd->read_oob(mtd, from + j * mtd->oobblock, mtd->oobsize, &retlen, buf); | 337 | ret = mtd->read_oob(mtd, from + j * mtd->writesize, mtd->oobsize, &retlen, buf); |
338 | if (ret) | 338 | if (ret) |
339 | return ret; | 339 | return ret; |
340 | 340 | ||
@@ -345,7 +345,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr | |||
345 | break; | 345 | break; |
346 | } | 346 | } |
347 | } else { | 347 | } else { |
348 | if (check_pattern(&buf[j * scanlen], scanlen, mtd->oobblock, bd)) { | 348 | if (check_pattern(&buf[j * scanlen], scanlen, mtd->writesize, bd)) { |
349 | this->bbt[i >> 3] |= 0x03 << (i & 0x6); | 349 | this->bbt[i >> 3] |= 0x03 << (i & 0x6); |
350 | printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n", | 350 | printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n", |
351 | i >> 1, (unsigned int)from); | 351 | i >> 1, (unsigned int)from); |
@@ -381,7 +381,7 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr | |||
381 | struct nand_chip *this = mtd->priv; | 381 | struct nand_chip *this = mtd->priv; |
382 | int i, chips; | 382 | int i, chips; |
383 | int bits, startblock, block, dir; | 383 | int bits, startblock, block, dir; |
384 | int scanlen = mtd->oobblock + mtd->oobsize; | 384 | int scanlen = mtd->writesize + mtd->oobsize; |
385 | int bbtblocks; | 385 | int bbtblocks; |
386 | 386 | ||
387 | /* Search direction top -> down ? */ | 387 | /* Search direction top -> down ? */ |
@@ -414,11 +414,11 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr | |||
414 | for (block = 0; block < td->maxblocks; block++) { | 414 | for (block = 0; block < td->maxblocks; block++) { |
415 | int actblock = startblock + dir * block; | 415 | int actblock = startblock + dir * block; |
416 | /* Read first page */ | 416 | /* Read first page */ |
417 | 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->writesize, mtd->oobsize); |
418 | if (!check_pattern(buf, scanlen, mtd->oobblock, td)) { | 418 | if (!check_pattern(buf, scanlen, mtd->writesize, td)) { |
419 | td->pages[i] = actblock << (this->bbt_erase_shift - this->page_shift); | 419 | td->pages[i] = actblock << (this->bbt_erase_shift - this->page_shift); |
420 | if (td->options & NAND_BBT_VERSION) { | 420 | if (td->options & NAND_BBT_VERSION) { |
421 | td->version[i] = buf[mtd->oobblock + td->veroffs]; | 421 | td->version[i] = buf[mtd->writesize + td->veroffs]; |
422 | } | 422 | } |
423 | break; | 423 | break; |
424 | } | 424 | } |
@@ -586,7 +586,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
586 | /* Calc length */ | 586 | /* Calc length */ |
587 | len = (size_t) (numblocks >> sft); | 587 | len = (size_t) (numblocks >> sft); |
588 | /* Make it page aligned ! */ | 588 | /* Make it page aligned ! */ |
589 | len = (len + (mtd->oobblock - 1)) & ~(mtd->oobblock - 1); | 589 | len = (len + (mtd->writesize - 1)) & ~(mtd->writesize - 1); |
590 | /* Preset the buffer with 0xff */ | 590 | /* Preset the buffer with 0xff */ |
591 | memset(buf, 0xff, len + (len >> this->page_shift) * mtd->oobsize); | 591 | memset(buf, 0xff, len + (len >> this->page_shift) * mtd->oobsize); |
592 | offs = 0; | 592 | offs = 0; |
@@ -1063,13 +1063,13 @@ int nand_default_bbt(struct mtd_info *mtd) | |||
1063 | this->bbt_md = &bbt_mirror_descr; | 1063 | this->bbt_md = &bbt_mirror_descr; |
1064 | } | 1064 | } |
1065 | if (!this->badblock_pattern) { | 1065 | if (!this->badblock_pattern) { |
1066 | this->badblock_pattern = (mtd->oobblock > 512) ? &largepage_flashbased : &smallpage_flashbased; | 1066 | this->badblock_pattern = (mtd->writesize > 512) ? &largepage_flashbased : &smallpage_flashbased; |
1067 | } | 1067 | } |
1068 | } else { | 1068 | } else { |
1069 | this->bbt_td = NULL; | 1069 | this->bbt_td = NULL; |
1070 | this->bbt_md = NULL; | 1070 | this->bbt_md = NULL; |
1071 | if (!this->badblock_pattern) { | 1071 | if (!this->badblock_pattern) { |
1072 | this->badblock_pattern = (mtd->oobblock > 512) ? | 1072 | this->badblock_pattern = (mtd->writesize > 512) ? |
1073 | &largepage_memorybased : &smallpage_memorybased; | 1073 | &largepage_memorybased : &smallpage_memorybased; |
1074 | } | 1074 | } |
1075 | } | 1075 | } |