diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-23 06:37:31 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-23 06:37:31 -0400 |
commit | 4cbb9b80e171107c6c34116283fe38e5a396c68b (patch) | |
tree | 9463f2e4774f14752cf4bb52431e14e569256f72 /drivers/mtd | |
parent | 6dfc6d250d0b7ebaa6423c44dcd09fcfe68deabd (diff) | |
parent | 9fe4854cd1f60273f9a3ece053f4789605f58a5e (diff) |
Merge branch 'master' of /home/tglx/work/kernel/git/mtd-2.6/
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 6 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0020.c | 5 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2000.c | 2 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2001.c | 2 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2001plus.c | 2 | ||||
-rw-r--r-- | drivers/mtd/mtdconcat.c | 10 | ||||
-rw-r--r-- | drivers/mtd/mtdpart.c | 2 | ||||
-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 | ||||
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 74 | ||||
-rw-r--r-- | drivers/mtd/onenand/onenand_bbt.c | 4 |
15 files changed, 112 insertions, 113 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index d0d5e521b564..0d435814aaa1 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -545,12 +545,12 @@ static int cfi_intelext_partition_fixup(struct mtd_info *mtd, | |||
545 | if (extp->MinorVersion >= '4') { | 545 | if (extp->MinorVersion >= '4') { |
546 | struct cfi_intelext_programming_regioninfo *prinfo; | 546 | struct cfi_intelext_programming_regioninfo *prinfo; |
547 | prinfo = (struct cfi_intelext_programming_regioninfo *)&extp->extra[offs]; | 547 | prinfo = (struct cfi_intelext_programming_regioninfo *)&extp->extra[offs]; |
548 | MTD_PROGREGION_SIZE(mtd) = cfi->interleave << prinfo->ProgRegShift; | 548 | mtd->writesize = cfi->interleave << prinfo->ProgRegShift; |
549 | MTD_PROGREGION_CTRLMODE_VALID(mtd) = cfi->interleave * prinfo->ControlValid; | 549 | MTD_PROGREGION_CTRLMODE_VALID(mtd) = cfi->interleave * prinfo->ControlValid; |
550 | MTD_PROGREGION_CTRLMODE_INVALID(mtd) = cfi->interleave * prinfo->ControlInvalid; | 550 | MTD_PROGREGION_CTRLMODE_INVALID(mtd) = cfi->interleave * prinfo->ControlInvalid; |
551 | mtd->flags |= MTD_PROGRAM_REGIONS; | 551 | mtd->flags &= ~MTD_BIT_WRITEABLE; |
552 | printk(KERN_DEBUG "%s: program region size/ctrl_valid/ctrl_inval = %d/%d/%d\n", | 552 | printk(KERN_DEBUG "%s: program region size/ctrl_valid/ctrl_inval = %d/%d/%d\n", |
553 | map->name, MTD_PROGREGION_SIZE(mtd), | 553 | map->name, mtd->writesize, |
554 | MTD_PROGREGION_CTRLMODE_VALID(mtd), | 554 | MTD_PROGREGION_CTRLMODE_VALID(mtd), |
555 | MTD_PROGREGION_CTRLMODE_INVALID(mtd)); | 555 | MTD_PROGREGION_CTRLMODE_INVALID(mtd)); |
556 | } | 556 | } |
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c index 3911c98ba578..fae70a5db540 100644 --- a/drivers/mtd/chips/cfi_cmdset_0020.c +++ b/drivers/mtd/chips/cfi_cmdset_0020.c | |||
@@ -238,9 +238,8 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map) | |||
238 | mtd->unlock = cfi_staa_unlock; | 238 | mtd->unlock = cfi_staa_unlock; |
239 | mtd->suspend = cfi_staa_suspend; | 239 | mtd->suspend = cfi_staa_suspend; |
240 | mtd->resume = cfi_staa_resume; | 240 | mtd->resume = cfi_staa_resume; |
241 | mtd->flags = MTD_CAP_NORFLASH; | 241 | mtd->flags = MTD_CAP_NORFLASH & ~MTD_BIT_WRITEABLE; |
242 | mtd->flags |= MTD_ECC; /* FIXME: Not all STMicro flashes have this */ | 242 | mtd->writesize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */ |
243 | mtd->eccsize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */ | ||
244 | map->fldrv = &cfi_staa_chipdrv; | 243 | map->fldrv = &cfi_staa_chipdrv; |
245 | __module_get(THIS_MODULE); | 244 | __module_get(THIS_MODULE); |
246 | mtd->name = map->name; | 245 | mtd->name = map->name; |
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index 40cc20f6d164..423a34f4638c 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c | |||
@@ -579,7 +579,7 @@ void DoC2k_init(struct mtd_info *mtd) | |||
579 | mtd->ecctype = MTD_ECC_RS_DiskOnChip; | 579 | mtd->ecctype = MTD_ECC_RS_DiskOnChip; |
580 | mtd->size = 0; | 580 | mtd->size = 0; |
581 | mtd->erasesize = 0; | 581 | mtd->erasesize = 0; |
582 | mtd->oobblock = 512; | 582 | mtd->writesize = 512; |
583 | mtd->oobsize = 16; | 583 | mtd->oobsize = 16; |
584 | mtd->owner = THIS_MODULE; | 584 | mtd->owner = THIS_MODULE; |
585 | mtd->erase = doc_erase; | 585 | mtd->erase = doc_erase; |
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c index 1670eb8b9755..e6eaef28a2b0 100644 --- a/drivers/mtd/devices/doc2001.c +++ b/drivers/mtd/devices/doc2001.c | |||
@@ -361,7 +361,7 @@ void DoCMil_init(struct mtd_info *mtd) | |||
361 | /* FIXME: erase size is not always 8KiB */ | 361 | /* FIXME: erase size is not always 8KiB */ |
362 | mtd->erasesize = 0x2000; | 362 | mtd->erasesize = 0x2000; |
363 | 363 | ||
364 | mtd->oobblock = 512; | 364 | mtd->writesize = 512; |
365 | mtd->oobsize = 16; | 365 | mtd->oobsize = 16; |
366 | mtd->owner = THIS_MODULE; | 366 | mtd->owner = THIS_MODULE; |
367 | mtd->erase = doc_erase; | 367 | mtd->erase = doc_erase; |
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c index 0dc5d108f7b5..8422c5e92d27 100644 --- a/drivers/mtd/devices/doc2001plus.c +++ b/drivers/mtd/devices/doc2001plus.c | |||
@@ -483,7 +483,7 @@ void DoCMilPlus_init(struct mtd_info *mtd) | |||
483 | mtd->size = 0; | 483 | mtd->size = 0; |
484 | 484 | ||
485 | mtd->erasesize = 0; | 485 | mtd->erasesize = 0; |
486 | mtd->oobblock = 512; | 486 | mtd->writesize = 512; |
487 | mtd->oobsize = 16; | 487 | mtd->oobsize = 16; |
488 | mtd->owner = THIS_MODULE; | 488 | mtd->owner = THIS_MODULE; |
489 | mtd->erase = doc_erase; | 489 | mtd->erase = doc_erase; |
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 3c61a980c56c..a5e8373349a5 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -278,9 +278,9 @@ concat_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | |||
278 | return -EINVAL; | 278 | return -EINVAL; |
279 | 279 | ||
280 | /* Check alignment */ | 280 | /* Check alignment */ |
281 | if (mtd->oobblock > 1) { | 281 | if (mtd->writesize > 1) { |
282 | loff_t __to = to; | 282 | loff_t __to = to; |
283 | if (do_div(__to, mtd->oobblock) || (total_len % mtd->oobblock)) | 283 | if (do_div(__to, mtd->writesize) || (total_len % mtd->writesize)) |
284 | return -EINVAL; | 284 | return -EINVAL; |
285 | } | 285 | } |
286 | 286 | ||
@@ -334,7 +334,7 @@ concat_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | |||
334 | *retlen += retsize; | 334 | *retlen += retsize; |
335 | total_len -= wsize; | 335 | total_len -= wsize; |
336 | if (concat->mtd.type == MTD_NANDFLASH && eccbuf) | 336 | if (concat->mtd.type == MTD_NANDFLASH && eccbuf) |
337 | eccbuf += mtd->oobavail * (wsize / mtd->oobblock); | 337 | eccbuf += mtd->oobavail * (wsize / mtd->writesize); |
338 | 338 | ||
339 | if (total_len == 0) | 339 | if (total_len == 0) |
340 | break; | 340 | break; |
@@ -833,7 +833,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
833 | concat->mtd.flags = subdev[0]->flags; | 833 | concat->mtd.flags = subdev[0]->flags; |
834 | concat->mtd.size = subdev[0]->size; | 834 | concat->mtd.size = subdev[0]->size; |
835 | concat->mtd.erasesize = subdev[0]->erasesize; | 835 | concat->mtd.erasesize = subdev[0]->erasesize; |
836 | concat->mtd.oobblock = subdev[0]->oobblock; | 836 | concat->mtd.writesize = subdev[0]->writesize; |
837 | concat->mtd.oobsize = subdev[0]->oobsize; | 837 | concat->mtd.oobsize = subdev[0]->oobsize; |
838 | concat->mtd.ecctype = subdev[0]->ecctype; | 838 | concat->mtd.ecctype = subdev[0]->ecctype; |
839 | concat->mtd.eccsize = subdev[0]->eccsize; | 839 | concat->mtd.eccsize = subdev[0]->eccsize; |
@@ -881,7 +881,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
881 | subdev[i]->flags & MTD_WRITEABLE; | 881 | subdev[i]->flags & MTD_WRITEABLE; |
882 | } | 882 | } |
883 | concat->mtd.size += subdev[i]->size; | 883 | concat->mtd.size += subdev[i]->size; |
884 | if (concat->mtd.oobblock != subdev[i]->oobblock || | 884 | if (concat->mtd.writesize != subdev[i]->writesize || |
885 | concat->mtd.oobsize != subdev[i]->oobsize || | 885 | concat->mtd.oobsize != subdev[i]->oobsize || |
886 | concat->mtd.ecctype != subdev[i]->ecctype || | 886 | concat->mtd.ecctype != subdev[i]->ecctype || |
887 | concat->mtd.eccsize != subdev[i]->eccsize || | 887 | concat->mtd.eccsize != subdev[i]->eccsize || |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 29ed5abe70c4..082662f90481 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -398,7 +398,7 @@ int add_mtd_partitions(struct mtd_info *master, | |||
398 | slave->mtd.type = master->type; | 398 | slave->mtd.type = master->type; |
399 | slave->mtd.flags = master->flags & ~parts[i].mask_flags; | 399 | slave->mtd.flags = master->flags & ~parts[i].mask_flags; |
400 | slave->mtd.size = parts[i].size; | 400 | slave->mtd.size = parts[i].size; |
401 | slave->mtd.oobblock = master->oobblock; | 401 | slave->mtd.writesize = master->writesize; |
402 | slave->mtd.oobsize = master->oobsize; | 402 | slave->mtd.oobsize = master->oobsize; |
403 | slave->mtd.oobavail = master->oobavail; | 403 | slave->mtd.oobavail = master->oobavail; |
404 | slave->mtd.ecctype = master->ecctype; | 404 | slave->mtd.ecctype = master->ecctype; |
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"); |
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index fe5b48997275..4c2c61d54b3a 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c | |||
@@ -354,7 +354,7 @@ static inline int onenand_bufferram_offset(struct mtd_info *mtd, int area) | |||
354 | 354 | ||
355 | if (ONENAND_CURRENT_BUFFERRAM(this)) { | 355 | if (ONENAND_CURRENT_BUFFERRAM(this)) { |
356 | if (area == ONENAND_DATARAM) | 356 | if (area == ONENAND_DATARAM) |
357 | return mtd->oobblock; | 357 | return mtd->writesize; |
358 | if (area == ONENAND_SPARERAM) | 358 | if (area == ONENAND_SPARERAM) |
359 | return mtd->oobsize; | 359 | return mtd->oobsize; |
360 | } | 360 | } |
@@ -632,14 +632,14 @@ static int onenand_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
632 | /* TODO handling oob */ | 632 | /* TODO handling oob */ |
633 | 633 | ||
634 | while (read < len) { | 634 | while (read < len) { |
635 | thislen = min_t(int, mtd->oobblock, len - read); | 635 | thislen = min_t(int, mtd->writesize, len - read); |
636 | 636 | ||
637 | column = from & (mtd->oobblock - 1); | 637 | column = from & (mtd->writesize - 1); |
638 | if (column + thislen > mtd->oobblock) | 638 | if (column + thislen > mtd->writesize) |
639 | thislen = mtd->oobblock - column; | 639 | thislen = mtd->writesize - column; |
640 | 640 | ||
641 | if (!onenand_check_bufferram(mtd, from)) { | 641 | if (!onenand_check_bufferram(mtd, from)) { |
642 | this->command(mtd, ONENAND_CMD_READ, from, mtd->oobblock); | 642 | this->command(mtd, ONENAND_CMD_READ, from, mtd->writesize); |
643 | 643 | ||
644 | ret = this->wait(mtd, FL_READING); | 644 | ret = this->wait(mtd, FL_READING); |
645 | /* First copy data and check return value for ECC handling */ | 645 | /* First copy data and check return value for ECC handling */ |
@@ -752,7 +752,7 @@ static int onenand_read_oob(struct mtd_info *mtd, loff_t from, size_t len, | |||
752 | /* Read more? */ | 752 | /* Read more? */ |
753 | if (read < len) { | 753 | if (read < len) { |
754 | /* Page size */ | 754 | /* Page size */ |
755 | from += mtd->oobblock; | 755 | from += mtd->writesize; |
756 | column = 0; | 756 | column = 0; |
757 | } | 757 | } |
758 | } | 758 | } |
@@ -809,7 +809,7 @@ static int onenand_verify_page(struct mtd_info *mtd, u_char *buf, loff_t addr) | |||
809 | void __iomem *dataram0, *dataram1; | 809 | void __iomem *dataram0, *dataram1; |
810 | int ret = 0; | 810 | int ret = 0; |
811 | 811 | ||
812 | this->command(mtd, ONENAND_CMD_READ, addr, mtd->oobblock); | 812 | this->command(mtd, ONENAND_CMD_READ, addr, mtd->writesize); |
813 | 813 | ||
814 | ret = this->wait(mtd, FL_READING); | 814 | ret = this->wait(mtd, FL_READING); |
815 | if (ret) | 815 | if (ret) |
@@ -819,9 +819,9 @@ static int onenand_verify_page(struct mtd_info *mtd, u_char *buf, loff_t addr) | |||
819 | 819 | ||
820 | /* Check, if the two dataram areas are same */ | 820 | /* Check, if the two dataram areas are same */ |
821 | dataram0 = this->base + ONENAND_DATARAM; | 821 | dataram0 = this->base + ONENAND_DATARAM; |
822 | dataram1 = dataram0 + mtd->oobblock; | 822 | dataram1 = dataram0 + mtd->writesize; |
823 | 823 | ||
824 | if (memcmp(dataram0, dataram1, mtd->oobblock)) | 824 | if (memcmp(dataram0, dataram1, mtd->writesize)) |
825 | return -EBADMSG; | 825 | return -EBADMSG; |
826 | 826 | ||
827 | return 0; | 827 | return 0; |
@@ -831,7 +831,7 @@ static int onenand_verify_page(struct mtd_info *mtd, u_char *buf, loff_t addr) | |||
831 | #define onenand_verify_oob(...) (0) | 831 | #define onenand_verify_oob(...) (0) |
832 | #endif | 832 | #endif |
833 | 833 | ||
834 | #define NOTALIGNED(x) ((x & (mtd->oobblock - 1)) != 0) | 834 | #define NOTALIGNED(x) ((x & (mtd->writesize - 1)) != 0) |
835 | 835 | ||
836 | /** | 836 | /** |
837 | * onenand_write_ecc - [MTD Interface] OneNAND write with ECC | 837 | * onenand_write_ecc - [MTD Interface] OneNAND write with ECC |
@@ -875,14 +875,14 @@ static int onenand_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
875 | 875 | ||
876 | /* Loop until all data write */ | 876 | /* Loop until all data write */ |
877 | while (written < len) { | 877 | while (written < len) { |
878 | int thislen = min_t(int, mtd->oobblock, len - written); | 878 | int thislen = min_t(int, mtd->writesize, len - written); |
879 | 879 | ||
880 | this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->oobblock); | 880 | this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->writesize); |
881 | 881 | ||
882 | this->write_bufferram(mtd, ONENAND_DATARAM, buf, 0, thislen); | 882 | this->write_bufferram(mtd, ONENAND_DATARAM, buf, 0, thislen); |
883 | this->write_bufferram(mtd, ONENAND_SPARERAM, ffchars, 0, mtd->oobsize); | 883 | this->write_bufferram(mtd, ONENAND_SPARERAM, ffchars, 0, mtd->oobsize); |
884 | 884 | ||
885 | this->command(mtd, ONENAND_CMD_PROG, to, mtd->oobblock); | 885 | this->command(mtd, ONENAND_CMD_PROG, to, mtd->writesize); |
886 | 886 | ||
887 | onenand_update_bufferram(mtd, to, 1); | 887 | onenand_update_bufferram(mtd, to, 1); |
888 | 888 | ||
@@ -1070,10 +1070,10 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | |||
1070 | * If the given tuple is >= pagesize then | 1070 | * If the given tuple is >= pagesize then |
1071 | * write it out from the iov | 1071 | * write it out from the iov |
1072 | */ | 1072 | */ |
1073 | if ((vecs->iov_len - len) >= mtd->oobblock) { | 1073 | if ((vecs->iov_len - len) >= mtd->writesize) { |
1074 | pbuf = vecs->iov_base + len; | 1074 | pbuf = vecs->iov_base + len; |
1075 | 1075 | ||
1076 | len += mtd->oobblock; | 1076 | len += mtd->writesize; |
1077 | 1077 | ||
1078 | /* Check, if we have to switch to the next tuple */ | 1078 | /* Check, if we have to switch to the next tuple */ |
1079 | if (len >= (int) vecs->iov_len) { | 1079 | if (len >= (int) vecs->iov_len) { |
@@ -1083,8 +1083,8 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | |||
1083 | } | 1083 | } |
1084 | } else { | 1084 | } else { |
1085 | int cnt = 0, thislen; | 1085 | int cnt = 0, thislen; |
1086 | while (cnt < mtd->oobblock) { | 1086 | while (cnt < mtd->writesize) { |
1087 | thislen = min_t(int, mtd->oobblock - cnt, vecs->iov_len - len); | 1087 | thislen = min_t(int, mtd->writesize - cnt, vecs->iov_len - len); |
1088 | memcpy(this->page_buf + cnt, vecs->iov_base + len, thislen); | 1088 | memcpy(this->page_buf + cnt, vecs->iov_base + len, thislen); |
1089 | cnt += thislen; | 1089 | cnt += thislen; |
1090 | len += thislen; | 1090 | len += thislen; |
@@ -1098,12 +1098,12 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | |||
1098 | } | 1098 | } |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->oobblock); | 1101 | this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->writesize); |
1102 | 1102 | ||
1103 | this->write_bufferram(mtd, ONENAND_DATARAM, pbuf, 0, mtd->oobblock); | 1103 | this->write_bufferram(mtd, ONENAND_DATARAM, pbuf, 0, mtd->writesize); |
1104 | this->write_bufferram(mtd, ONENAND_SPARERAM, ffchars, 0, mtd->oobsize); | 1104 | this->write_bufferram(mtd, ONENAND_SPARERAM, ffchars, 0, mtd->oobsize); |
1105 | 1105 | ||
1106 | this->command(mtd, ONENAND_CMD_PROG, to, mtd->oobblock); | 1106 | this->command(mtd, ONENAND_CMD_PROG, to, mtd->writesize); |
1107 | 1107 | ||
1108 | onenand_update_bufferram(mtd, to, 1); | 1108 | onenand_update_bufferram(mtd, to, 1); |
1109 | 1109 | ||
@@ -1121,9 +1121,9 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | |||
1121 | goto out; | 1121 | goto out; |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | written += mtd->oobblock; | 1124 | written += mtd->writesize; |
1125 | 1125 | ||
1126 | to += mtd->oobblock; | 1126 | to += mtd->writesize; |
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | out: | 1129 | out: |
@@ -1467,11 +1467,11 @@ static int do_otp_write(struct mtd_info *mtd, loff_t from, size_t len, | |||
1467 | int ret; | 1467 | int ret; |
1468 | 1468 | ||
1469 | /* Force buffer page aligned */ | 1469 | /* Force buffer page aligned */ |
1470 | if (len < mtd->oobblock) { | 1470 | if (len < mtd->writesize) { |
1471 | memcpy(this->page_buf, buf, len); | 1471 | memcpy(this->page_buf, buf, len); |
1472 | memset(this->page_buf + len, 0xff, mtd->oobblock - len); | 1472 | memset(this->page_buf + len, 0xff, mtd->writesize - len); |
1473 | pbuf = this->page_buf; | 1473 | pbuf = this->page_buf; |
1474 | len = mtd->oobblock; | 1474 | len = mtd->writesize; |
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | /* Enter OTP access mode */ | 1477 | /* Enter OTP access mode */ |
@@ -1546,12 +1546,12 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len, | |||
1546 | otp_pages = 10; | 1546 | otp_pages = 10; |
1547 | 1547 | ||
1548 | if (mode == MTD_OTP_FACTORY) { | 1548 | if (mode == MTD_OTP_FACTORY) { |
1549 | from += mtd->oobblock * otp_pages; | 1549 | from += mtd->writesize * otp_pages; |
1550 | otp_pages = 64 - otp_pages; | 1550 | otp_pages = 64 - otp_pages; |
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | /* Check User/Factory boundary */ | 1553 | /* Check User/Factory boundary */ |
1554 | if (((mtd->oobblock * otp_pages) - (from + len)) < 0) | 1554 | if (((mtd->writesize * otp_pages) - (from + len)) < 0) |
1555 | return 0; | 1555 | return 0; |
1556 | 1556 | ||
1557 | while (len > 0 && otp_pages > 0) { | 1557 | while (len > 0 && otp_pages > 0) { |
@@ -1564,10 +1564,10 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len, | |||
1564 | 1564 | ||
1565 | otpinfo = (struct otp_info *) buf; | 1565 | otpinfo = (struct otp_info *) buf; |
1566 | otpinfo->start = from; | 1566 | otpinfo->start = from; |
1567 | otpinfo->length = mtd->oobblock; | 1567 | otpinfo->length = mtd->writesize; |
1568 | otpinfo->locked = 0; | 1568 | otpinfo->locked = 0; |
1569 | 1569 | ||
1570 | from += mtd->oobblock; | 1570 | from += mtd->writesize; |
1571 | buf += sizeof(struct otp_info); | 1571 | buf += sizeof(struct otp_info); |
1572 | *retlen += sizeof(struct otp_info); | 1572 | *retlen += sizeof(struct otp_info); |
1573 | } else { | 1573 | } else { |
@@ -1811,15 +1811,15 @@ static int onenand_probe(struct mtd_info *mtd) | |||
1811 | 1811 | ||
1812 | /* OneNAND page size & block size */ | 1812 | /* OneNAND page size & block size */ |
1813 | /* The data buffer size is equal to page size */ | 1813 | /* The data buffer size is equal to page size */ |
1814 | mtd->oobblock = this->read_word(this->base + ONENAND_REG_DATA_BUFFER_SIZE); | 1814 | mtd->writesize = this->read_word(this->base + ONENAND_REG_DATA_BUFFER_SIZE); |
1815 | mtd->oobsize = mtd->oobblock >> 5; | 1815 | mtd->oobsize = mtd->writesize >> 5; |
1816 | /* Pagers per block is always 64 in OneNAND */ | 1816 | /* Pagers per block is always 64 in OneNAND */ |
1817 | mtd->erasesize = mtd->oobblock << 6; | 1817 | mtd->erasesize = mtd->writesize << 6; |
1818 | 1818 | ||
1819 | this->erase_shift = ffs(mtd->erasesize) - 1; | 1819 | this->erase_shift = ffs(mtd->erasesize) - 1; |
1820 | this->page_shift = ffs(mtd->oobblock) - 1; | 1820 | this->page_shift = ffs(mtd->writesize) - 1; |
1821 | this->ppb_shift = (this->erase_shift - this->page_shift); | 1821 | this->ppb_shift = (this->erase_shift - this->page_shift); |
1822 | this->page_mask = (mtd->erasesize / mtd->oobblock) - 1; | 1822 | this->page_mask = (mtd->erasesize / mtd->writesize) - 1; |
1823 | 1823 | ||
1824 | /* REVIST: Multichip handling */ | 1824 | /* REVIST: Multichip handling */ |
1825 | 1825 | ||
@@ -1909,7 +1909,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) | |||
1909 | /* Allocate buffers, if necessary */ | 1909 | /* Allocate buffers, if necessary */ |
1910 | if (!this->page_buf) { | 1910 | if (!this->page_buf) { |
1911 | size_t len; | 1911 | size_t len; |
1912 | len = mtd->oobblock + mtd->oobsize; | 1912 | len = mtd->writesize + mtd->oobsize; |
1913 | this->page_buf = kmalloc(len, GFP_KERNEL); | 1913 | this->page_buf = kmalloc(len, GFP_KERNEL); |
1914 | if (!this->page_buf) { | 1914 | if (!this->page_buf) { |
1915 | printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); | 1915 | printk(KERN_ERR "onenand_scan(): Can't allocate page_buf\n"); |
@@ -1943,7 +1943,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) | |||
1943 | 1943 | ||
1944 | /* Fill in remaining MTD driver data */ | 1944 | /* Fill in remaining MTD driver data */ |
1945 | mtd->type = MTD_NANDFLASH; | 1945 | mtd->type = MTD_NANDFLASH; |
1946 | mtd->flags = MTD_CAP_NANDFLASH | MTD_ECC; | 1946 | mtd->flags = MTD_CAP_NANDFLASH; |
1947 | mtd->ecctype = MTD_ECC_SW; | 1947 | mtd->ecctype = MTD_ECC_SW; |
1948 | mtd->erase = onenand_erase; | 1948 | mtd->erase = onenand_erase; |
1949 | mtd->point = NULL; | 1949 | mtd->point = NULL; |
diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c index 4510d3361eaa..aafd7c2f7802 100644 --- a/drivers/mtd/onenand/onenand_bbt.c +++ b/drivers/mtd/onenand/onenand_bbt.c | |||
@@ -87,13 +87,13 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr | |||
87 | 87 | ||
88 | /* No need to read pages fully, | 88 | /* No need to read pages fully, |
89 | * just read required OOB bytes */ | 89 | * just read required OOB bytes */ |
90 | ret = mtd->read_oob(mtd, from + j * mtd->oobblock + bd->offs, | 90 | ret = mtd->read_oob(mtd, from + j * mtd->writesize + bd->offs, |
91 | readlen, &retlen, &buf[0]); | 91 | readlen, &retlen, &buf[0]); |
92 | 92 | ||
93 | if (ret) | 93 | if (ret) |
94 | return ret; | 94 | return ret; |
95 | 95 | ||
96 | if (check_short_pattern(&buf[j * scanlen], scanlen, mtd->oobblock, bd)) { | 96 | if (check_short_pattern(&buf[j * scanlen], scanlen, mtd->writesize, bd)) { |
97 | bbm->bbt[i >> 3] |= 0x03 << (i & 0x6); | 97 | bbm->bbt[i >> 3] |= 0x03 << (i & 0x6); |
98 | printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n", | 98 | printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n", |
99 | i >> 1, (unsigned int) from); | 99 | i >> 1, (unsigned int) from); |