diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-20 17:50:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-20 17:50:31 -0400 |
commit | be967b7e2f7747a5ebf2a07ee627d9338491e784 (patch) | |
tree | f42b82601209a52b8ee478e36d8b21543ab03060 /drivers/mtd/devices/doc2001plus.c | |
parent | eef11427edcb821b63920219f89379fab84198b9 (diff) | |
parent | 7bc3312bef4d6f220812500c0de7868fb7625a41 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (199 commits)
[MTD] NAND: Fix breakage all over the place
[PATCH] NAND: fix remaining OOB length calculation
[MTD] NAND Fixup NDFC merge brokeness
[MTD NAND] S3C2410 driver cleanup
[MTD NAND] s3c24x0 board: Fix clock handling, ensure proper initialisation.
[JFFS2] Check CRC32 on dirent and data nodes each time they're read
[JFFS2] When retiring nextblock, allocate a node_ref for the wasted space
[JFFS2] Mark XATTR support as experimental, for now
[JFFS2] Don't trust node headers before the CRC is checked.
[MTD] Restore MTD_ROM and MTD_RAM types
[MTD] assume mtd->writesize is 1 for NOR flashes
[MTD NAND] Fix s3c2410 NAND driver so it at least _looks_ like it compiles
[MTD] Prepare physmap for 64-bit-resources
[JFFS2] Fix more breakage caused by janitorial meddling.
[JFFS2] Remove stray __exit from jffs2_compressors_exit()
[MTD] Allow alternate JFFS2 mount variant for root filesystem.
[MTD] Disconnect struct mtd_info from ABI
[MTD] replace MTD_RAM with MTD_GENERIC_TYPE
[MTD] replace MTD_ROM with MTD_GENERIC_TYPE
[MTD] remove a forgotten MTD_XIP
...
Diffstat (limited to 'drivers/mtd/devices/doc2001plus.c')
-rw-r--r-- | drivers/mtd/devices/doc2001plus.c | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c index 5f57f29efee4..66cb1e50469a 100644 --- a/drivers/mtd/devices/doc2001plus.c +++ b/drivers/mtd/devices/doc2001plus.c | |||
@@ -47,10 +47,10 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
47 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | 47 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, |
48 | size_t *retlen, const u_char *buf, u_char *eccbuf, | 48 | size_t *retlen, const u_char *buf, u_char *eccbuf, |
49 | struct nand_oobinfo *oobsel); | 49 | struct nand_oobinfo *oobsel); |
50 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 50 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
51 | size_t *retlen, u_char *buf); | 51 | struct mtd_oob_ops *ops); |
52 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 52 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
53 | size_t *retlen, const u_char *buf); | 53 | struct mtd_oob_ops *ops); |
54 | static int doc_erase (struct mtd_info *mtd, struct erase_info *instr); | 54 | static int doc_erase (struct mtd_info *mtd, struct erase_info *instr); |
55 | 55 | ||
56 | static struct mtd_info *docmilpluslist = NULL; | 56 | static struct mtd_info *docmilpluslist = NULL; |
@@ -447,16 +447,9 @@ static int DoCMilPlus_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2) | |||
447 | return retval; | 447 | return retval; |
448 | } | 448 | } |
449 | 449 | ||
450 | static const char im_name[] = "DoCMilPlus_init"; | 450 | /* This routine is found from the docprobe code by symbol_get(), |
451 | 451 | * which will bump the use count of this module. */ | |
452 | /* This routine is made available to other mtd code via | 452 | void DoCMilPlus_init(struct mtd_info *mtd) |
453 | * inter_module_register. It must only be accessed through | ||
454 | * inter_module_get which will bump the use count of this module. The | ||
455 | * addresses passed back in mtd are valid as long as the use count of | ||
456 | * this module is non-zero, i.e. between inter_module_get and | ||
457 | * inter_module_put. Keith Owens <kaos@ocs.com.au> 29 Oct 2000. | ||
458 | */ | ||
459 | static void DoCMilPlus_init(struct mtd_info *mtd) | ||
460 | { | 453 | { |
461 | struct DiskOnChip *this = mtd->priv; | 454 | struct DiskOnChip *this = mtd->priv; |
462 | struct DiskOnChip *old = NULL; | 455 | struct DiskOnChip *old = NULL; |
@@ -490,7 +483,7 @@ static void DoCMilPlus_init(struct mtd_info *mtd) | |||
490 | mtd->size = 0; | 483 | mtd->size = 0; |
491 | 484 | ||
492 | mtd->erasesize = 0; | 485 | mtd->erasesize = 0; |
493 | mtd->oobblock = 512; | 486 | mtd->writesize = 512; |
494 | mtd->oobsize = 16; | 487 | mtd->oobsize = 16; |
495 | mtd->owner = THIS_MODULE; | 488 | mtd->owner = THIS_MODULE; |
496 | mtd->erase = doc_erase; | 489 | mtd->erase = doc_erase; |
@@ -498,8 +491,6 @@ static void DoCMilPlus_init(struct mtd_info *mtd) | |||
498 | mtd->unpoint = NULL; | 491 | mtd->unpoint = NULL; |
499 | mtd->read = doc_read; | 492 | mtd->read = doc_read; |
500 | mtd->write = doc_write; | 493 | mtd->write = doc_write; |
501 | mtd->read_ecc = doc_read_ecc; | ||
502 | mtd->write_ecc = doc_write_ecc; | ||
503 | mtd->read_oob = doc_read_oob; | 494 | mtd->read_oob = doc_read_oob; |
504 | mtd->write_oob = doc_write_oob; | 495 | mtd->write_oob = doc_write_oob; |
505 | mtd->sync = NULL; | 496 | mtd->sync = NULL; |
@@ -524,6 +515,7 @@ static void DoCMilPlus_init(struct mtd_info *mtd) | |||
524 | return; | 515 | return; |
525 | } | 516 | } |
526 | } | 517 | } |
518 | EXPORT_SYMBOL_GPL(DoCMilPlus_init); | ||
527 | 519 | ||
528 | #if 0 | 520 | #if 0 |
529 | static int doc_dumpblk(struct mtd_info *mtd, loff_t from) | 521 | static int doc_dumpblk(struct mtd_info *mtd, loff_t from) |
@@ -876,14 +868,20 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
876 | return ret; | 868 | return ret; |
877 | } | 869 | } |
878 | 870 | ||
879 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 871 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
880 | size_t *retlen, u_char *buf) | 872 | struct mtd_oob_ops *ops) |
881 | { | 873 | { |
882 | loff_t fofs, base; | 874 | loff_t fofs, base; |
883 | struct DiskOnChip *this = mtd->priv; | 875 | struct DiskOnChip *this = mtd->priv; |
884 | void __iomem * docptr = this->virtadr; | 876 | void __iomem * docptr = this->virtadr; |
885 | struct Nand *mychip = &this->chips[ofs >> this->chipshift]; | 877 | struct Nand *mychip = &this->chips[ofs >> this->chipshift]; |
886 | size_t i, size, got, want; | 878 | size_t i, size, got, want; |
879 | uint8_t *buf = ops->oobbuf; | ||
880 | size_t len = ops->len; | ||
881 | |||
882 | BUG_ON(ops->mode != MTD_OOB_PLACE); | ||
883 | |||
884 | ofs += ops->ooboffs; | ||
887 | 885 | ||
888 | DoC_CheckASIC(docptr); | 886 | DoC_CheckASIC(docptr); |
889 | 887 | ||
@@ -949,12 +947,12 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
949 | /* Disable flash internally */ | 947 | /* Disable flash internally */ |
950 | WriteDOC(0, docptr, Mplus_FlashSelect); | 948 | WriteDOC(0, docptr, Mplus_FlashSelect); |
951 | 949 | ||
952 | *retlen = len; | 950 | ops->retlen = len; |
953 | return 0; | 951 | return 0; |
954 | } | 952 | } |
955 | 953 | ||
956 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 954 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
957 | size_t *retlen, const u_char *buf) | 955 | struct mtd_oob_ops *ops) |
958 | { | 956 | { |
959 | volatile char dummy; | 957 | volatile char dummy; |
960 | loff_t fofs, base; | 958 | loff_t fofs, base; |
@@ -963,6 +961,12 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
963 | struct Nand *mychip = &this->chips[ofs >> this->chipshift]; | 961 | struct Nand *mychip = &this->chips[ofs >> this->chipshift]; |
964 | size_t i, size, got, want; | 962 | size_t i, size, got, want; |
965 | int ret = 0; | 963 | int ret = 0; |
964 | uint8_t *buf = ops->oobbuf; | ||
965 | size_t len = ops->len; | ||
966 | |||
967 | BUG_ON(ops->mode != MTD_OOB_PLACE); | ||
968 | |||
969 | ofs += ops->ooboffs; | ||
966 | 970 | ||
967 | DoC_CheckASIC(docptr); | 971 | DoC_CheckASIC(docptr); |
968 | 972 | ||
@@ -1038,7 +1042,7 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
1038 | printk("MTD: Error 0x%x programming oob at 0x%x\n", | 1042 | printk("MTD: Error 0x%x programming oob at 0x%x\n", |
1039 | dummy, (int)ofs); | 1043 | dummy, (int)ofs); |
1040 | /* FIXME: implement Bad Block Replacement */ | 1044 | /* FIXME: implement Bad Block Replacement */ |
1041 | *retlen = 0; | 1045 | ops->retlen = 0; |
1042 | ret = -EIO; | 1046 | ret = -EIO; |
1043 | } | 1047 | } |
1044 | dummy = ReadDOC(docptr, Mplus_LastDataRead); | 1048 | dummy = ReadDOC(docptr, Mplus_LastDataRead); |
@@ -1051,7 +1055,7 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
1051 | /* Disable flash internally */ | 1055 | /* Disable flash internally */ |
1052 | WriteDOC(0, docptr, Mplus_FlashSelect); | 1056 | WriteDOC(0, docptr, Mplus_FlashSelect); |
1053 | 1057 | ||
1054 | *retlen = len; | 1058 | ops->retlen = len; |
1055 | return ret; | 1059 | return ret; |
1056 | } | 1060 | } |
1057 | 1061 | ||
@@ -1122,12 +1126,6 @@ int doc_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
1122 | * | 1126 | * |
1123 | ****************************************************************************/ | 1127 | ****************************************************************************/ |
1124 | 1128 | ||
1125 | static int __init init_doc2001plus(void) | ||
1126 | { | ||
1127 | inter_module_register(im_name, THIS_MODULE, &DoCMilPlus_init); | ||
1128 | return 0; | ||
1129 | } | ||
1130 | |||
1131 | static void __exit cleanup_doc2001plus(void) | 1129 | static void __exit cleanup_doc2001plus(void) |
1132 | { | 1130 | { |
1133 | struct mtd_info *mtd; | 1131 | struct mtd_info *mtd; |
@@ -1143,11 +1141,9 @@ static void __exit cleanup_doc2001plus(void) | |||
1143 | kfree(this->chips); | 1141 | kfree(this->chips); |
1144 | kfree(mtd); | 1142 | kfree(mtd); |
1145 | } | 1143 | } |
1146 | inter_module_unregister(im_name); | ||
1147 | } | 1144 | } |
1148 | 1145 | ||
1149 | module_exit(cleanup_doc2001plus); | 1146 | module_exit(cleanup_doc2001plus); |
1150 | module_init(init_doc2001plus); | ||
1151 | 1147 | ||
1152 | MODULE_LICENSE("GPL"); | 1148 | MODULE_LICENSE("GPL"); |
1153 | MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com> et al."); | 1149 | MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com> et al."); |