diff options
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r-- | drivers/mtd/devices/Kconfig | 6 | ||||
-rw-r--r-- | drivers/mtd/devices/Makefile | 7 | ||||
-rw-r--r-- | drivers/mtd/devices/block2mtd.c | 27 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2000.c | 129 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2001.c | 60 | ||||
-rw-r--r-- | drivers/mtd/devices/doc2001plus.c | 60 | ||||
-rw-r--r-- | drivers/mtd/devices/docprobe.c | 26 | ||||
-rw-r--r-- | drivers/mtd/devices/lart.c | 1 | ||||
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 1 | ||||
-rw-r--r-- | drivers/mtd/devices/ms02-nv.c | 2 | ||||
-rw-r--r-- | drivers/mtd/devices/mtdram.c | 1 | ||||
-rw-r--r-- | drivers/mtd/devices/phram.c | 16 | ||||
-rw-r--r-- | drivers/mtd/devices/slram.c | 3 |
13 files changed, 135 insertions, 204 deletions
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index 7fac438b5c32..16c02b5ccf7e 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig | |||
@@ -47,6 +47,11 @@ config MTD_MS02NV | |||
47 | accelerator. Say Y here if you have a DECstation 5000/2x0 or a | 47 | accelerator. Say Y here if you have a DECstation 5000/2x0 or a |
48 | DECsystem 5900 equipped with such a module. | 48 | DECsystem 5900 equipped with such a module. |
49 | 49 | ||
50 | If you want to compile this driver as a module ( = code which can be | ||
51 | inserted in and removed from the running kernel whenever you want), | ||
52 | say M here and read <file:Documentation/modules.txt>. The module will | ||
53 | be called ms02-nv.o. | ||
54 | |||
50 | config MTD_DATAFLASH | 55 | config MTD_DATAFLASH |
51 | tristate "Support for AT45xxx DataFlash" | 56 | tristate "Support for AT45xxx DataFlash" |
52 | depends on MTD && SPI_MASTER && EXPERIMENTAL | 57 | depends on MTD && SPI_MASTER && EXPERIMENTAL |
@@ -209,7 +214,6 @@ config MTD_DOC2001PLUS | |||
209 | config MTD_DOCPROBE | 214 | config MTD_DOCPROBE |
210 | tristate | 215 | tristate |
211 | select MTD_DOCECC | 216 | select MTD_DOCECC |
212 | select OBSOLETE_INTERMODULE | ||
213 | 217 | ||
214 | config MTD_DOCECC | 218 | config MTD_DOCECC |
215 | tristate | 219 | tristate |
diff --git a/drivers/mtd/devices/Makefile b/drivers/mtd/devices/Makefile index b6573670316f..0f788d5c4bf8 100644 --- a/drivers/mtd/devices/Makefile +++ b/drivers/mtd/devices/Makefile | |||
@@ -3,13 +3,6 @@ | |||
3 | # | 3 | # |
4 | # $Id: Makefile.common,v 1.7 2004/12/22 17:51:15 joern Exp $ | 4 | # $Id: Makefile.common,v 1.7 2004/12/22 17:51:15 joern Exp $ |
5 | 5 | ||
6 | # *** BIG UGLY NOTE *** | ||
7 | # | ||
8 | # The removal of get_module_symbol() and replacement with | ||
9 | # inter_module_register() et al has introduced a link order dependency | ||
10 | # here where previously there was none. We now have to ensure that | ||
11 | # doc200[01].o are linked before docprobe.o | ||
12 | |||
13 | obj-$(CONFIG_MTD_DOC2000) += doc2000.o | 6 | obj-$(CONFIG_MTD_DOC2000) += doc2000.o |
14 | obj-$(CONFIG_MTD_DOC2001) += doc2001.o | 7 | obj-$(CONFIG_MTD_DOC2001) += doc2001.o |
15 | obj-$(CONFIG_MTD_DOC2001PLUS) += doc2001plus.o | 8 | obj-$(CONFIG_MTD_DOC2001PLUS) += doc2001plus.o |
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 4160b8334c53..0d98c223c5fc 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * block2mtd.c - create an mtd from a block device | 4 | * block2mtd.c - create an mtd from a block device |
5 | * | 5 | * |
6 | * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk> | 6 | * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk> |
7 | * Copyright (C) 2004,2005 J๖rn Engel <joern@wh.fh-wedel.de> | 7 | * Copyright (C) 2004-2006 Jรถrn Engel <joern@wh.fh-wedel.de> |
8 | * | 8 | * |
9 | * Licence: GPL | 9 | * Licence: GPL |
10 | */ | 10 | */ |
@@ -331,7 +331,6 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) | |||
331 | dev->mtd.writev = default_mtd_writev; | 331 | dev->mtd.writev = default_mtd_writev; |
332 | dev->mtd.sync = block2mtd_sync; | 332 | dev->mtd.sync = block2mtd_sync; |
333 | dev->mtd.read = block2mtd_read; | 333 | dev->mtd.read = block2mtd_read; |
334 | dev->mtd.readv = default_mtd_readv; | ||
335 | dev->mtd.priv = dev; | 334 | dev->mtd.priv = dev; |
336 | dev->mtd.owner = THIS_MODULE; | 335 | dev->mtd.owner = THIS_MODULE; |
337 | 336 | ||
@@ -351,6 +350,12 @@ devinit_err: | |||
351 | } | 350 | } |
352 | 351 | ||
353 | 352 | ||
353 | /* This function works similar to reguler strtoul. In addition, it | ||
354 | * allows some suffixes for a more human-readable number format: | ||
355 | * ki, Ki, kiB, KiB - multiply result with 1024 | ||
356 | * Mi, MiB - multiply result with 1024^2 | ||
357 | * Gi, GiB - multiply result with 1024^3 | ||
358 | */ | ||
354 | static int ustrtoul(const char *cp, char **endp, unsigned int base) | 359 | static int ustrtoul(const char *cp, char **endp, unsigned int base) |
355 | { | 360 | { |
356 | unsigned long result = simple_strtoul(cp, endp, base); | 361 | unsigned long result = simple_strtoul(cp, endp, base); |
@@ -359,11 +364,16 @@ static int ustrtoul(const char *cp, char **endp, unsigned int base) | |||
359 | result *= 1024; | 364 | result *= 1024; |
360 | case 'M': | 365 | case 'M': |
361 | result *= 1024; | 366 | result *= 1024; |
367 | case 'K': | ||
362 | case 'k': | 368 | case 'k': |
363 | result *= 1024; | 369 | result *= 1024; |
364 | /* By dwmw2 editorial decree, "ki", "Mi" or "Gi" are to be used. */ | 370 | /* By dwmw2 editorial decree, "ki", "Mi" or "Gi" are to be used. */ |
365 | if ((*endp)[1] == 'i') | 371 | if ((*endp)[1] == 'i') { |
366 | (*endp) += 2; | 372 | if ((*endp)[2] == 'B') |
373 | (*endp) += 3; | ||
374 | else | ||
375 | (*endp) += 2; | ||
376 | } | ||
367 | } | 377 | } |
368 | return result; | 378 | return result; |
369 | } | 379 | } |
@@ -418,7 +428,8 @@ static inline void kill_final_newline(char *str) | |||
418 | 428 | ||
419 | static int block2mtd_setup(const char *val, struct kernel_param *kp) | 429 | static int block2mtd_setup(const char *val, struct kernel_param *kp) |
420 | { | 430 | { |
421 | char buf[80+12], *str=buf; /* 80 for device, 12 for erase size */ | 431 | char buf[80+12]; /* 80 for device, 12 for erase size */ |
432 | char *str = buf; | ||
422 | char *token[2]; | 433 | char *token[2]; |
423 | char *name; | 434 | char *name; |
424 | size_t erase_size = PAGE_SIZE; | 435 | size_t erase_size = PAGE_SIZE; |
@@ -430,7 +441,7 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp) | |||
430 | strcpy(str, val); | 441 | strcpy(str, val); |
431 | kill_final_newline(str); | 442 | kill_final_newline(str); |
432 | 443 | ||
433 | for (i=0; i<2; i++) | 444 | for (i = 0; i < 2; i++) |
434 | token[i] = strsep(&str, ","); | 445 | token[i] = strsep(&str, ","); |
435 | 446 | ||
436 | if (str) | 447 | if (str) |
@@ -449,8 +460,10 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp) | |||
449 | 460 | ||
450 | if (token[1]) { | 461 | if (token[1]) { |
451 | ret = parse_num(&erase_size, token[1]); | 462 | ret = parse_num(&erase_size, token[1]); |
452 | if (ret) | 463 | if (ret) { |
464 | kfree(name); | ||
453 | parse_err("illegal erase size"); | 465 | parse_err("illegal erase size"); |
466 | } | ||
454 | } | 467 | } |
455 | 468 | ||
456 | add_device(name, erase_size); | 469 | add_device(name, erase_size); |
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index 23e7a5c7d2c1..c54e40464d82 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c | |||
@@ -59,13 +59,10 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
59 | size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); | 59 | size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); |
60 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | 60 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, |
61 | size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); | 61 | size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel); |
62 | static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | 62 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
63 | unsigned long count, loff_t to, size_t *retlen, | 63 | struct mtd_oob_ops *ops); |
64 | u_char *eccbuf, struct nand_oobinfo *oobsel); | 64 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
65 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 65 | struct mtd_oob_ops *ops); |
66 | size_t *retlen, u_char *buf); | ||
67 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | ||
68 | size_t *retlen, const u_char *buf); | ||
69 | static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len, | 66 | static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len, |
70 | size_t *retlen, const u_char *buf); | 67 | size_t *retlen, const u_char *buf); |
71 | static int doc_erase (struct mtd_info *mtd, struct erase_info *instr); | 68 | static int doc_erase (struct mtd_info *mtd, struct erase_info *instr); |
@@ -517,16 +514,9 @@ static int DoC2k_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2) | |||
517 | return retval; | 514 | return retval; |
518 | } | 515 | } |
519 | 516 | ||
520 | static const char im_name[] = "DoC2k_init"; | 517 | /* This routine is found from the docprobe code by symbol_get(), |
521 | 518 | * which will bump the use count of this module. */ | |
522 | /* This routine is made available to other mtd code via | 519 | void DoC2k_init(struct mtd_info *mtd) |
523 | * inter_module_register. It must only be accessed through | ||
524 | * inter_module_get which will bump the use count of this module. The | ||
525 | * addresses passed back in mtd are valid as long as the use count of | ||
526 | * this module is non-zero, i.e. between inter_module_get and | ||
527 | * inter_module_put. Keith Owens <kaos@ocs.com.au> 29 Oct 2000. | ||
528 | */ | ||
529 | static void DoC2k_init(struct mtd_info *mtd) | ||
530 | { | 520 | { |
531 | struct DiskOnChip *this = mtd->priv; | 521 | struct DiskOnChip *this = mtd->priv; |
532 | struct DiskOnChip *old = NULL; | 522 | struct DiskOnChip *old = NULL; |
@@ -586,7 +576,7 @@ static void DoC2k_init(struct mtd_info *mtd) | |||
586 | mtd->ecctype = MTD_ECC_RS_DiskOnChip; | 576 | mtd->ecctype = MTD_ECC_RS_DiskOnChip; |
587 | mtd->size = 0; | 577 | mtd->size = 0; |
588 | mtd->erasesize = 0; | 578 | mtd->erasesize = 0; |
589 | mtd->oobblock = 512; | 579 | mtd->writesize = 512; |
590 | mtd->oobsize = 16; | 580 | mtd->oobsize = 16; |
591 | mtd->owner = THIS_MODULE; | 581 | mtd->owner = THIS_MODULE; |
592 | mtd->erase = doc_erase; | 582 | mtd->erase = doc_erase; |
@@ -594,9 +584,6 @@ static void DoC2k_init(struct mtd_info *mtd) | |||
594 | mtd->unpoint = NULL; | 584 | mtd->unpoint = NULL; |
595 | mtd->read = doc_read; | 585 | mtd->read = doc_read; |
596 | mtd->write = doc_write; | 586 | mtd->write = doc_write; |
597 | mtd->read_ecc = doc_read_ecc; | ||
598 | mtd->write_ecc = doc_write_ecc; | ||
599 | mtd->writev_ecc = doc_writev_ecc; | ||
600 | mtd->read_oob = doc_read_oob; | 587 | mtd->read_oob = doc_read_oob; |
601 | mtd->write_oob = doc_write_oob; | 588 | mtd->write_oob = doc_write_oob; |
602 | mtd->sync = NULL; | 589 | mtd->sync = NULL; |
@@ -623,6 +610,7 @@ static void DoC2k_init(struct mtd_info *mtd) | |||
623 | return; | 610 | return; |
624 | } | 611 | } |
625 | } | 612 | } |
613 | EXPORT_SYMBOL_GPL(DoC2k_init); | ||
626 | 614 | ||
627 | static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | 615 | static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, |
628 | size_t * retlen, u_char * buf) | 616 | size_t * retlen, u_char * buf) |
@@ -971,72 +959,18 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | |||
971 | return 0; | 959 | return 0; |
972 | } | 960 | } |
973 | 961 | ||
974 | static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, | 962 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
975 | unsigned long count, loff_t to, size_t *retlen, | 963 | struct mtd_oob_ops *ops) |
976 | u_char *eccbuf, struct nand_oobinfo *oobsel) | ||
977 | { | ||
978 | static char static_buf[512]; | ||
979 | static DEFINE_MUTEX(writev_buf_mutex); | ||
980 | |||
981 | size_t totretlen = 0; | ||
982 | size_t thisvecofs = 0; | ||
983 | int ret= 0; | ||
984 | |||
985 | mutex_lock(&writev_buf_mutex); | ||
986 | |||
987 | while(count) { | ||
988 | size_t thislen, thisretlen; | ||
989 | unsigned char *buf; | ||
990 | |||
991 | buf = vecs->iov_base + thisvecofs; | ||
992 | thislen = vecs->iov_len - thisvecofs; | ||
993 | |||
994 | |||
995 | if (thislen >= 512) { | ||
996 | thislen = thislen & ~(512-1); | ||
997 | thisvecofs += thislen; | ||
998 | } else { | ||
999 | /* Not enough to fill a page. Copy into buf */ | ||
1000 | memcpy(static_buf, buf, thislen); | ||
1001 | buf = &static_buf[thislen]; | ||
1002 | |||
1003 | while(count && thislen < 512) { | ||
1004 | vecs++; | ||
1005 | count--; | ||
1006 | thisvecofs = min((512-thislen), vecs->iov_len); | ||
1007 | memcpy(buf, vecs->iov_base, thisvecofs); | ||
1008 | thislen += thisvecofs; | ||
1009 | buf += thisvecofs; | ||
1010 | } | ||
1011 | buf = static_buf; | ||
1012 | } | ||
1013 | if (count && thisvecofs == vecs->iov_len) { | ||
1014 | thisvecofs = 0; | ||
1015 | vecs++; | ||
1016 | count--; | ||
1017 | } | ||
1018 | ret = doc_write_ecc(mtd, to, thislen, &thisretlen, buf, eccbuf, oobsel); | ||
1019 | |||
1020 | totretlen += thisretlen; | ||
1021 | |||
1022 | if (ret || thisretlen != thislen) | ||
1023 | break; | ||
1024 | |||
1025 | to += thislen; | ||
1026 | } | ||
1027 | |||
1028 | mutex_unlock(&writev_buf_mutex); | ||
1029 | *retlen = totretlen; | ||
1030 | return ret; | ||
1031 | } | ||
1032 | |||
1033 | |||
1034 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | ||
1035 | size_t * retlen, u_char * buf) | ||
1036 | { | 964 | { |
1037 | struct DiskOnChip *this = mtd->priv; | 965 | struct DiskOnChip *this = mtd->priv; |
1038 | int len256 = 0, ret; | 966 | int len256 = 0, ret; |
1039 | struct Nand *mychip; | 967 | struct Nand *mychip; |
968 | uint8_t *buf = ops->oobbuf; | ||
969 | size_t len = ops->len; | ||
970 | |||
971 | BUG_ON(ops->mode != MTD_OOB_PLACE); | ||
972 | |||
973 | ofs += ops->ooboffs; | ||
1040 | 974 | ||
1041 | mutex_lock(&this->lock); | 975 | mutex_lock(&this->lock); |
1042 | 976 | ||
@@ -1077,7 +1011,7 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
1077 | 1011 | ||
1078 | DoC_ReadBuf(this, &buf[len256], len - len256); | 1012 | DoC_ReadBuf(this, &buf[len256], len - len256); |
1079 | 1013 | ||
1080 | *retlen = len; | 1014 | ops->retlen = len; |
1081 | /* Reading the full OOB data drops us off of the end of the page, | 1015 | /* Reading the full OOB data drops us off of the end of the page, |
1082 | * causing the flash device to go into busy mode, so we need | 1016 | * causing the flash device to go into busy mode, so we need |
1083 | * to wait until ready 11.4.1 and Toshiba TC58256FT docs */ | 1017 | * to wait until ready 11.4.1 and Toshiba TC58256FT docs */ |
@@ -1192,17 +1126,20 @@ static int doc_write_oob_nolock(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
1192 | 1126 | ||
1193 | } | 1127 | } |
1194 | 1128 | ||
1195 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 1129 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
1196 | size_t * retlen, const u_char * buf) | 1130 | struct mtd_oob_ops *ops) |
1197 | { | 1131 | { |
1198 | struct DiskOnChip *this = mtd->priv; | 1132 | struct DiskOnChip *this = mtd->priv; |
1199 | int ret; | 1133 | int ret; |
1200 | 1134 | ||
1201 | mutex_lock(&this->lock); | 1135 | BUG_ON(ops->mode != MTD_OOB_PLACE); |
1202 | ret = doc_write_oob_nolock(mtd, ofs, len, retlen, buf); | 1136 | |
1137 | mutex_lock(&this->lock); | ||
1138 | ret = doc_write_oob_nolock(mtd, ofs + ops->ooboffs, ops->len, | ||
1139 | &ops->retlen, ops->oobbuf); | ||
1203 | 1140 | ||
1204 | mutex_unlock(&this->lock); | 1141 | mutex_unlock(&this->lock); |
1205 | return ret; | 1142 | return ret; |
1206 | } | 1143 | } |
1207 | 1144 | ||
1208 | static int doc_erase(struct mtd_info *mtd, struct erase_info *instr) | 1145 | static int doc_erase(struct mtd_info *mtd, struct erase_info *instr) |
@@ -1277,12 +1214,6 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
1277 | * | 1214 | * |
1278 | ****************************************************************************/ | 1215 | ****************************************************************************/ |
1279 | 1216 | ||
1280 | static int __init init_doc2000(void) | ||
1281 | { | ||
1282 | inter_module_register(im_name, THIS_MODULE, &DoC2k_init); | ||
1283 | return 0; | ||
1284 | } | ||
1285 | |||
1286 | static void __exit cleanup_doc2000(void) | 1217 | static void __exit cleanup_doc2000(void) |
1287 | { | 1218 | { |
1288 | struct mtd_info *mtd; | 1219 | struct mtd_info *mtd; |
@@ -1298,11 +1229,9 @@ static void __exit cleanup_doc2000(void) | |||
1298 | kfree(this->chips); | 1229 | kfree(this->chips); |
1299 | kfree(mtd); | 1230 | kfree(mtd); |
1300 | } | 1231 | } |
1301 | inter_module_unregister(im_name); | ||
1302 | } | 1232 | } |
1303 | 1233 | ||
1304 | module_exit(cleanup_doc2000); | 1234 | module_exit(cleanup_doc2000); |
1305 | module_init(init_doc2000); | ||
1306 | 1235 | ||
1307 | MODULE_LICENSE("GPL"); | 1236 | MODULE_LICENSE("GPL"); |
1308 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al."); | 1237 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al."); |
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c index 681a9c73a2a3..0cf022a69e65 100644 --- a/drivers/mtd/devices/doc2001.c +++ b/drivers/mtd/devices/doc2001.c | |||
@@ -43,10 +43,10 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | |||
43 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | 43 | static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, |
44 | size_t *retlen, const u_char *buf, u_char *eccbuf, | 44 | size_t *retlen, const u_char *buf, u_char *eccbuf, |
45 | struct nand_oobinfo *oobsel); | 45 | struct nand_oobinfo *oobsel); |
46 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 46 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
47 | size_t *retlen, u_char *buf); | 47 | struct mtd_oob_ops *ops); |
48 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 48 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
49 | size_t *retlen, const u_char *buf); | 49 | struct mtd_oob_ops *ops); |
50 | static int doc_erase (struct mtd_info *mtd, struct erase_info *instr); | 50 | static int doc_erase (struct mtd_info *mtd, struct erase_info *instr); |
51 | 51 | ||
52 | static struct mtd_info *docmillist = NULL; | 52 | static struct mtd_info *docmillist = NULL; |
@@ -324,16 +324,9 @@ static int DoCMil_is_alias(struct DiskOnChip *doc1, struct DiskOnChip *doc2) | |||
324 | return retval; | 324 | return retval; |
325 | } | 325 | } |
326 | 326 | ||
327 | static const char im_name[] = "DoCMil_init"; | 327 | /* This routine is found from the docprobe code by symbol_get(), |
328 | 328 | * which will bump the use count of this module. */ | |
329 | /* This routine is made available to other mtd code via | 329 | void DoCMil_init(struct mtd_info *mtd) |
330 | * inter_module_register. It must only be accessed through | ||
331 | * inter_module_get which will bump the use count of this module. The | ||
332 | * addresses passed back in mtd are valid as long as the use count of | ||
333 | * this module is non-zero, i.e. between inter_module_get and | ||
334 | * inter_module_put. Keith Owens <kaos@ocs.com.au> 29 Oct 2000. | ||
335 | */ | ||
336 | static void DoCMil_init(struct mtd_info *mtd) | ||
337 | { | 330 | { |
338 | struct DiskOnChip *this = mtd->priv; | 331 | struct DiskOnChip *this = mtd->priv; |
339 | struct DiskOnChip *old = NULL; | 332 | struct DiskOnChip *old = NULL; |
@@ -368,7 +361,7 @@ static void DoCMil_init(struct mtd_info *mtd) | |||
368 | /* FIXME: erase size is not always 8KiB */ | 361 | /* FIXME: erase size is not always 8KiB */ |
369 | mtd->erasesize = 0x2000; | 362 | mtd->erasesize = 0x2000; |
370 | 363 | ||
371 | mtd->oobblock = 512; | 364 | mtd->writesize = 512; |
372 | mtd->oobsize = 16; | 365 | mtd->oobsize = 16; |
373 | mtd->owner = THIS_MODULE; | 366 | mtd->owner = THIS_MODULE; |
374 | mtd->erase = doc_erase; | 367 | mtd->erase = doc_erase; |
@@ -376,8 +369,6 @@ static void DoCMil_init(struct mtd_info *mtd) | |||
376 | mtd->unpoint = NULL; | 369 | mtd->unpoint = NULL; |
377 | mtd->read = doc_read; | 370 | mtd->read = doc_read; |
378 | mtd->write = doc_write; | 371 | mtd->write = doc_write; |
379 | mtd->read_ecc = doc_read_ecc; | ||
380 | mtd->write_ecc = doc_write_ecc; | ||
381 | mtd->read_oob = doc_read_oob; | 372 | mtd->read_oob = doc_read_oob; |
382 | mtd->write_oob = doc_write_oob; | 373 | mtd->write_oob = doc_write_oob; |
383 | mtd->sync = NULL; | 374 | mtd->sync = NULL; |
@@ -401,6 +392,7 @@ static void DoCMil_init(struct mtd_info *mtd) | |||
401 | return; | 392 | return; |
402 | } | 393 | } |
403 | } | 394 | } |
395 | EXPORT_SYMBOL_GPL(DoCMil_init); | ||
404 | 396 | ||
405 | static int doc_read (struct mtd_info *mtd, loff_t from, size_t len, | 397 | static int doc_read (struct mtd_info *mtd, loff_t from, size_t len, |
406 | size_t *retlen, u_char *buf) | 398 | size_t *retlen, u_char *buf) |
@@ -670,8 +662,8 @@ static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, | |||
670 | return ret; | 662 | return ret; |
671 | } | 663 | } |
672 | 664 | ||
673 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 665 | static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, |
674 | size_t *retlen, u_char *buf) | 666 | struct mtd_oob_ops *ops) |
675 | { | 667 | { |
676 | #ifndef USE_MEMCPY | 668 | #ifndef USE_MEMCPY |
677 | int i; | 669 | int i; |
@@ -680,6 +672,12 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
680 | struct DiskOnChip *this = mtd->priv; | 672 | struct DiskOnChip *this = mtd->priv; |
681 | void __iomem *docptr = this->virtadr; | 673 | void __iomem *docptr = this->virtadr; |
682 | struct Nand *mychip = &this->chips[ofs >> this->chipshift]; | 674 | struct Nand *mychip = &this->chips[ofs >> this->chipshift]; |
675 | uint8_t *buf = ops->oobbuf; | ||
676 | size_t len = ops->len; | ||
677 | |||
678 | BUG_ON(ops->mode != MTD_OOB_PLACE); | ||
679 | |||
680 | ofs += ops->ooboffs; | ||
683 | 681 | ||
684 | /* Find the chip which is to be used and select it */ | 682 | /* Find the chip which is to be used and select it */ |
685 | if (this->curfloor != mychip->floor) { | 683 | if (this->curfloor != mychip->floor) { |
@@ -716,13 +714,13 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
716 | #endif | 714 | #endif |
717 | buf[len - 1] = ReadDOC(docptr, LastDataRead); | 715 | buf[len - 1] = ReadDOC(docptr, LastDataRead); |
718 | 716 | ||
719 | *retlen = len; | 717 | ops->retlen = len; |
720 | 718 | ||
721 | return 0; | 719 | return 0; |
722 | } | 720 | } |
723 | 721 | ||
724 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | 722 | static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, |
725 | size_t *retlen, const u_char *buf) | 723 | struct mtd_oob_ops *ops) |
726 | { | 724 | { |
727 | #ifndef USE_MEMCPY | 725 | #ifndef USE_MEMCPY |
728 | int i; | 726 | int i; |
@@ -732,6 +730,12 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
732 | struct DiskOnChip *this = mtd->priv; | 730 | struct DiskOnChip *this = mtd->priv; |
733 | void __iomem *docptr = this->virtadr; | 731 | void __iomem *docptr = this->virtadr; |
734 | struct Nand *mychip = &this->chips[ofs >> this->chipshift]; | 732 | struct Nand *mychip = &this->chips[ofs >> this->chipshift]; |
733 | uint8_t *buf = ops->oobbuf; | ||
734 | size_t len = ops->len; | ||
735 | |||
736 | BUG_ON(ops->mode != MTD_OOB_PLACE); | ||
737 | |||
738 | ofs += ops->ooboffs; | ||
735 | 739 | ||
736 | /* Find the chip which is to be used and select it */ | 740 | /* Find the chip which is to be used and select it */ |
737 | if (this->curfloor != mychip->floor) { | 741 | if (this->curfloor != mychip->floor) { |
@@ -783,12 +787,12 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len, | |||
783 | if (ReadDOC(docptr, Mil_CDSN_IO) & 1) { | 787 | if (ReadDOC(docptr, Mil_CDSN_IO) & 1) { |
784 | printk("Error programming oob data\n"); | 788 | printk("Error programming oob data\n"); |
785 | /* FIXME: implement Bad Block Replacement (in nftl.c ??) */ | 789 | /* FIXME: implement Bad Block Replacement (in nftl.c ??) */ |
786 | *retlen = 0; | 790 | ops->retlen = 0; |
787 | ret = -EIO; | 791 | ret = -EIO; |
788 | } | 792 | } |
789 | dummy = ReadDOC(docptr, LastDataRead); | 793 | dummy = ReadDOC(docptr, LastDataRead); |
790 | 794 | ||
791 | *retlen = len; | 795 | ops->retlen = len; |
792 | 796 | ||
793 | return ret; | 797 | return ret; |
794 | } | 798 | } |
@@ -856,12 +860,6 @@ int doc_erase (struct mtd_info *mtd, struct erase_info *instr) | |||
856 | * | 860 | * |
857 | ****************************************************************************/ | 861 | ****************************************************************************/ |
858 | 862 | ||
859 | static int __init init_doc2001(void) | ||
860 | { | ||
861 | inter_module_register(im_name, THIS_MODULE, &DoCMil_init); | ||
862 | return 0; | ||
863 | } | ||
864 | |||
865 | static void __exit cleanup_doc2001(void) | 863 | static void __exit cleanup_doc2001(void) |
866 | { | 864 | { |
867 | struct mtd_info *mtd; | 865 | struct mtd_info *mtd; |
@@ -877,11 +875,9 @@ static void __exit cleanup_doc2001(void) | |||
877 | kfree(this->chips); | 875 | kfree(this->chips); |
878 | kfree(mtd); | 876 | kfree(mtd); |
879 | } | 877 | } |
880 | inter_module_unregister(im_name); | ||
881 | } | 878 | } |
882 | 879 | ||
883 | module_exit(cleanup_doc2001); | 880 | module_exit(cleanup_doc2001); |
884 | module_init(init_doc2001); | ||
885 | 881 | ||
886 | MODULE_LICENSE("GPL"); | 882 | MODULE_LICENSE("GPL"); |
887 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al."); | 883 | MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al."); |
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."); |
diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c index 13178b9dd00a..593bb033a3fa 100644 --- a/drivers/mtd/devices/docprobe.c +++ b/drivers/mtd/devices/docprobe.c | |||
@@ -231,6 +231,10 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr | |||
231 | 231 | ||
232 | static int docfound; | 232 | static int docfound; |
233 | 233 | ||
234 | extern void DoC2k_init(struct mtd_info *); | ||
235 | extern void DoCMil_init(struct mtd_info *); | ||
236 | extern void DoCMilPlus_init(struct mtd_info *); | ||
237 | |||
234 | static void __init DoC_Probe(unsigned long physadr) | 238 | static void __init DoC_Probe(unsigned long physadr) |
235 | { | 239 | { |
236 | void __iomem *docptr; | 240 | void __iomem *docptr; |
@@ -239,8 +243,6 @@ static void __init DoC_Probe(unsigned long physadr) | |||
239 | int ChipID; | 243 | int ChipID; |
240 | char namebuf[15]; | 244 | char namebuf[15]; |
241 | char *name = namebuf; | 245 | char *name = namebuf; |
242 | char *im_funcname = NULL; | ||
243 | char *im_modname = NULL; | ||
244 | void (*initroutine)(struct mtd_info *) = NULL; | 246 | void (*initroutine)(struct mtd_info *) = NULL; |
245 | 247 | ||
246 | docptr = ioremap(physadr, DOC_IOREMAP_LEN); | 248 | docptr = ioremap(physadr, DOC_IOREMAP_LEN); |
@@ -278,41 +280,33 @@ static void __init DoC_Probe(unsigned long physadr) | |||
278 | switch(ChipID) { | 280 | switch(ChipID) { |
279 | case DOC_ChipID_Doc2kTSOP: | 281 | case DOC_ChipID_Doc2kTSOP: |
280 | name="2000 TSOP"; | 282 | name="2000 TSOP"; |
281 | im_funcname = "DoC2k_init"; | 283 | initroutine = symbol_request(DoC2k_init); |
282 | im_modname = "doc2000"; | ||
283 | break; | 284 | break; |
284 | 285 | ||
285 | case DOC_ChipID_Doc2k: | 286 | case DOC_ChipID_Doc2k: |
286 | name="2000"; | 287 | name="2000"; |
287 | im_funcname = "DoC2k_init"; | 288 | initroutine = symbol_request(DoC2k_init); |
288 | im_modname = "doc2000"; | ||
289 | break; | 289 | break; |
290 | 290 | ||
291 | case DOC_ChipID_DocMil: | 291 | case DOC_ChipID_DocMil: |
292 | name="Millennium"; | 292 | name="Millennium"; |
293 | #ifdef DOC_SINGLE_DRIVER | 293 | #ifdef DOC_SINGLE_DRIVER |
294 | im_funcname = "DoC2k_init"; | 294 | initroutine = symbol_request(DoC2k_init); |
295 | im_modname = "doc2000"; | ||
296 | #else | 295 | #else |
297 | im_funcname = "DoCMil_init"; | 296 | initroutine = symbol_request(DoCMil_init); |
298 | im_modname = "doc2001"; | ||
299 | #endif /* DOC_SINGLE_DRIVER */ | 297 | #endif /* DOC_SINGLE_DRIVER */ |
300 | break; | 298 | break; |
301 | 299 | ||
302 | case DOC_ChipID_DocMilPlus16: | 300 | case DOC_ChipID_DocMilPlus16: |
303 | case DOC_ChipID_DocMilPlus32: | 301 | case DOC_ChipID_DocMilPlus32: |
304 | name="MillenniumPlus"; | 302 | name="MillenniumPlus"; |
305 | im_funcname = "DoCMilPlus_init"; | 303 | initroutine = symbol_request(DoCMilPlus_init); |
306 | im_modname = "doc2001plus"; | ||
307 | break; | 304 | break; |
308 | } | 305 | } |
309 | 306 | ||
310 | if (im_funcname) | ||
311 | initroutine = inter_module_get_request(im_funcname, im_modname); | ||
312 | |||
313 | if (initroutine) { | 307 | if (initroutine) { |
314 | (*initroutine)(mtd); | 308 | (*initroutine)(mtd); |
315 | inter_module_put(im_funcname); | 309 | symbol_put_addr(initroutine); |
316 | return; | 310 | return; |
317 | } | 311 | } |
318 | printk(KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n", name, physadr); | 312 | printk(KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n", name, physadr); |
diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c index 29b0ddaa324e..4ea50a1dda85 100644 --- a/drivers/mtd/devices/lart.c +++ b/drivers/mtd/devices/lart.c | |||
@@ -635,6 +635,7 @@ int __init lart_flash_init (void) | |||
635 | printk ("%s: This looks like a LART board to me.\n",module_name); | 635 | printk ("%s: This looks like a LART board to me.\n",module_name); |
636 | mtd.name = module_name; | 636 | mtd.name = module_name; |
637 | mtd.type = MTD_NORFLASH; | 637 | mtd.type = MTD_NORFLASH; |
638 | mtd.writesize = 1; | ||
638 | mtd.flags = MTD_CAP_NORFLASH; | 639 | mtd.flags = MTD_CAP_NORFLASH; |
639 | mtd.size = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM + FLASH_BLOCKSIZE_MAIN * FLASH_NUMBLOCKS_16m_MAIN; | 640 | mtd.size = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM + FLASH_BLOCKSIZE_MAIN * FLASH_NUMBLOCKS_16m_MAIN; |
640 | mtd.erasesize = FLASH_BLOCKSIZE_MAIN; | 641 | mtd.erasesize = FLASH_BLOCKSIZE_MAIN; |
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 04e65d5dae00..a8466141e914 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -465,6 +465,7 @@ static int __devinit m25p_probe(struct spi_device *spi) | |||
465 | flash->mtd.name = spi->dev.bus_id; | 465 | flash->mtd.name = spi->dev.bus_id; |
466 | 466 | ||
467 | flash->mtd.type = MTD_NORFLASH; | 467 | flash->mtd.type = MTD_NORFLASH; |
468 | flash->mtd.writesize = 1; | ||
468 | flash->mtd.flags = MTD_CAP_NORFLASH; | 469 | flash->mtd.flags = MTD_CAP_NORFLASH; |
469 | flash->mtd.size = info->sector_size * info->n_sectors; | 470 | flash->mtd.size = info->sector_size * info->n_sectors; |
470 | flash->mtd.erasesize = info->sector_size; | 471 | flash->mtd.erasesize = info->sector_size; |
diff --git a/drivers/mtd/devices/ms02-nv.c b/drivers/mtd/devices/ms02-nv.c index 485f663493d2..4ab7670770e4 100644 --- a/drivers/mtd/devices/ms02-nv.c +++ b/drivers/mtd/devices/ms02-nv.c | |||
@@ -219,7 +219,7 @@ static int __init ms02nv_init_one(ulong addr) | |||
219 | mp->uaddr = phys_to_virt(fixaddr); | 219 | mp->uaddr = phys_to_virt(fixaddr); |
220 | 220 | ||
221 | mtd->type = MTD_RAM; | 221 | mtd->type = MTD_RAM; |
222 | mtd->flags = MTD_CAP_RAM | MTD_XIP; | 222 | mtd->flags = MTD_CAP_RAM; |
223 | mtd->size = fixsize; | 223 | mtd->size = fixsize; |
224 | mtd->name = (char *)ms02nv_name; | 224 | mtd->name = (char *)ms02nv_name; |
225 | mtd->owner = THIS_MODULE; | 225 | mtd->owner = THIS_MODULE; |
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c index 1443117fd8f4..b4438eacfd80 100644 --- a/drivers/mtd/devices/mtdram.c +++ b/drivers/mtd/devices/mtdram.c | |||
@@ -106,6 +106,7 @@ int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, | |||
106 | mtd->type = MTD_RAM; | 106 | mtd->type = MTD_RAM; |
107 | mtd->flags = MTD_CAP_RAM; | 107 | mtd->flags = MTD_CAP_RAM; |
108 | mtd->size = size; | 108 | mtd->size = size; |
109 | mtd->writesize = 1; | ||
109 | mtd->erasesize = MTDRAM_ERASE_SIZE; | 110 | mtd->erasesize = MTDRAM_ERASE_SIZE; |
110 | mtd->priv = mapped_address; | 111 | mtd->priv = mapped_address; |
111 | 112 | ||
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index e8685ee6c1e4..e09e416667d3 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /** | 1 | /** |
2 | * $Id: phram.c,v 1.16 2005/11/07 11:14:25 gleixner Exp $ | 2 | * $Id: phram.c,v 1.16 2005/11/07 11:14:25 gleixner Exp $ |
3 | * | 3 | * |
4 | * Copyright (c) ???? Jochen Schไuble <psionic@psionic.de> | 4 | * Copyright (c) ???? Jochen Schรคuble <psionic@psionic.de> |
5 | * Copyright (c) 2003-2004 J๖rn Engel <joern@wh.fh-wedel.de> | 5 | * Copyright (c) 2003-2004 Jรถrn Engel <joern@wh.fh-wedel.de> |
6 | * | 6 | * |
7 | * Usage: | 7 | * Usage: |
8 | * | 8 | * |
@@ -142,7 +142,7 @@ static int register_device(char *name, unsigned long start, unsigned long len) | |||
142 | 142 | ||
143 | new->mtd.name = name; | 143 | new->mtd.name = name; |
144 | new->mtd.size = len; | 144 | new->mtd.size = len; |
145 | new->mtd.flags = MTD_CAP_RAM | MTD_ERASEABLE | MTD_VOLATILE; | 145 | new->mtd.flags = MTD_CAP_RAM; |
146 | new->mtd.erase = phram_erase; | 146 | new->mtd.erase = phram_erase; |
147 | new->mtd.point = phram_point; | 147 | new->mtd.point = phram_point; |
148 | new->mtd.unpoint = phram_unpoint; | 148 | new->mtd.unpoint = phram_unpoint; |
@@ -266,12 +266,16 @@ static int phram_setup(const char *val, struct kernel_param *kp) | |||
266 | return 0; | 266 | return 0; |
267 | 267 | ||
268 | ret = parse_num32(&start, token[1]); | 268 | ret = parse_num32(&start, token[1]); |
269 | if (ret) | 269 | if (ret) { |
270 | kfree(name); | ||
270 | parse_err("illegal start address\n"); | 271 | parse_err("illegal start address\n"); |
272 | } | ||
271 | 273 | ||
272 | ret = parse_num32(&len, token[2]); | 274 | ret = parse_num32(&len, token[2]); |
273 | if (ret) | 275 | if (ret) { |
276 | kfree(name); | ||
274 | parse_err("illegal device length\n"); | 277 | parse_err("illegal device length\n"); |
278 | } | ||
275 | 279 | ||
276 | register_device(name, start, len); | 280 | register_device(name, start, len); |
277 | 281 | ||
@@ -296,5 +300,5 @@ module_init(init_phram); | |||
296 | module_exit(cleanup_phram); | 300 | module_exit(cleanup_phram); |
297 | 301 | ||
298 | MODULE_LICENSE("GPL"); | 302 | MODULE_LICENSE("GPL"); |
299 | MODULE_AUTHOR("J๖rn Engel <joern@wh.fh-wedel.de>"); | 303 | MODULE_AUTHOR("Jรถrn Engel <joern@wh.fh-wedel.de>"); |
300 | MODULE_DESCRIPTION("MTD driver for physical RAM"); | 304 | MODULE_DESCRIPTION("MTD driver for physical RAM"); |
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index 6faee6c6958c..b3f665e3c38b 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c | |||
@@ -200,8 +200,7 @@ static int register_device(char *name, unsigned long start, unsigned long length | |||
200 | 200 | ||
201 | (*curmtd)->mtdinfo->name = name; | 201 | (*curmtd)->mtdinfo->name = name; |
202 | (*curmtd)->mtdinfo->size = length; | 202 | (*curmtd)->mtdinfo->size = length; |
203 | (*curmtd)->mtdinfo->flags = MTD_CLEAR_BITS | MTD_SET_BITS | | 203 | (*curmtd)->mtdinfo->flags = MTD_CAP_RAM; |
204 | MTD_WRITEB_WRITEABLE | MTD_VOLATILE | MTD_CAP_RAM; | ||
205 | (*curmtd)->mtdinfo->erase = slram_erase; | 204 | (*curmtd)->mtdinfo->erase = slram_erase; |
206 | (*curmtd)->mtdinfo->point = slram_point; | 205 | (*curmtd)->mtdinfo->point = slram_point; |
207 | (*curmtd)->mtdinfo->unpoint = slram_unpoint; | 206 | (*curmtd)->mtdinfo->unpoint = slram_unpoint; |