Merge remote-tracking branch 'upstream/master' into kvm-devel
[linux-2.6/kvm.git] / drivers / mtd / maps / pcmciamtd.c
blobbbe168b65c26a392e09bc8bdb4783b2d5c7ab06f
1 /*
2 * pcmciamtd.c - MTD driver for PCMCIA flash memory cards
4 * Author: Simon Evans <spse@secret.org.uk>
6 * Copyright (C) 2002 Simon Evans
8 * Licence: GPL
12 #include <linux/module.h>
13 #include <linux/slab.h>
14 #include <linux/timer.h>
15 #include <linux/init.h>
16 #include <asm/io.h>
17 #include <asm/system.h>
19 #include <pcmcia/cistpl.h>
20 #include <pcmcia/ds.h>
22 #include <linux/mtd/map.h>
23 #include <linux/mtd/mtd.h>
25 #ifdef CONFIG_MTD_DEBUG
26 static int debug = CONFIG_MTD_DEBUG_VERBOSE;
27 module_param(debug, int, 0);
28 MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy");
29 #undef DEBUG
30 #define DEBUG(n, format, arg...) \
31 if (n <= debug) { \
32 printk(KERN_DEBUG __FILE__ ":%s(): " format "\n", __func__ , ## arg); \
35 #else
36 #undef DEBUG
37 #define DEBUG(n, arg...)
38 static const int debug = 0;
39 #endif
41 #define info(format, arg...) printk(KERN_INFO "pcmciamtd: " format "\n" , ## arg)
43 #define DRIVER_DESC "PCMCIA Flash memory card driver"
45 /* Size of the PCMCIA address space: 26 bits = 64 MB */
46 #define MAX_PCMCIA_ADDR 0x4000000
48 struct pcmciamtd_dev {
49 struct pcmcia_device *p_dev;
50 caddr_t win_base; /* ioremapped address of PCMCIA window */
51 unsigned int win_size; /* size of window */
52 unsigned int offset; /* offset into card the window currently points at */
53 struct map_info pcmcia_map;
54 struct mtd_info *mtd_info;
55 int vpp;
56 char mtd_name[sizeof(struct cistpl_vers_1_t)];
60 /* Module parameters */
62 /* 2 = do 16-bit transfers, 1 = do 8-bit transfers */
63 static int bankwidth = 2;
65 /* Speed of memory accesses, in ns */
66 static int mem_speed;
68 /* Force the size of an SRAM card */
69 static int force_size;
71 /* Force Vpp */
72 static int vpp;
74 /* Set Vpp */
75 static int setvpp;
77 /* Force card to be treated as FLASH, ROM or RAM */
78 static int mem_type;
80 MODULE_LICENSE("GPL");
81 MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>");
82 MODULE_DESCRIPTION(DRIVER_DESC);
83 module_param(bankwidth, int, 0);
84 MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)");
85 module_param(mem_speed, int, 0);
86 MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns");
87 module_param(force_size, int, 0);
88 MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)");
89 module_param(setvpp, int, 0);
90 MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)");
91 module_param(vpp, int, 0);
92 MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)");
93 module_param(mem_type, int, 0);
94 MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)");
97 /* read/write{8,16} copy_{from,to} routines with window remapping
98 * to access whole card
100 static caddr_t remap_window(struct map_info *map, unsigned long to)
102 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
103 struct resource *win = (struct resource *) map->map_priv_2;
104 unsigned int offset;
105 int ret;
107 if (!pcmcia_dev_present(dev->p_dev)) {
108 DEBUG(1, "device removed");
109 return 0;
112 offset = to & ~(dev->win_size-1);
113 if (offset != dev->offset) {
114 DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x",
115 dev->offset, offset);
116 ret = pcmcia_map_mem_page(dev->p_dev, win, offset);
117 if (ret != 0)
118 return NULL;
119 dev->offset = offset;
121 return dev->win_base + (to & (dev->win_size-1));
125 static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs)
127 caddr_t addr;
128 map_word d = {{0}};
130 addr = remap_window(map, ofs);
131 if(!addr)
132 return d;
134 d.x[0] = readb(addr);
135 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx", ofs, addr, d.x[0]);
136 return d;
140 static map_word pcmcia_read16_remap(struct map_info *map, unsigned long ofs)
142 caddr_t addr;
143 map_word d = {{0}};
145 addr = remap_window(map, ofs);
146 if(!addr)
147 return d;
149 d.x[0] = readw(addr);
150 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx", ofs, addr, d.x[0]);
151 return d;
155 static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long from, ssize_t len)
157 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
158 unsigned long win_size = dev->win_size;
160 DEBUG(3, "to = %p from = %lu len = %zd", to, from, len);
161 while(len) {
162 int toread = win_size - (from & (win_size-1));
163 caddr_t addr;
165 if(toread > len)
166 toread = len;
168 addr = remap_window(map, from);
169 if(!addr)
170 return;
172 DEBUG(4, "memcpy from %p to %p len = %d", addr, to, toread);
173 memcpy_fromio(to, addr, toread);
174 len -= toread;
175 to += toread;
176 from += toread;
181 static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long adr)
183 caddr_t addr = remap_window(map, adr);
185 if(!addr)
186 return;
188 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02lx", adr, addr, d.x[0]);
189 writeb(d.x[0], addr);
193 static void pcmcia_write16_remap(struct map_info *map, map_word d, unsigned long adr)
195 caddr_t addr = remap_window(map, adr);
196 if(!addr)
197 return;
199 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04lx", adr, addr, d.x[0]);
200 writew(d.x[0], addr);
204 static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const void *from, ssize_t len)
206 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
207 unsigned long win_size = dev->win_size;
209 DEBUG(3, "to = %lu from = %p len = %zd", to, from, len);
210 while(len) {
211 int towrite = win_size - (to & (win_size-1));
212 caddr_t addr;
214 if(towrite > len)
215 towrite = len;
217 addr = remap_window(map, to);
218 if(!addr)
219 return;
221 DEBUG(4, "memcpy from %p to %p len = %d", from, addr, towrite);
222 memcpy_toio(addr, from, towrite);
223 len -= towrite;
224 to += towrite;
225 from += towrite;
230 /* read/write{8,16} copy_{from,to} routines with direct access */
232 #define DEV_REMOVED(x) (!(pcmcia_dev_present(((struct pcmciamtd_dev *)map->map_priv_1)->p_dev)))
234 static map_word pcmcia_read8(struct map_info *map, unsigned long ofs)
236 caddr_t win_base = (caddr_t)map->map_priv_2;
237 map_word d = {{0}};
239 if(DEV_REMOVED(map))
240 return d;
242 d.x[0] = readb(win_base + ofs);
243 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx",
244 ofs, win_base + ofs, d.x[0]);
245 return d;
249 static map_word pcmcia_read16(struct map_info *map, unsigned long ofs)
251 caddr_t win_base = (caddr_t)map->map_priv_2;
252 map_word d = {{0}};
254 if(DEV_REMOVED(map))
255 return d;
257 d.x[0] = readw(win_base + ofs);
258 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx",
259 ofs, win_base + ofs, d.x[0]);
260 return d;
264 static void pcmcia_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
266 caddr_t win_base = (caddr_t)map->map_priv_2;
268 if(DEV_REMOVED(map))
269 return;
271 DEBUG(3, "to = %p from = %lu len = %zd", to, from, len);
272 memcpy_fromio(to, win_base + from, len);
276 static void pcmcia_write8(struct map_info *map, map_word d, unsigned long adr)
278 caddr_t win_base = (caddr_t)map->map_priv_2;
280 if(DEV_REMOVED(map))
281 return;
283 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02lx",
284 adr, win_base + adr, d.x[0]);
285 writeb(d.x[0], win_base + adr);
289 static void pcmcia_write16(struct map_info *map, map_word d, unsigned long adr)
291 caddr_t win_base = (caddr_t)map->map_priv_2;
293 if(DEV_REMOVED(map))
294 return;
296 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04lx",
297 adr, win_base + adr, d.x[0]);
298 writew(d.x[0], win_base + adr);
302 static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
304 caddr_t win_base = (caddr_t)map->map_priv_2;
306 if(DEV_REMOVED(map))
307 return;
309 DEBUG(3, "to = %lu from = %p len = %zd", to, from, len);
310 memcpy_toio(win_base + to, from, len);
314 static void pcmciamtd_set_vpp(struct map_info *map, int on)
316 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
317 struct pcmcia_device *link = dev->p_dev;
319 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
320 pcmcia_fixup_vpp(link, on ? dev->vpp : 0);
324 static void pcmciamtd_release(struct pcmcia_device *link)
326 struct pcmciamtd_dev *dev = link->priv;
328 DEBUG(3, "link = 0x%p", link);
330 if (link->resource[2]->end) {
331 if(dev->win_base) {
332 iounmap(dev->win_base);
333 dev->win_base = NULL;
336 pcmcia_disable_device(link);
340 #ifdef CONFIG_MTD_DEBUG
341 static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev,
342 tuple_t *tuple,
343 void *priv_data)
345 cisparse_t parse;
347 if (!pcmcia_parse_tuple(tuple, &parse)) {
348 cistpl_format_t *t = &parse.format;
349 (void)t; /* Shut up, gcc */
350 DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u",
351 t->type, t->edc, t->offset, t->length);
353 return -ENOSPC;
356 static int pcmciamtd_cistpl_jedec(struct pcmcia_device *p_dev,
357 tuple_t *tuple,
358 void *priv_data)
360 cisparse_t parse;
361 int i;
363 if (!pcmcia_parse_tuple(tuple, &parse)) {
364 cistpl_jedec_t *t = &parse.jedec;
365 for (i = 0; i < t->nid; i++)
366 DEBUG(2, "JEDEC: 0x%02x 0x%02x",
367 t->id[i].mfr, t->id[i].info);
369 return -ENOSPC;
371 #endif
373 static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev,
374 tuple_t *tuple,
375 void *priv_data)
377 struct pcmciamtd_dev *dev = priv_data;
378 cisparse_t parse;
379 cistpl_device_t *t = &parse.device;
380 int i;
382 if (pcmcia_parse_tuple(tuple, &parse))
383 return -EINVAL;
385 DEBUG(2, "Common memory:");
386 dev->pcmcia_map.size = t->dev[0].size;
387 /* from here on: DEBUG only */
388 for (i = 0; i < t->ndev; i++) {
389 DEBUG(2, "Region %d, type = %u", i, t->dev[i].type);
390 DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp);
391 DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed);
392 DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size);
394 return 0;
397 static int pcmciamtd_cistpl_geo(struct pcmcia_device *p_dev,
398 tuple_t *tuple,
399 void *priv_data)
401 struct pcmciamtd_dev *dev = priv_data;
402 cisparse_t parse;
403 cistpl_device_geo_t *t = &parse.device_geo;
404 int i;
406 if (pcmcia_parse_tuple(tuple, &parse))
407 return -EINVAL;
409 dev->pcmcia_map.bankwidth = t->geo[0].buswidth;
410 /* from here on: DEBUG only */
411 for (i = 0; i < t->ngeo; i++) {
412 DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth);
413 DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block);
414 DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block);
415 DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block);
416 DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition);
417 DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave);
419 return 0;
423 static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev, int *new_name)
425 int i;
427 if (p_dev->prod_id[0]) {
428 dev->mtd_name[0] = '\0';
429 for (i = 0; i < 4; i++) {
430 if (i)
431 strcat(dev->mtd_name, " ");
432 if (p_dev->prod_id[i])
433 strcat(dev->mtd_name, p_dev->prod_id[i]);
435 DEBUG(2, "Found name: %s", dev->mtd_name);
438 #ifdef CONFIG_MTD_DEBUG
439 pcmcia_loop_tuple(p_dev, CISTPL_FORMAT, pcmciamtd_cistpl_format, NULL);
440 pcmcia_loop_tuple(p_dev, CISTPL_JEDEC_C, pcmciamtd_cistpl_jedec, NULL);
441 #endif
442 pcmcia_loop_tuple(p_dev, CISTPL_DEVICE, pcmciamtd_cistpl_device, dev);
443 pcmcia_loop_tuple(p_dev, CISTPL_DEVICE_GEO, pcmciamtd_cistpl_geo, dev);
445 if(!dev->pcmcia_map.size)
446 dev->pcmcia_map.size = MAX_PCMCIA_ADDR;
448 if(!dev->pcmcia_map.bankwidth)
449 dev->pcmcia_map.bankwidth = 2;
451 if(force_size) {
452 dev->pcmcia_map.size = force_size << 20;
453 DEBUG(2, "size forced to %dM", force_size);
456 if(bankwidth) {
457 dev->pcmcia_map.bankwidth = bankwidth;
458 DEBUG(2, "bankwidth forced to %d", bankwidth);
461 dev->pcmcia_map.name = dev->mtd_name;
462 if(!dev->mtd_name[0]) {
463 strcpy(dev->mtd_name, "PCMCIA Memory card");
464 *new_name = 1;
467 DEBUG(1, "Device: Size: %lu Width:%d Name: %s",
468 dev->pcmcia_map.size,
469 dev->pcmcia_map.bankwidth << 3, dev->mtd_name);
473 static int pcmciamtd_config(struct pcmcia_device *link)
475 struct pcmciamtd_dev *dev = link->priv;
476 struct mtd_info *mtd = NULL;
477 int ret;
478 int i, j = 0;
479 static char *probes[] = { "jedec_probe", "cfi_probe" };
480 int new_name = 0;
482 DEBUG(3, "link=0x%p", link);
484 card_settings(dev, link, &new_name);
486 dev->pcmcia_map.phys = NO_XIP;
487 dev->pcmcia_map.copy_from = pcmcia_copy_from_remap;
488 dev->pcmcia_map.copy_to = pcmcia_copy_to_remap;
489 if (dev->pcmcia_map.bankwidth == 1) {
490 dev->pcmcia_map.read = pcmcia_read8_remap;
491 dev->pcmcia_map.write = pcmcia_write8_remap;
492 } else {
493 dev->pcmcia_map.read = pcmcia_read16_remap;
494 dev->pcmcia_map.write = pcmcia_write16_remap;
496 if(setvpp == 1)
497 dev->pcmcia_map.set_vpp = pcmciamtd_set_vpp;
499 /* Request a memory window for PCMCIA. Some architeures can map windows
500 * up to the maximum that PCMCIA can support (64MiB) - this is ideal and
501 * we aim for a window the size of the whole card - otherwise we try
502 * smaller windows until we succeed
505 link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE;
506 link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ?
507 WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16;
508 link->resource[2]->start = 0;
509 link->resource[2]->end = (force_size) ? force_size << 20 :
510 MAX_PCMCIA_ADDR;
511 dev->win_size = 0;
513 do {
514 int ret;
515 DEBUG(2, "requesting window with size = %luKiB memspeed = %d",
516 (unsigned long) resource_size(link->resource[2]) >> 10,
517 mem_speed);
518 ret = pcmcia_request_window(link, link->resource[2], mem_speed);
519 DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size);
520 if(ret) {
521 j++;
522 link->resource[2]->start = 0;
523 link->resource[2]->end = (force_size) ?
524 force_size << 20 : MAX_PCMCIA_ADDR;
525 link->resource[2]->end >>= j;
526 } else {
527 DEBUG(2, "Got window of size %luKiB", (unsigned long)
528 resource_size(link->resource[2]) >> 10);
529 dev->win_size = resource_size(link->resource[2]);
530 break;
532 } while (link->resource[2]->end >= 0x1000);
534 DEBUG(2, "dev->win_size = %d", dev->win_size);
536 if(!dev->win_size) {
537 dev_err(&dev->p_dev->dev, "Cannot allocate memory window\n");
538 pcmciamtd_release(link);
539 return -ENODEV;
541 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
543 /* Get write protect status */
544 dev->win_base = ioremap(link->resource[2]->start,
545 resource_size(link->resource[2]));
546 if(!dev->win_base) {
547 dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n",
548 link->resource[2]);
549 pcmciamtd_release(link);
550 return -ENODEV;
552 DEBUG(1, "mapped window dev = %p @ %pR, base = %p",
553 dev, link->resource[2], dev->win_base);
555 dev->offset = 0;
556 dev->pcmcia_map.map_priv_1 = (unsigned long)dev;
557 dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2];
559 dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp;
560 if(setvpp == 2) {
561 link->vpp = dev->vpp;
562 } else {
563 link->vpp = 0;
566 link->config_index = 0;
567 DEBUG(2, "Setting Configuration");
568 ret = pcmcia_enable_device(link);
569 if (ret != 0) {
570 if (dev->win_base) {
571 iounmap(dev->win_base);
572 dev->win_base = NULL;
574 return -ENODEV;
577 if(mem_type == 1) {
578 mtd = do_map_probe("map_ram", &dev->pcmcia_map);
579 } else if(mem_type == 2) {
580 mtd = do_map_probe("map_rom", &dev->pcmcia_map);
581 } else {
582 for(i = 0; i < ARRAY_SIZE(probes); i++) {
583 DEBUG(1, "Trying %s", probes[i]);
584 mtd = do_map_probe(probes[i], &dev->pcmcia_map);
585 if(mtd)
586 break;
588 DEBUG(1, "FAILED: %s", probes[i]);
592 if(!mtd) {
593 DEBUG(1, "Can not find an MTD");
594 pcmciamtd_release(link);
595 return -ENODEV;
598 dev->mtd_info = mtd;
599 mtd->owner = THIS_MODULE;
601 if(new_name) {
602 int size = 0;
603 char unit = ' ';
604 /* Since we are using a default name, make it better by adding
605 * in the size
607 if(mtd->size < 1048576) { /* <1MiB in size, show size in KiB */
608 size = mtd->size >> 10;
609 unit = 'K';
610 } else {
611 size = mtd->size >> 20;
612 unit = 'M';
614 snprintf(dev->mtd_name, sizeof(dev->mtd_name), "%d%ciB %s", size, unit, "PCMCIA Memory card");
617 /* If the memory found is fits completely into the mapped PCMCIA window,
618 use the faster non-remapping read/write functions */
619 if(mtd->size <= dev->win_size) {
620 DEBUG(1, "Using non remapping memory functions");
621 dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base;
622 if (dev->pcmcia_map.bankwidth == 1) {
623 dev->pcmcia_map.read = pcmcia_read8;
624 dev->pcmcia_map.write = pcmcia_write8;
625 } else {
626 dev->pcmcia_map.read = pcmcia_read16;
627 dev->pcmcia_map.write = pcmcia_write16;
629 dev->pcmcia_map.copy_from = pcmcia_copy_from;
630 dev->pcmcia_map.copy_to = pcmcia_copy_to;
633 if (mtd_device_register(mtd, NULL, 0)) {
634 map_destroy(mtd);
635 dev->mtd_info = NULL;
636 dev_err(&dev->p_dev->dev,
637 "Could not register the MTD device\n");
638 pcmciamtd_release(link);
639 return -ENODEV;
641 dev_info(&dev->p_dev->dev, "mtd%d: %s\n", mtd->index, mtd->name);
642 return 0;
646 static int pcmciamtd_suspend(struct pcmcia_device *dev)
648 DEBUG(2, "EVENT_PM_RESUME");
650 /* get_lock(link); */
652 return 0;
655 static int pcmciamtd_resume(struct pcmcia_device *dev)
657 DEBUG(2, "EVENT_PM_SUSPEND");
659 /* free_lock(link); */
661 return 0;
665 static void pcmciamtd_detach(struct pcmcia_device *link)
667 struct pcmciamtd_dev *dev = link->priv;
669 DEBUG(3, "link=0x%p", link);
671 if(dev->mtd_info) {
672 mtd_device_unregister(dev->mtd_info);
673 dev_info(&dev->p_dev->dev, "mtd%d: Removing\n",
674 dev->mtd_info->index);
675 map_destroy(dev->mtd_info);
678 pcmciamtd_release(link);
682 static int pcmciamtd_probe(struct pcmcia_device *link)
684 struct pcmciamtd_dev *dev;
686 /* Create new memory card device */
687 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
688 if (!dev) return -ENOMEM;
689 DEBUG(1, "dev=0x%p", dev);
691 dev->p_dev = link;
692 link->priv = dev;
694 return pcmciamtd_config(link);
697 static const struct pcmcia_device_id pcmciamtd_ids[] = {
698 PCMCIA_DEVICE_FUNC_ID(1),
699 PCMCIA_DEVICE_PROD_ID123("IO DATA", "PCS-2M", "2MB SRAM", 0x547e66dc, 0x1fed36cd, 0x36eadd21),
700 PCMCIA_DEVICE_PROD_ID12("IBM", "2MB SRAM", 0xb569a6e5, 0x36eadd21),
701 PCMCIA_DEVICE_PROD_ID12("IBM", "4MB FLASH", 0xb569a6e5, 0x8bc54d2a),
702 PCMCIA_DEVICE_PROD_ID12("IBM", "8MB FLASH", 0xb569a6e5, 0x6df1be3e),
703 PCMCIA_DEVICE_PROD_ID12("Intel", "S2E20SW", 0x816cc815, 0xd14c9dcf),
704 PCMCIA_DEVICE_PROD_ID12("Intel", "S2E8 SW", 0x816cc815, 0xa2d7dedb),
705 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-02 ", 0x40ade711, 0x145cea5c),
706 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-04 ", 0x40ade711, 0x42064dda),
707 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-20 ", 0x40ade711, 0x25ee5cb0),
708 PCMCIA_DEVICE_PROD_ID12("intel", "VALUE SERIES 100 ", 0x40ade711, 0xdf8506d8),
709 PCMCIA_DEVICE_PROD_ID12("KINGMAX TECHNOLOGY INC.", "SRAM 256K Bytes", 0x54d0c69c, 0xad12c29c),
710 PCMCIA_DEVICE_PROD_ID12("Maxtor", "MAXFL MobileMax Flash Memory Card", 0xb68968c8, 0x2dfb47b0),
711 PCMCIA_DEVICE_PROD_ID123("M-Systems", "M-SYS Flash Memory Card", "(c) M-Systems", 0x7ed2ad87, 0x675dc3fb, 0x7aef3965),
712 PCMCIA_DEVICE_PROD_ID12("PRETEC", " 2MB SRAM CARD", 0xebf91155, 0x805360ca),
713 PCMCIA_DEVICE_PROD_ID12("SEIKO EPSON", "WWB101EN20", 0xf9876baf, 0xad0b207b),
714 PCMCIA_DEVICE_PROD_ID12("SEIKO EPSON", "WWB513EN20", 0xf9876baf, 0xe8d884ad),
715 PCMCIA_DEVICE_PROD_ID12("SMART Modular Technologies", " 4MB FLASH Card", 0x96fd8277, 0x737a5b05),
716 PCMCIA_DEVICE_PROD_ID12("Starfish, Inc.", "REX-3000", 0x05ddca47, 0xe7d67bca),
717 PCMCIA_DEVICE_PROD_ID12("Starfish, Inc.", "REX-4100", 0x05ddca47, 0x7bc32944),
718 /* the following was commented out in pcmcia-cs-3.2.7 */
719 /* PCMCIA_DEVICE_PROD_ID12("RATOC Systems,Inc.", "SmartMedia ADAPTER PC Card", 0xf4a2fefe, 0x5885b2ae), */
720 #ifdef CONFIG_MTD_PCMCIA_ANONYMOUS
721 { .match_flags = PCMCIA_DEV_ID_MATCH_ANONYMOUS, },
722 #endif
723 PCMCIA_DEVICE_NULL
725 MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids);
727 static struct pcmcia_driver pcmciamtd_driver = {
728 .name = "pcmciamtd",
729 .probe = pcmciamtd_probe,
730 .remove = pcmciamtd_detach,
731 .owner = THIS_MODULE,
732 .id_table = pcmciamtd_ids,
733 .suspend = pcmciamtd_suspend,
734 .resume = pcmciamtd_resume,
738 static int __init init_pcmciamtd(void)
740 if(bankwidth && bankwidth != 1 && bankwidth != 2) {
741 info("bad bankwidth (%d), using default", bankwidth);
742 bankwidth = 2;
744 if(force_size && (force_size < 1 || force_size > 64)) {
745 info("bad force_size (%d), using default", force_size);
746 force_size = 0;
748 if(mem_type && mem_type != 1 && mem_type != 2) {
749 info("bad mem_type (%d), using default", mem_type);
750 mem_type = 0;
752 return pcmcia_register_driver(&pcmciamtd_driver);
756 static void __exit exit_pcmciamtd(void)
758 DEBUG(1, DRIVER_DESC " unloading");
759 pcmcia_unregister_driver(&pcmciamtd_driver);
762 module_init(init_pcmciamtd);
763 module_exit(exit_pcmciamtd);