diff options
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/au1550nd.c | 4 | ||||
-rw-r--r-- | drivers/mtd/nand/diskonchip.c | 16 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 64 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 30 | ||||
-rw-r--r-- | drivers/mtd/nand/nandsim.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/rtc_from4.c | 2 |
6 files changed, 59 insertions, 59 deletions
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c index d7f04abfe18e..29dde7dcafa1 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 128c937af32f..b771608ef84e 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 98792ec4c2dc..778535006c83 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -572,9 +572,9 @@ static void nand_command(struct mtd_info *mtd, unsigned command, int column, | |||
572 | if (command == NAND_CMD_SEQIN) { | 572 | if (command == NAND_CMD_SEQIN) { |
573 | int readcmd; | 573 | int readcmd; |
574 | 574 | ||
575 | if (column >= mtd->oobblock) { | 575 | if (column >= mtd->writesize) { |
576 | /* OOB area */ | 576 | /* OOB area */ |
577 | column -= mtd->oobblock; | 577 | column -= mtd->writesize; |
578 | readcmd = NAND_CMD_READOOB; | 578 | readcmd = NAND_CMD_READOOB; |
579 | } else if (column < 256) { | 579 | } else if (column < 256) { |
580 | /* First 256 bytes --> READ0 */ | 580 | /* First 256 bytes --> READ0 */ |
@@ -670,7 +670,7 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned command, int column, | |||
670 | 670 | ||
671 | /* Emulate NAND_CMD_READOOB */ | 671 | /* Emulate NAND_CMD_READOOB */ |
672 | if (command == NAND_CMD_READOOB) { | 672 | if (command == NAND_CMD_READOOB) { |
673 | column += mtd->oobblock; | 673 | column += mtd->writesize; |
674 | command = NAND_CMD_READ0; | 674 | command = NAND_CMD_READ0; |
675 | } | 675 | } |
676 | 676 | ||
@@ -895,7 +895,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int pag | |||
895 | /* No ecc, write all */ | 895 | /* No ecc, write all */ |
896 | case NAND_ECC_NONE: | 896 | case NAND_ECC_NONE: |
897 | printk(KERN_WARNING "Writing data without ECC to NAND-FLASH is not recommended\n"); | 897 | printk(KERN_WARNING "Writing data without ECC to NAND-FLASH is not recommended\n"); |
898 | this->write_buf(mtd, this->data_poi, mtd->oobblock); | 898 | this->write_buf(mtd, this->data_poi, mtd->writesize); |
899 | break; | 899 | break; |
900 | 900 | ||
901 | /* Software ecc 3/256, write all */ | 901 | /* Software ecc 3/256, write all */ |
@@ -906,7 +906,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *this, int pag | |||
906 | oob_buf[oob_config[eccidx]] = ecc_code[i]; | 906 | oob_buf[oob_config[eccidx]] = ecc_code[i]; |
907 | datidx += this->ecc.size; | 907 | datidx += this->ecc.size; |
908 | } | 908 | } |
909 | this->write_buf(mtd, this->data_poi, mtd->oobblock); | 909 | this->write_buf(mtd, this->data_poi, mtd->writesize); |
910 | break; | 910 | break; |
911 | default: | 911 | default: |
912 | eccbytes = this->ecc.bytes; | 912 | eccbytes = this->ecc.bytes; |
@@ -1167,9 +1167,9 @@ int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
1167 | page = realpage & this->pagemask; | 1167 | page = realpage & this->pagemask; |
1168 | 1168 | ||
1169 | /* Get raw starting column */ | 1169 | /* Get raw starting column */ |
1170 | col = from & (mtd->oobblock - 1); | 1170 | col = from & (mtd->writesize - 1); |
1171 | 1171 | ||
1172 | end = mtd->oobblock; | 1172 | end = mtd->writesize; |
1173 | ecc = this->ecc.size; | 1173 | ecc = this->ecc.size; |
1174 | eccbytes = this->ecc.bytes; | 1174 | eccbytes = this->ecc.bytes; |
1175 | 1175 | ||
@@ -1327,7 +1327,7 @@ int nand_do_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
1327 | buf[read++] = data_poi[j]; | 1327 | buf[read++] = data_poi[j]; |
1328 | this->pagebuf = realpage; | 1328 | this->pagebuf = realpage; |
1329 | } else | 1329 | } else |
1330 | read += mtd->oobblock; | 1330 | read += mtd->writesize; |
1331 | 1331 | ||
1332 | /* Apply delay or wait for ready/busy pin | 1332 | /* Apply delay or wait for ready/busy pin |
1333 | * Do this before the AUTOINCR check, so no problems | 1333 | * Do this before the AUTOINCR check, so no problems |
@@ -1485,7 +1485,7 @@ int nand_read_raw(struct mtd_info *mtd, uint8_t *buf, loff_t from, size_t len, s | |||
1485 | int chip = (int)(from >> this->chip_shift); | 1485 | int chip = (int)(from >> this->chip_shift); |
1486 | int sndcmd = 1; | 1486 | int sndcmd = 1; |
1487 | int cnt = 0; | 1487 | int cnt = 0; |
1488 | int pagesize = mtd->oobblock + mtd->oobsize; | 1488 | int pagesize = mtd->writesize + mtd->oobsize; |
1489 | int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1; | 1489 | int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1; |
1490 | 1490 | ||
1491 | /* Do not allow reads past end of device */ | 1491 | /* Do not allow reads past end of device */ |
@@ -1587,7 +1587,7 @@ static uint8_t *nand_prepare_oobbuf(struct mtd_info *mtd, uint8_t *fsbuf, struct | |||
1587 | return this->oob_buf; | 1587 | return this->oob_buf; |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | #define NOTALIGNED(x) (x & (mtd->oobblock-1)) != 0 | 1590 | #define NOTALIGNED(x) (x & (mtd->writesize-1)) != 0 |
1591 | 1591 | ||
1592 | /** | 1592 | /** |
1593 | * nand_write - [MTD Interface] compability function for nand_write_ecc | 1593 | * nand_write - [MTD Interface] compability function for nand_write_ecc |
@@ -1700,7 +1700,7 @@ static int nand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
1700 | /* Next oob page */ | 1700 | /* Next oob page */ |
1701 | oob += mtd->oobsize; | 1701 | oob += mtd->oobsize; |
1702 | /* Update written bytes count */ | 1702 | /* Update written bytes count */ |
1703 | written += mtd->oobblock; | 1703 | written += mtd->writesize; |
1704 | if (written == len) | 1704 | if (written == len) |
1705 | goto cmp; | 1705 | goto cmp; |
1706 | 1706 | ||
@@ -1811,7 +1811,7 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to, size_t len, size_t *r | |||
1811 | 1811 | ||
1812 | if (NAND_MUST_PAD(this)) { | 1812 | if (NAND_MUST_PAD(this)) { |
1813 | /* Write out desired data */ | 1813 | /* Write out desired data */ |
1814 | this->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->oobblock, page & this->pagemask); | 1814 | this->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize, page & this->pagemask); |
1815 | /* prepad 0xff for partial programming */ | 1815 | /* prepad 0xff for partial programming */ |
1816 | this->write_buf(mtd, ffchars, column); | 1816 | this->write_buf(mtd, ffchars, column); |
1817 | /* write data */ | 1817 | /* write data */ |
@@ -1820,7 +1820,7 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to, size_t len, size_t *r | |||
1820 | this->write_buf(mtd, ffchars, mtd->oobsize - (len + column)); | 1820 | this->write_buf(mtd, ffchars, mtd->oobsize - (len + column)); |
1821 | } else { | 1821 | } else { |
1822 | /* Write out desired data */ | 1822 | /* Write out desired data */ |
1823 | this->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->oobblock + column, page & this->pagemask); | 1823 | this->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize + column, page & this->pagemask); |
1824 | /* write data */ | 1824 | /* write data */ |
1825 | this->write_buf(mtd, buf, len); | 1825 | this->write_buf(mtd, buf, len); |
1826 | } | 1826 | } |
@@ -1953,7 +1953,7 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign | |||
1953 | /* If the given tuple is >= pagesize then | 1953 | /* If the given tuple is >= pagesize then |
1954 | * write it out from the iov | 1954 | * write it out from the iov |
1955 | */ | 1955 | */ |
1956 | if ((vecs->iov_len - len) >= mtd->oobblock) { | 1956 | if ((vecs->iov_len - len) >= mtd->writesize) { |
1957 | /* Calc number of pages we can write | 1957 | /* Calc number of pages we can write |
1958 | * out of this iov in one go */ | 1958 | * out of this iov in one go */ |
1959 | numpages = (vecs->iov_len - len) >> this->page_shift; | 1959 | numpages = (vecs->iov_len - len) >> this->page_shift; |
@@ -1973,8 +1973,8 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign | |||
1973 | &oobbuf[oob], oobsel, i != numpages); | 1973 | &oobbuf[oob], oobsel, i != numpages); |
1974 | if (ret) | 1974 | if (ret) |
1975 | goto out; | 1975 | goto out; |
1976 | this->data_poi += mtd->oobblock; | 1976 | this->data_poi += mtd->writesize; |
1977 | len += mtd->oobblock; | 1977 | len += mtd->writesize; |
1978 | oob += mtd->oobsize; | 1978 | oob += mtd->oobsize; |
1979 | page++; | 1979 | page++; |
1980 | } | 1980 | } |
@@ -1989,7 +1989,7 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign | |||
1989 | * tuple until we have a full page to write | 1989 | * tuple until we have a full page to write |
1990 | */ | 1990 | */ |
1991 | int cnt = 0; | 1991 | int cnt = 0; |
1992 | while (cnt < mtd->oobblock) { | 1992 | while (cnt < mtd->writesize) { |
1993 | if (vecs->iov_base != NULL && vecs->iov_len) | 1993 | if (vecs->iov_base != NULL && vecs->iov_len) |
1994 | this->data_buf[cnt++] = ((uint8_t *) vecs->iov_base)[len++]; | 1994 | this->data_buf[cnt++] = ((uint8_t *) vecs->iov_base)[len++]; |
1995 | /* Check, if we have to switch to the next tuple */ | 1995 | /* Check, if we have to switch to the next tuple */ |
@@ -2015,7 +2015,7 @@ static int nand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, unsign | |||
2015 | if (ret) | 2015 | if (ret) |
2016 | goto out; | 2016 | goto out; |
2017 | 2017 | ||
2018 | written += mtd->oobblock * numpages; | 2018 | written += mtd->writesize * numpages; |
2019 | /* All done ? */ | 2019 | /* All done ? */ |
2020 | if (!count) | 2020 | if (!count) |
2021 | break; | 2021 | break; |
@@ -2351,7 +2351,7 @@ static int nand_allocate_kmem(struct mtd_info *mtd, struct nand_chip *this) | |||
2351 | } | 2351 | } |
2352 | 2352 | ||
2353 | if (!this->data_buf) { | 2353 | if (!this->data_buf) { |
2354 | len = mtd->oobblock + mtd->oobsize; | 2354 | len = mtd->writesize + mtd->oobsize; |
2355 | this->data_buf = kmalloc(len, GFP_KERNEL); | 2355 | this->data_buf = kmalloc(len, GFP_KERNEL); |
2356 | if (!this->data_buf) | 2356 | if (!this->data_buf) |
2357 | goto outerr; | 2357 | goto outerr; |
@@ -2455,10 +2455,10 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2455 | /* The 4th id byte is the important one */ | 2455 | /* The 4th id byte is the important one */ |
2456 | extid = this->read_byte(mtd); | 2456 | extid = this->read_byte(mtd); |
2457 | /* Calc pagesize */ | 2457 | /* Calc pagesize */ |
2458 | mtd->oobblock = 1024 << (extid & 0x3); | 2458 | mtd->writesize = 1024 << (extid & 0x3); |
2459 | extid >>= 2; | 2459 | extid >>= 2; |
2460 | /* Calc oobsize */ | 2460 | /* Calc oobsize */ |
2461 | mtd->oobsize = (8 << (extid & 0x01)) * (mtd->oobblock >> 9); | 2461 | mtd->oobsize = (8 << (extid & 0x01)) * (mtd->writesize >> 9); |
2462 | extid >>= 2; | 2462 | extid >>= 2; |
2463 | /* Calc blocksize. Blocksize is multiples of 64KiB */ | 2463 | /* Calc blocksize. Blocksize is multiples of 64KiB */ |
2464 | mtd->erasesize = (64 * 1024) << (extid & 0x03); | 2464 | mtd->erasesize = (64 * 1024) << (extid & 0x03); |
@@ -2471,8 +2471,8 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2471 | * Old devices have this data hardcoded in the device id table | 2471 | * Old devices have this data hardcoded in the device id table |
2472 | */ | 2472 | */ |
2473 | mtd->erasesize = nand_flash_ids[i].erasesize; | 2473 | mtd->erasesize = nand_flash_ids[i].erasesize; |
2474 | mtd->oobblock = nand_flash_ids[i].pagesize; | 2474 | mtd->writesize = nand_flash_ids[i].pagesize; |
2475 | mtd->oobsize = mtd->oobblock / 32; | 2475 | mtd->oobsize = mtd->writesize / 32; |
2476 | busw = nand_flash_ids[i].options & NAND_BUSWIDTH_16; | 2476 | busw = nand_flash_ids[i].options & NAND_BUSWIDTH_16; |
2477 | } | 2477 | } |
2478 | 2478 | ||
@@ -2497,7 +2497,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2497 | } | 2497 | } |
2498 | 2498 | ||
2499 | /* Calculate the address shift from the page size */ | 2499 | /* Calculate the address shift from the page size */ |
2500 | this->page_shift = ffs(mtd->oobblock) - 1; | 2500 | this->page_shift = ffs(mtd->writesize) - 1; |
2501 | /* Convert chipsize to number of pages per chip -1. */ | 2501 | /* Convert chipsize to number of pages per chip -1. */ |
2502 | this->pagemask = (this->chipsize >> this->page_shift) - 1; | 2502 | this->pagemask = (this->chipsize >> this->page_shift) - 1; |
2503 | 2503 | ||
@@ -2506,7 +2506,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2506 | this->chip_shift = ffs(this->chipsize) - 1; | 2506 | this->chip_shift = ffs(this->chipsize) - 1; |
2507 | 2507 | ||
2508 | /* Set the bad block position */ | 2508 | /* Set the bad block position */ |
2509 | this->badblockpos = mtd->oobblock > 512 ? | 2509 | this->badblockpos = mtd->writesize > 512 ? |
2510 | NAND_LARGE_BADBLOCK_POS : NAND_SMALL_BADBLOCK_POS; | 2510 | NAND_LARGE_BADBLOCK_POS : NAND_SMALL_BADBLOCK_POS; |
2511 | 2511 | ||
2512 | /* Get chip options, preserve non chip based options */ | 2512 | /* Get chip options, preserve non chip based options */ |
@@ -2531,7 +2531,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2531 | this->erase_cmd = single_erase_cmd; | 2531 | this->erase_cmd = single_erase_cmd; |
2532 | 2532 | ||
2533 | /* Do not replace user supplied command function ! */ | 2533 | /* Do not replace user supplied command function ! */ |
2534 | if (mtd->oobblock > 512 && this->cmdfunc == nand_command) | 2534 | if (mtd->writesize > 512 && this->cmdfunc == nand_command) |
2535 | this->cmdfunc = nand_command_lp; | 2535 | this->cmdfunc = nand_command_lp; |
2536 | 2536 | ||
2537 | printk(KERN_INFO "NAND device: Manufacturer ID:" | 2537 | printk(KERN_INFO "NAND device: Manufacturer ID:" |
@@ -2657,11 +2657,11 @@ int nand_scan(struct mtd_info *mtd, int maxchips) | |||
2657 | "Hardware ECC not possible\n"); | 2657 | "Hardware ECC not possible\n"); |
2658 | BUG(); | 2658 | BUG(); |
2659 | } | 2659 | } |
2660 | if (mtd->oobblock >= this->ecc.size) | 2660 | if (mtd->writesize >= this->ecc.size) |
2661 | break; | 2661 | break; |
2662 | printk(KERN_WARNING "%d byte HW ECC not possible on " | 2662 | printk(KERN_WARNING "%d byte HW ECC not possible on " |
2663 | "%d byte page size, fallback to SW ECC\n", | 2663 | "%d byte page size, fallback to SW ECC\n", |
2664 | this->ecc.size, mtd->oobblock); | 2664 | this->ecc.size, mtd->writesize); |
2665 | this->ecc.mode = NAND_ECC_SOFT; | 2665 | this->ecc.mode = NAND_ECC_SOFT; |
2666 | 2666 | ||
2667 | case NAND_ECC_SOFT: | 2667 | case NAND_ECC_SOFT: |
@@ -2674,7 +2674,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips) | |||
2674 | case NAND_ECC_NONE: | 2674 | case NAND_ECC_NONE: |
2675 | printk(KERN_WARNING "NAND_ECC_NONE selected by board driver. " | 2675 | printk(KERN_WARNING "NAND_ECC_NONE selected by board driver. " |
2676 | "This is not recommended !!\n"); | 2676 | "This is not recommended !!\n"); |
2677 | this->ecc.size = mtd->oobblock; | 2677 | this->ecc.size = mtd->writesize; |
2678 | this->ecc.bytes = 0; | 2678 | this->ecc.bytes = 0; |
2679 | break; | 2679 | break; |
2680 | default: | 2680 | default: |
@@ -2687,8 +2687,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips) | |||
2687 | * Set the number of read / write steps for one page depending on ECC | 2687 | * Set the number of read / write steps for one page depending on ECC |
2688 | * mode | 2688 | * mode |
2689 | */ | 2689 | */ |
2690 | this->ecc.steps = mtd->oobblock / this->ecc.size; | 2690 | this->ecc.steps = mtd->writesize / this->ecc.size; |
2691 | if(this->ecc.steps * this->ecc.size != mtd->oobblock) { | 2691 | if(this->ecc.steps * this->ecc.size != mtd->writesize) { |
2692 | printk(KERN_WARNING "Invalid ecc parameters\n"); | 2692 | printk(KERN_WARNING "Invalid ecc parameters\n"); |
2693 | BUG(); | 2693 | BUG(); |
2694 | } | 2694 | } |
@@ -2706,7 +2706,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips) | |||
2706 | 2706 | ||
2707 | /* Fill in remaining MTD driver data */ | 2707 | /* Fill in remaining MTD driver data */ |
2708 | mtd->type = MTD_NANDFLASH; | 2708 | mtd->type = MTD_NANDFLASH; |
2709 | mtd->flags = MTD_CAP_NANDFLASH | MTD_ECC; | 2709 | mtd->flags = MTD_CAP_NANDFLASH; |
2710 | mtd->ecctype = MTD_ECC_SW; | 2710 | mtd->ecctype = MTD_ECC_SW; |
2711 | mtd->erase = nand_erase; | 2711 | mtd->erase = nand_erase; |
2712 | mtd->point = NULL; | 2712 | mtd->point = NULL; |
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 9008bc5493fb..22af9b29d2bf 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 a2122fe4101a..f8e631c89a60 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"); |