aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/au1550nd.c4
-rw-r--r--drivers/mtd/nand/diskonchip.c16
-rw-r--r--drivers/mtd/nand/nand_base.c64
-rw-r--r--drivers/mtd/nand/nand_bbt.c30
-rw-r--r--drivers/mtd/nand/nandsim.c2
-rw-r--r--drivers/mtd/nand/rtc_from4.c2
6 files changed, 59 insertions, 59 deletions
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c
index d9a0143e1d3a..4253b9309789 100644
--- a/drivers/mtd/nand/au1550nd.c
+++ b/drivers/mtd/nand/au1550nd.c
@@ -356,9 +356,9 @@ static void au1550_command(struct mtd_info *mtd, unsigned command, int column, i
356 if (command == NAND_CMD_SEQIN) { 356 if (command == NAND_CMD_SEQIN) {
357 int readcmd; 357 int readcmd;
358 358
359 if (column >= mtd->oobblock) { 359 if (column >= mtd->writesize) {
360 /* OOB area */ 360 /* OOB area */
361 column -= mtd->oobblock; 361 column -= mtd->writesize;
362 readcmd = NAND_CMD_READOOB; 362 readcmd = NAND_CMD_READOOB;
363 } else if (column < 256) { 363 } else if (column < 256) {
364 /* First 256 bytes --> READ0 */ 364 /* First 256 bytes --> READ0 */
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index a2391c66a63f..d160930276d6 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -761,9 +761,9 @@ static void doc2001plus_command(struct mtd_info *mtd, unsigned command, int colu
761 if (command == NAND_CMD_SEQIN) { 761 if (command == NAND_CMD_SEQIN) {
762 int readcmd; 762 int readcmd;
763 763
764 if (column >= mtd->oobblock) { 764 if (column >= mtd->writesize) {
765 /* OOB area */ 765 /* OOB area */
766 column -= mtd->oobblock; 766 column -= mtd->writesize;
767 readcmd = NAND_CMD_READOOB; 767 readcmd = NAND_CMD_READOOB;
768 } else if (column < 256) { 768 } else if (column < 256) {
769 /* First 256 bytes --> READ0 */ 769 /* First 256 bytes --> READ0 */
@@ -1093,8 +1093,8 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const ch
1093 size_t retlen; 1093 size_t retlen;
1094 1094
1095 for (offs = 0; offs < mtd->size; offs += mtd->erasesize) { 1095 for (offs = 0; offs < mtd->size; offs += mtd->erasesize) {
1096 ret = mtd->read(mtd, offs, mtd->oobblock, &retlen, buf); 1096 ret = mtd->read(mtd, offs, mtd->writesize, &retlen, buf);
1097 if (retlen != mtd->oobblock) 1097 if (retlen != mtd->writesize)
1098 continue; 1098 continue;
1099 if (ret) { 1099 if (ret) {
1100 printk(KERN_WARNING "ECC error scanning DOC at 0x%x\n", offs); 1100 printk(KERN_WARNING "ECC error scanning DOC at 0x%x\n", offs);
@@ -1118,8 +1118,8 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const ch
1118 /* Only one mediaheader was found. We want buf to contain a 1118 /* Only one mediaheader was found. We want buf to contain a
1119 mediaheader on return, so we'll have to re-read the one we found. */ 1119 mediaheader on return, so we'll have to re-read the one we found. */
1120 offs = doc->mh0_page << this->page_shift; 1120 offs = doc->mh0_page << this->page_shift;
1121 ret = mtd->read(mtd, offs, mtd->oobblock, &retlen, buf); 1121 ret = mtd->read(mtd, offs, mtd->writesize, &retlen, buf);
1122 if (retlen != mtd->oobblock) { 1122 if (retlen != mtd->writesize) {
1123 /* Insanity. Give up. */ 1123 /* Insanity. Give up. */
1124 printk(KERN_ERR "Read DiskOnChip Media Header once, but can't reread it???\n"); 1124 printk(KERN_ERR "Read DiskOnChip Media Header once, but can't reread it???\n");
1125 return 0; 1125 return 0;
@@ -1139,7 +1139,7 @@ static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partitio
1139 unsigned blocks, maxblocks; 1139 unsigned blocks, maxblocks;
1140 int offs, numheaders; 1140 int offs, numheaders;
1141 1141
1142 buf = kmalloc(mtd->oobblock, GFP_KERNEL); 1142 buf = kmalloc(mtd->writesize, GFP_KERNEL);
1143 if (!buf) { 1143 if (!buf) {
1144 printk(KERN_ERR "DiskOnChip mediaheader kmalloc failed!\n"); 1144 printk(KERN_ERR "DiskOnChip mediaheader kmalloc failed!\n");
1145 return 0; 1145 return 0;
@@ -1247,7 +1247,7 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
1247 if (inftl_bbt_write) 1247 if (inftl_bbt_write)
1248 end -= (INFTL_BBT_RESERVED_BLOCKS << this->phys_erase_shift); 1248 end -= (INFTL_BBT_RESERVED_BLOCKS << this->phys_erase_shift);
1249 1249
1250 buf = kmalloc(mtd->oobblock, GFP_KERNEL); 1250 buf = kmalloc(mtd->writesize, GFP_KERNEL);
1251 if (!buf) { 1251 if (!buf) {
1252 printk(KERN_ERR "DiskOnChip mediaheader kmalloc failed!\n"); 1252 printk(KERN_ERR "DiskOnChip mediaheader kmalloc failed!\n");
1253 return 0; 1253 return 0;
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 08dffb7a9389..055f6608a2ec 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -560,9 +560,9 @@ static void nand_command(struct mtd_info *mtd, unsigned command, int column, int
560 if (command == NAND_CMD_SEQIN) { 560 if (command == NAND_CMD_SEQIN) {
561 int readcmd; 561 int readcmd;
562 562
563 if (column >= mtd->oobblock) { 563 if (column >= mtd->writesize) {
564 /* OOB area */ 564 /* OOB area */
565 column -= mtd->oobblock; 565 column -= mtd->writesize;
566 readcmd = NAND_CMD_READOOB; 566 readcmd = NAND_CMD_READOOB;
567 } else if (column < 256) { 567 } else if (column < 256) {
568 /* First 256 bytes --> READ0 */ 568 /* First 256 bytes --> READ0 */
@@ -658,7 +658,7 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned command, int column,
658 658
659 /* Emulate NAND_CMD_READOOB */ 659 /* Emulate NAND_CMD_READOOB */
660 if (command == NAND_CMD_READOOB) { 660 if (command == NAND_CMD_READOOB) {
661 column += mtd->oobblock; 661 column += mtd->writesize;
662 command = NAND_CMD_READ0; 662 command = NAND_CMD_READ0;
663 } 663 }
664 664
@@ -889,7 +889,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int pag
889 /* No ecc, write all */ 889 /* No ecc, write all */
890 case NAND_ECC_NONE: 890 case NAND_ECC_NONE:
891 printk(KERN_WARNING "Writing data without ECC to NAND-FLASH is not recommended\n"); 891 printk(KERN_WARNING "Writing data without ECC to NAND-FLASH is not recommended\n");
892 this->write_buf(mtd, this->data_poi, mtd->oobblock); 892 this->write_buf(mtd, this->data_poi, mtd->writesize);
893 break; 893 break;
894 894
895 /* Software ecc 3/256, write all */ 895 /* Software ecc 3/256, write all */
@@ -900,7 +900,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int pag
900 oob_buf[oob_config[eccidx]] = ecc_code[i]; 900 oob_buf[oob_config[eccidx]] = ecc_code[i];
901 datidx += this->eccsize; 901 datidx += this->eccsize;
902 } 902 }
903 this->write_buf(mtd, this->data_poi, mtd->oobblock); 903 this->write_buf(mtd, this->data_poi, mtd->writesize);
904 break; 904 break;
905 default: 905 default:
906 eccbytes = this->eccbytes; 906 eccbytes = this->eccbytes;
@@ -1161,9 +1161,9 @@ int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
1161 page = realpage & this->pagemask; 1161 page = realpage & this->pagemask;
1162 1162
1163 /* Get raw starting column */ 1163 /* Get raw starting column */
1164 col = from & (mtd->oobblock - 1); 1164 col = from & (mtd->writesize - 1);
1165 1165
1166 end = mtd->oobblock; 1166 end = mtd->writesize;
1167 ecc = this->eccsize; 1167 ecc = this->eccsize;
1168 eccbytes = this->eccbytes; 1168 eccbytes = this->eccbytes;
1169 1169
@@ -1321,7 +1321,7 @@ int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
1321 buf[read++] = data_poi[j]; 1321 buf[read++] = data_poi[j];
1322 this->pagebuf = realpage; 1322 this->pagebuf = realpage;
1323 } else 1323 } else
1324 read += mtd->oobblock; 1324 read += mtd->writesize;
1325 1325
1326 /* Apply delay or wait for ready/busy pin 1326 /* Apply delay or wait for ready/busy pin
1327 * Do this before the AUTOINCR check, so no problems 1327 * Do this before the AUTOINCR check, so no problems
@@ -1479,7 +1479,7 @@ int nand_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t from, size_t len, s
1479 int chip = (int)(from >> this->chip_shift); 1479 int chip = (int)(from >> this->chip_shift);
1480 int sndcmd = 1; 1480 int sndcmd = 1;
1481 int cnt = 0; 1481 int cnt = 0;
1482 int pagesize = mtd->oobblock + mtd->oobsize; 1482 int pagesize = mtd->writesize + mtd->oobsize;
1483 int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1; 1483 int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1;
1484 1484
1485 /* Do not allow reads past end of device */ 1485 /* Do not allow reads past end of device */
@@ -1581,7 +1581,7 @@ static u_char *nand_prepare_oobbuf(struct mtd_info *mtd, u_char *fsbuf, struct n
1581 return this->oob_buf; 1581 return this->oob_buf;
1582} 1582}
1583 1583
1584#define NOTALIGNED(x) (x & (mtd->oobblock-1)) != 0 1584#define NOTALIGNED(x) (x & (mtd->writesize-1)) != 0
1585 1585
1586/** 1586/**
1587 * nand_write - [MTD Interface] compability function for nand_write_ecc 1587 * nand_write - [MTD Interface] compability function for nand_write_ecc
@@ -1694,7 +1694,7 @@ static int nand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
1694 /* Next oob page */ 1694 /* Next oob page */
1695 oob += mtd->oobsize; 1695 oob += mtd->oobsize;
1696 /* Update written bytes count */ 1696 /* Update written bytes count */
1697 written += mtd->oobblock; 1697 written += mtd->writesize;
1698 if (written == len) 1698 if (written == len)
1699 goto cmp; 1699 goto cmp;
1700 1700
@@ -1805,7 +1805,7 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to, size_t len, size_t *r
1805 1805
1806 if (NAND_MUST_PAD(this)) { 1806 if (NAND_MUST_PAD(this)) {
1807 /* Write out desired data */ 1807 /* Write out desired data */
1808 this->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->oobblock, page & this->pagemask); 1808 this->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize, page & this->pagemask);
1809 /* prepad 0xff for partial programming */ 1809 /* prepad 0xff for partial programming */
1810 this->write_buf(mtd, ffchars, column); 1810 this->write_buf(mtd, ffchars, column);
1811 /* write data */ 1811 /* write data */
@@ -1814,7 +1814,7 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to, size_t len, size_t *r
1814 this->write_buf(mtd, ffchars, mtd->oobsize - (len + column)); 1814 this->write_buf(mtd, ffchars, mtd->oobsize - (len + column));
1815 } else { 1815 } else {
1816 /* Write out desired data */ 1816 /* Write out desired data */
1817 this->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->oobblock + column, page & this->pagemask); 1817 this->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize + column, page & this->pagemask);
1818 /* write data */ 1818 /* write data */
1819 this->write_buf(mtd, buf, len); 1819 this->write_buf(mtd, buf, len);
1820 } 1820 }
@@ -1947,7 +1947,7 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign
1947 /* If the given tuple is >= pagesize then 1947 /* If the given tuple is >= pagesize then
1948 * write it out from the iov 1948 * write it out from the iov
1949 */ 1949 */
1950 if ((vecs->iov_len - len) >= mtd->oobblock) { 1950 if ((vecs->iov_len - len) >= mtd->writesize) {
1951 /* Calc number of pages we can write 1951 /* Calc number of pages we can write
1952 * out of this iov in one go */ 1952 * out of this iov in one go */
1953 numpages = (vecs->iov_len - len) >> this->page_shift; 1953 numpages = (vecs->iov_len - len) >> this->page_shift;
@@ -1967,8 +1967,8 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign
1967 &oobbuf[oob], oobsel, i != numpages); 1967 &oobbuf[oob], oobsel, i != numpages);
1968 if (ret) 1968 if (ret)
1969 goto out; 1969 goto out;
1970 this->data_poi += mtd->oobblock; 1970 this->data_poi += mtd->writesize;
1971 len += mtd->oobblock; 1971 len += mtd->writesize;
1972 oob += mtd->oobsize; 1972 oob += mtd->oobsize;
1973 page++; 1973 page++;
1974 } 1974 }
@@ -1983,7 +1983,7 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign
1983 * tuple until we have a full page to write 1983 * tuple until we have a full page to write
1984 */ 1984 */
1985 int cnt = 0; 1985 int cnt = 0;
1986 while (cnt < mtd->oobblock) { 1986 while (cnt < mtd->writesize) {
1987 if (vecs->iov_base != NULL && vecs->iov_len) 1987 if (vecs->iov_base != NULL && vecs->iov_len)
1988 this->data_buf[cnt++] = ((u_char *) vecs->iov_base)[len++]; 1988 this->data_buf[cnt++] = ((u_char *) vecs->iov_base)[len++];
1989 /* Check, if we have to switch to the next tuple */ 1989 /* Check, if we have to switch to the next tuple */
@@ -2009,7 +2009,7 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign
2009 if (ret) 2009 if (ret)
2010 goto out; 2010 goto out;
2011 2011
2012 written += mtd->oobblock * numpages; 2012 written += mtd->writesize * numpages;
2013 /* All done ? */ 2013 /* All done ? */
2014 if (!count) 2014 if (!count)
2015 break; 2015 break;
@@ -2411,10 +2411,10 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2411 /* The 4th id byte is the important one */ 2411 /* The 4th id byte is the important one */
2412 extid = this->read_byte(mtd); 2412 extid = this->read_byte(mtd);
2413 /* Calc pagesize */ 2413 /* Calc pagesize */
2414 mtd->oobblock = 1024 << (extid & 0x3); 2414 mtd->writesize = 1024 << (extid & 0x3);
2415 extid >>= 2; 2415 extid >>= 2;
2416 /* Calc oobsize */ 2416 /* Calc oobsize */
2417 mtd->oobsize = (8 << (extid & 0x01)) * (mtd->oobblock >> 9); 2417 mtd->oobsize = (8 << (extid & 0x01)) * (mtd->writesize >> 9);
2418 extid >>= 2; 2418 extid >>= 2;
2419 /* Calc blocksize. Blocksize is multiples of 64KiB */ 2419 /* Calc blocksize. Blocksize is multiples of 64KiB */
2420 mtd->erasesize = (64 * 1024) << (extid & 0x03); 2420 mtd->erasesize = (64 * 1024) << (extid & 0x03);
@@ -2426,8 +2426,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2426 /* Old devices have this data hardcoded in the 2426 /* Old devices have this data hardcoded in the
2427 * device id table */ 2427 * device id table */
2428 mtd->erasesize = nand_flash_ids[i].erasesize; 2428 mtd->erasesize = nand_flash_ids[i].erasesize;
2429 mtd->oobblock = nand_flash_ids[i].pagesize; 2429 mtd->writesize = nand_flash_ids[i].pagesize;
2430 mtd->oobsize = mtd->oobblock / 32; 2430 mtd->oobsize = mtd->writesize / 32;
2431 busw = nand_flash_ids[i].options & NAND_BUSWIDTH_16; 2431 busw = nand_flash_ids[i].options & NAND_BUSWIDTH_16;
2432 } 2432 }
2433 2433
@@ -2451,12 +2451,12 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2451 } 2451 }
2452 2452
2453 /* Calculate the address shift from the page size */ 2453 /* Calculate the address shift from the page size */
2454 this->page_shift = ffs(mtd->oobblock) - 1; 2454 this->page_shift = ffs(mtd->writesize) - 1;
2455 this->bbt_erase_shift = this->phys_erase_shift = ffs(mtd->erasesize) - 1; 2455 this->bbt_erase_shift = this->phys_erase_shift = ffs(mtd->erasesize) - 1;
2456 this->chip_shift = ffs(this->chipsize) - 1; 2456 this->chip_shift = ffs(this->chipsize) - 1;
2457 2457
2458 /* Set the bad block position */ 2458 /* Set the bad block position */
2459 this->badblockpos = mtd->oobblock > 512 ? NAND_LARGE_BADBLOCK_POS : NAND_SMALL_BADBLOCK_POS; 2459 this->badblockpos = mtd->writesize > 512 ? NAND_LARGE_BADBLOCK_POS : NAND_SMALL_BADBLOCK_POS;
2460 2460
2461 /* Get chip options, preserve non chip based options */ 2461 /* Get chip options, preserve non chip based options */
2462 this->options &= ~NAND_CHIPOPTIONS_MSK; 2462 this->options &= ~NAND_CHIPOPTIONS_MSK;
@@ -2476,7 +2476,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2476 this->erase_cmd = single_erase_cmd; 2476 this->erase_cmd = single_erase_cmd;
2477 2477
2478 /* Do not replace user supplied command function ! */ 2478 /* Do not replace user supplied command function ! */
2479 if (mtd->oobblock > 512 && this->cmdfunc == nand_command) 2479 if (mtd->writesize > 512 && this->cmdfunc == nand_command)
2480 this->cmdfunc = nand_command_lp; 2480 this->cmdfunc = nand_command_lp;
2481 2481
2482 printk(KERN_INFO "NAND device: Manufacturer ID:" 2482 printk(KERN_INFO "NAND device: Manufacturer ID:"
@@ -2519,7 +2519,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2519 2519
2520 if (!this->data_buf) { 2520 if (!this->data_buf) {
2521 size_t len; 2521 size_t len;
2522 len = mtd->oobblock + mtd->oobsize; 2522 len = mtd->writesize + mtd->oobsize;
2523 this->data_buf = kmalloc(len, GFP_KERNEL); 2523 this->data_buf = kmalloc(len, GFP_KERNEL);
2524 if (!this->data_buf) { 2524 if (!this->data_buf) {
2525 if (this->options & NAND_OOBBUF_ALLOC) 2525 if (this->options & NAND_OOBBUF_ALLOC)
@@ -2575,9 +2575,9 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2575 2575
2576 switch (this->eccmode) { 2576 switch (this->eccmode) {
2577 case NAND_ECC_HW12_2048: 2577 case NAND_ECC_HW12_2048:
2578 if (mtd->oobblock < 2048) { 2578 if (mtd->writesize < 2048) {
2579 printk(KERN_WARNING "2048 byte HW ECC not possible on %d byte page size, fallback to SW ECC\n", 2579 printk(KERN_WARNING "2048 byte HW ECC not possible on %d byte page size, fallback to SW ECC\n",
2580 mtd->oobblock); 2580 mtd->writesize);
2581 this->eccmode = NAND_ECC_SOFT; 2581 this->eccmode = NAND_ECC_SOFT;
2582 this->calculate_ecc = nand_calculate_ecc; 2582 this->calculate_ecc = nand_calculate_ecc;
2583 this->correct_data = nand_correct_data; 2583 this->correct_data = nand_correct_data;
@@ -2588,7 +2588,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2588 case NAND_ECC_HW3_512: 2588 case NAND_ECC_HW3_512:
2589 case NAND_ECC_HW6_512: 2589 case NAND_ECC_HW6_512:
2590 case NAND_ECC_HW8_512: 2590 case NAND_ECC_HW8_512:
2591 if (mtd->oobblock == 256) { 2591 if (mtd->writesize == 256) {
2592 printk(KERN_WARNING "512 byte HW ECC not possible on 256 Byte pagesize, fallback to SW ECC \n"); 2592 printk(KERN_WARNING "512 byte HW ECC not possible on 256 Byte pagesize, fallback to SW ECC \n");
2593 this->eccmode = NAND_ECC_SOFT; 2593 this->eccmode = NAND_ECC_SOFT;
2594 this->calculate_ecc = nand_calculate_ecc; 2594 this->calculate_ecc = nand_calculate_ecc;
@@ -2638,16 +2638,16 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
2638 /* Set the number of read / write steps for one page to ensure ECC generation */ 2638 /* Set the number of read / write steps for one page to ensure ECC generation */
2639 switch (this->eccmode) { 2639 switch (this->eccmode) {
2640 case NAND_ECC_HW12_2048: 2640 case NAND_ECC_HW12_2048:
2641 this->eccsteps = mtd->oobblock / 2048; 2641 this->eccsteps = mtd->writesize / 2048;
2642 break; 2642 break;
2643 case NAND_ECC_HW3_512: 2643 case NAND_ECC_HW3_512:
2644 case NAND_ECC_HW6_512: 2644 case NAND_ECC_HW6_512:
2645 case NAND_ECC_HW8_512: 2645 case NAND_ECC_HW8_512:
2646 this->eccsteps = mtd->oobblock / 512; 2646 this->eccsteps = mtd->writesize / 512;
2647 break; 2647 break;
2648 case NAND_ECC_HW3_256: 2648 case NAND_ECC_HW3_256:
2649 case NAND_ECC_SOFT: 2649 case NAND_ECC_SOFT:
2650 this->eccsteps = mtd->oobblock / 256; 2650 this->eccsteps = mtd->writesize / 256;
2651 break; 2651 break;
2652 2652
2653 case NAND_ECC_NONE: 2653 case NAND_ECC_NONE:
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 }
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 6903f5b903c6..8674f1e9d3c6 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -369,7 +369,7 @@ init_nandsim(struct mtd_info *mtd)
369 /* Initialize the NAND flash parameters */ 369 /* Initialize the NAND flash parameters */
370 ns->busw = chip->options & NAND_BUSWIDTH_16 ? 16 : 8; 370 ns->busw = chip->options & NAND_BUSWIDTH_16 ? 16 : 8;
371 ns->geom.totsz = mtd->size; 371 ns->geom.totsz = mtd->size;
372 ns->geom.pgsz = mtd->oobblock; 372 ns->geom.pgsz = mtd->writesize;
373 ns->geom.oobsz = mtd->oobsize; 373 ns->geom.oobsz = mtd->oobsize;
374 ns->geom.secsz = mtd->erasesize; 374 ns->geom.secsz = mtd->erasesize;
375 ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; 375 ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz;
diff --git a/drivers/mtd/nand/rtc_from4.c b/drivers/mtd/nand/rtc_from4.c
index bc9d849fbd5d..64ccf4c9613f 100644
--- a/drivers/mtd/nand/rtc_from4.c
+++ b/drivers/mtd/nand/rtc_from4.c
@@ -487,7 +487,7 @@ static int rtc_from4_errstat(struct mtd_info *mtd, struct nand_chip *this, int s
487 if (!(rtn & ERR_STAT_ECC_AVAILABLE)) { 487 if (!(rtn & ERR_STAT_ECC_AVAILABLE)) {
488 er_stat |= 1 << 1; /* err_ecc_not_avail */ 488 er_stat |= 1 << 1; /* err_ecc_not_avail */
489 } else { 489 } else {
490 len = mtd->oobblock; 490 len = mtd->writesize;
491 buf = kmalloc(len, GFP_KERNEL); 491 buf = kmalloc(len, GFP_KERNEL);
492 if (!buf) { 492 if (!buf) {
493 printk(KERN_ERR "rtc_from4_errstat: Out of memory!\n"); 493 printk(KERN_ERR "rtc_from4_errstat: Out of memory!\n");