i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / mtd / maps / pcmciamtd.c
blobe8e9fec23553d06ea34410633c12c8cce558fdb2
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 #define info(format, arg...) printk(KERN_INFO "pcmciamtd: " format "\n" , ## arg)
27 #define DRIVER_DESC "PCMCIA Flash memory card driver"
29 /* Size of the PCMCIA address space: 26 bits = 64 MB */
30 #define MAX_PCMCIA_ADDR 0x4000000
32 struct pcmciamtd_dev {
33 struct pcmcia_device *p_dev;
34 caddr_t win_base; /* ioremapped address of PCMCIA window */
35 unsigned int win_size; /* size of window */
36 unsigned int offset; /* offset into card the window currently points at */
37 struct map_info pcmcia_map;
38 struct mtd_info *mtd_info;
39 int vpp;
40 char mtd_name[sizeof(struct cistpl_vers_1_t)];
44 /* Module parameters */
46 /* 2 = do 16-bit transfers, 1 = do 8-bit transfers */
47 static int bankwidth = 2;
49 /* Speed of memory accesses, in ns */
50 static int mem_speed;
52 /* Force the size of an SRAM card */
53 static int force_size;
55 /* Force Vpp */
56 static int vpp;
58 /* Set Vpp */
59 static int setvpp;
61 /* Force card to be treated as FLASH, ROM or RAM */
62 static int mem_type;
64 MODULE_LICENSE("GPL");
65 MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>");
66 MODULE_DESCRIPTION(DRIVER_DESC);
67 module_param(bankwidth, int, 0);
68 MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)");
69 module_param(mem_speed, int, 0);
70 MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns");
71 module_param(force_size, int, 0);
72 MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)");
73 module_param(setvpp, int, 0);
74 MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)");
75 module_param(vpp, int, 0);
76 MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)");
77 module_param(mem_type, int, 0);
78 MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)");
81 /* read/write{8,16} copy_{from,to} routines with window remapping
82 * to access whole card
84 static caddr_t remap_window(struct map_info *map, unsigned long to)
86 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
87 struct resource *win = (struct resource *) map->map_priv_2;
88 unsigned int offset;
89 int ret;
91 if (!pcmcia_dev_present(dev->p_dev)) {
92 pr_debug("device removed\n");
93 return 0;
96 offset = to & ~(dev->win_size-1);
97 if (offset != dev->offset) {
98 pr_debug("Remapping window from 0x%8.8x to 0x%8.8x\n",
99 dev->offset, offset);
100 ret = pcmcia_map_mem_page(dev->p_dev, win, offset);
101 if (ret != 0)
102 return NULL;
103 dev->offset = offset;
105 return dev->win_base + (to & (dev->win_size-1));
109 static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs)
111 caddr_t addr;
112 map_word d = {{0}};
114 addr = remap_window(map, ofs);
115 if(!addr)
116 return d;
118 d.x[0] = readb(addr);
119 pr_debug("ofs = 0x%08lx (%p) data = 0x%02lx\n", ofs, addr, d.x[0]);
120 return d;
124 static map_word pcmcia_read16_remap(struct map_info *map, unsigned long ofs)
126 caddr_t addr;
127 map_word d = {{0}};
129 addr = remap_window(map, ofs);
130 if(!addr)
131 return d;
133 d.x[0] = readw(addr);
134 pr_debug("ofs = 0x%08lx (%p) data = 0x%04lx\n", ofs, addr, d.x[0]);
135 return d;
139 static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long from, ssize_t len)
141 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
142 unsigned long win_size = dev->win_size;
144 pr_debug("to = %p from = %lu len = %zd\n", to, from, len);
145 while(len) {
146 int toread = win_size - (from & (win_size-1));
147 caddr_t addr;
149 if(toread > len)
150 toread = len;
152 addr = remap_window(map, from);
153 if(!addr)
154 return;
156 pr_debug("memcpy from %p to %p len = %d\n", addr, to, toread);
157 memcpy_fromio(to, addr, toread);
158 len -= toread;
159 to += toread;
160 from += toread;
165 static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long adr)
167 caddr_t addr = remap_window(map, adr);
169 if(!addr)
170 return;
172 pr_debug("adr = 0x%08lx (%p) data = 0x%02lx\n", adr, addr, d.x[0]);
173 writeb(d.x[0], addr);
177 static void pcmcia_write16_remap(struct map_info *map, map_word d, unsigned long adr)
179 caddr_t addr = remap_window(map, adr);
180 if(!addr)
181 return;
183 pr_debug("adr = 0x%08lx (%p) data = 0x%04lx\n", adr, addr, d.x[0]);
184 writew(d.x[0], addr);
188 static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const void *from, ssize_t len)
190 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
191 unsigned long win_size = dev->win_size;
193 pr_debug("to = %lu from = %p len = %zd\n", to, from, len);
194 while(len) {
195 int towrite = win_size - (to & (win_size-1));
196 caddr_t addr;
198 if(towrite > len)
199 towrite = len;
201 addr = remap_window(map, to);
202 if(!addr)
203 return;
205 pr_debug("memcpy from %p to %p len = %d\n", from, addr, towrite);
206 memcpy_toio(addr, from, towrite);
207 len -= towrite;
208 to += towrite;
209 from += towrite;
214 /* read/write{8,16} copy_{from,to} routines with direct access */
216 #define DEV_REMOVED(x) (!(pcmcia_dev_present(((struct pcmciamtd_dev *)map->map_priv_1)->p_dev)))
218 static map_word pcmcia_read8(struct map_info *map, unsigned long ofs)
220 caddr_t win_base = (caddr_t)map->map_priv_2;
221 map_word d = {{0}};
223 if(DEV_REMOVED(map))
224 return d;
226 d.x[0] = readb(win_base + ofs);
227 pr_debug("ofs = 0x%08lx (%p) data = 0x%02lx\n",
228 ofs, win_base + ofs, d.x[0]);
229 return d;
233 static map_word pcmcia_read16(struct map_info *map, unsigned long ofs)
235 caddr_t win_base = (caddr_t)map->map_priv_2;
236 map_word d = {{0}};
238 if(DEV_REMOVED(map))
239 return d;
241 d.x[0] = readw(win_base + ofs);
242 pr_debug("ofs = 0x%08lx (%p) data = 0x%04lx\n",
243 ofs, win_base + ofs, d.x[0]);
244 return d;
248 static void pcmcia_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
250 caddr_t win_base = (caddr_t)map->map_priv_2;
252 if(DEV_REMOVED(map))
253 return;
255 pr_debug("to = %p from = %lu len = %zd\n", to, from, len);
256 memcpy_fromio(to, win_base + from, len);
260 static void pcmcia_write8(struct map_info *map, map_word d, unsigned long adr)
262 caddr_t win_base = (caddr_t)map->map_priv_2;
264 if(DEV_REMOVED(map))
265 return;
267 pr_debug("adr = 0x%08lx (%p) data = 0x%02lx\n",
268 adr, win_base + adr, d.x[0]);
269 writeb(d.x[0], win_base + adr);
273 static void pcmcia_write16(struct map_info *map, map_word d, unsigned long adr)
275 caddr_t win_base = (caddr_t)map->map_priv_2;
277 if(DEV_REMOVED(map))
278 return;
280 pr_debug("adr = 0x%08lx (%p) data = 0x%04lx\n",
281 adr, win_base + adr, d.x[0]);
282 writew(d.x[0], win_base + adr);
286 static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
288 caddr_t win_base = (caddr_t)map->map_priv_2;
290 if(DEV_REMOVED(map))
291 return;
293 pr_debug("to = %lu from = %p len = %zd\n", to, from, len);
294 memcpy_toio(win_base + to, from, len);
298 static void pcmciamtd_set_vpp(struct map_info *map, int on)
300 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
301 struct pcmcia_device *link = dev->p_dev;
303 pr_debug("dev = %p on = %d vpp = %d\n\n", dev, on, dev->vpp);
304 pcmcia_fixup_vpp(link, on ? dev->vpp : 0);
308 static void pcmciamtd_release(struct pcmcia_device *link)
310 struct pcmciamtd_dev *dev = link->priv;
312 pr_debug("link = 0x%p\n", link);
314 if (link->resource[2]->end) {
315 if(dev->win_base) {
316 iounmap(dev->win_base);
317 dev->win_base = NULL;
320 pcmcia_disable_device(link);
324 static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev,
325 tuple_t *tuple,
326 void *priv_data)
328 cisparse_t parse;
330 if (!pcmcia_parse_tuple(tuple, &parse)) {
331 cistpl_format_t *t = &parse.format;
332 (void)t; /* Shut up, gcc */
333 pr_debug("Format type: %u, Error Detection: %u, offset = %u, length =%u\n",
334 t->type, t->edc, t->offset, t->length);
336 return -ENOSPC;
339 static int pcmciamtd_cistpl_jedec(struct pcmcia_device *p_dev,
340 tuple_t *tuple,
341 void *priv_data)
343 cisparse_t parse;
344 int i;
346 if (!pcmcia_parse_tuple(tuple, &parse)) {
347 cistpl_jedec_t *t = &parse.jedec;
348 for (i = 0; i < t->nid; i++)
349 pr_debug("JEDEC: 0x%02x 0x%02x\n",
350 t->id[i].mfr, t->id[i].info);
352 return -ENOSPC;
355 static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev,
356 tuple_t *tuple,
357 void *priv_data)
359 struct pcmciamtd_dev *dev = priv_data;
360 cisparse_t parse;
361 cistpl_device_t *t = &parse.device;
362 int i;
364 if (pcmcia_parse_tuple(tuple, &parse))
365 return -EINVAL;
367 pr_debug("Common memory:\n");
368 dev->pcmcia_map.size = t->dev[0].size;
369 /* from here on: DEBUG only */
370 for (i = 0; i < t->ndev; i++) {
371 pr_debug("Region %d, type = %u\n", i, t->dev[i].type);
372 pr_debug("Region %d, wp = %u\n", i, t->dev[i].wp);
373 pr_debug("Region %d, speed = %u ns\n", i, t->dev[i].speed);
374 pr_debug("Region %d, size = %u bytes\n", i, t->dev[i].size);
376 return 0;
379 static int pcmciamtd_cistpl_geo(struct pcmcia_device *p_dev,
380 tuple_t *tuple,
381 void *priv_data)
383 struct pcmciamtd_dev *dev = priv_data;
384 cisparse_t parse;
385 cistpl_device_geo_t *t = &parse.device_geo;
386 int i;
388 if (pcmcia_parse_tuple(tuple, &parse))
389 return -EINVAL;
391 dev->pcmcia_map.bankwidth = t->geo[0].buswidth;
392 /* from here on: DEBUG only */
393 for (i = 0; i < t->ngeo; i++) {
394 pr_debug("region: %d bankwidth = %u\n", i, t->geo[i].buswidth);
395 pr_debug("region: %d erase_block = %u\n", i, t->geo[i].erase_block);
396 pr_debug("region: %d read_block = %u\n", i, t->geo[i].read_block);
397 pr_debug("region: %d write_block = %u\n", i, t->geo[i].write_block);
398 pr_debug("region: %d partition = %u\n", i, t->geo[i].partition);
399 pr_debug("region: %d interleave = %u\n", i, t->geo[i].interleave);
401 return 0;
405 static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev, int *new_name)
407 int i;
409 if (p_dev->prod_id[0]) {
410 dev->mtd_name[0] = '\0';
411 for (i = 0; i < 4; i++) {
412 if (i)
413 strcat(dev->mtd_name, " ");
414 if (p_dev->prod_id[i])
415 strcat(dev->mtd_name, p_dev->prod_id[i]);
417 pr_debug("Found name: %s\n", dev->mtd_name);
420 pcmcia_loop_tuple(p_dev, CISTPL_FORMAT, pcmciamtd_cistpl_format, NULL);
421 pcmcia_loop_tuple(p_dev, CISTPL_JEDEC_C, pcmciamtd_cistpl_jedec, NULL);
422 pcmcia_loop_tuple(p_dev, CISTPL_DEVICE, pcmciamtd_cistpl_device, dev);
423 pcmcia_loop_tuple(p_dev, CISTPL_DEVICE_GEO, pcmciamtd_cistpl_geo, dev);
425 if(!dev->pcmcia_map.size)
426 dev->pcmcia_map.size = MAX_PCMCIA_ADDR;
428 if(!dev->pcmcia_map.bankwidth)
429 dev->pcmcia_map.bankwidth = 2;
431 if(force_size) {
432 dev->pcmcia_map.size = force_size << 20;
433 pr_debug("size forced to %dM\n", force_size);
436 if(bankwidth) {
437 dev->pcmcia_map.bankwidth = bankwidth;
438 pr_debug("bankwidth forced to %d\n", bankwidth);
441 dev->pcmcia_map.name = dev->mtd_name;
442 if(!dev->mtd_name[0]) {
443 strcpy(dev->mtd_name, "PCMCIA Memory card");
444 *new_name = 1;
447 pr_debug("Device: Size: %lu Width:%d Name: %s\n",
448 dev->pcmcia_map.size,
449 dev->pcmcia_map.bankwidth << 3, dev->mtd_name);
453 static int pcmciamtd_config(struct pcmcia_device *link)
455 struct pcmciamtd_dev *dev = link->priv;
456 struct mtd_info *mtd = NULL;
457 int ret;
458 int i, j = 0;
459 static char *probes[] = { "jedec_probe", "cfi_probe" };
460 int new_name = 0;
462 pr_debug("link=0x%p\n", link);
464 card_settings(dev, link, &new_name);
466 dev->pcmcia_map.phys = NO_XIP;
467 dev->pcmcia_map.copy_from = pcmcia_copy_from_remap;
468 dev->pcmcia_map.copy_to = pcmcia_copy_to_remap;
469 if (dev->pcmcia_map.bankwidth == 1) {
470 dev->pcmcia_map.read = pcmcia_read8_remap;
471 dev->pcmcia_map.write = pcmcia_write8_remap;
472 } else {
473 dev->pcmcia_map.read = pcmcia_read16_remap;
474 dev->pcmcia_map.write = pcmcia_write16_remap;
476 if(setvpp == 1)
477 dev->pcmcia_map.set_vpp = pcmciamtd_set_vpp;
479 /* Request a memory window for PCMCIA. Some architeures can map windows
480 * up to the maximum that PCMCIA can support (64MiB) - this is ideal and
481 * we aim for a window the size of the whole card - otherwise we try
482 * smaller windows until we succeed
485 link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE;
486 link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ?
487 WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16;
488 link->resource[2]->start = 0;
489 link->resource[2]->end = (force_size) ? force_size << 20 :
490 MAX_PCMCIA_ADDR;
491 dev->win_size = 0;
493 do {
494 int ret;
495 pr_debug("requesting window with size = %luKiB memspeed = %d\n",
496 (unsigned long) resource_size(link->resource[2]) >> 10,
497 mem_speed);
498 ret = pcmcia_request_window(link, link->resource[2], mem_speed);
499 pr_debug("ret = %d dev->win_size = %d\n", ret, dev->win_size);
500 if(ret) {
501 j++;
502 link->resource[2]->start = 0;
503 link->resource[2]->end = (force_size) ?
504 force_size << 20 : MAX_PCMCIA_ADDR;
505 link->resource[2]->end >>= j;
506 } else {
507 pr_debug("Got window of size %luKiB\n", (unsigned long)
508 resource_size(link->resource[2]) >> 10);
509 dev->win_size = resource_size(link->resource[2]);
510 break;
512 } while (link->resource[2]->end >= 0x1000);
514 pr_debug("dev->win_size = %d\n", dev->win_size);
516 if(!dev->win_size) {
517 dev_err(&dev->p_dev->dev, "Cannot allocate memory window\n");
518 pcmciamtd_release(link);
519 return -ENODEV;
521 pr_debug("Allocated a window of %dKiB\n", dev->win_size >> 10);
523 /* Get write protect status */
524 dev->win_base = ioremap(link->resource[2]->start,
525 resource_size(link->resource[2]));
526 if(!dev->win_base) {
527 dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n",
528 link->resource[2]);
529 pcmciamtd_release(link);
530 return -ENODEV;
532 pr_debug("mapped window dev = %p @ %pR, base = %p\n",
533 dev, link->resource[2], dev->win_base);
535 dev->offset = 0;
536 dev->pcmcia_map.map_priv_1 = (unsigned long)dev;
537 dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2];
539 dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp;
540 if(setvpp == 2) {
541 link->vpp = dev->vpp;
542 } else {
543 link->vpp = 0;
546 link->config_index = 0;
547 pr_debug("Setting Configuration\n");
548 ret = pcmcia_enable_device(link);
549 if (ret != 0) {
550 if (dev->win_base) {
551 iounmap(dev->win_base);
552 dev->win_base = NULL;
554 return -ENODEV;
557 if(mem_type == 1) {
558 mtd = do_map_probe("map_ram", &dev->pcmcia_map);
559 } else if(mem_type == 2) {
560 mtd = do_map_probe("map_rom", &dev->pcmcia_map);
561 } else {
562 for(i = 0; i < ARRAY_SIZE(probes); i++) {
563 pr_debug("Trying %s\n", probes[i]);
564 mtd = do_map_probe(probes[i], &dev->pcmcia_map);
565 if(mtd)
566 break;
568 pr_debug("FAILED: %s\n", probes[i]);
572 if(!mtd) {
573 pr_debug("Can not find an MTD\n");
574 pcmciamtd_release(link);
575 return -ENODEV;
578 dev->mtd_info = mtd;
579 mtd->owner = THIS_MODULE;
581 if(new_name) {
582 int size = 0;
583 char unit = ' ';
584 /* Since we are using a default name, make it better by adding
585 * in the size
587 if(mtd->size < 1048576) { /* <1MiB in size, show size in KiB */
588 size = mtd->size >> 10;
589 unit = 'K';
590 } else {
591 size = mtd->size >> 20;
592 unit = 'M';
594 snprintf(dev->mtd_name, sizeof(dev->mtd_name), "%d%ciB %s", size, unit, "PCMCIA Memory card");
597 /* If the memory found is fits completely into the mapped PCMCIA window,
598 use the faster non-remapping read/write functions */
599 if(mtd->size <= dev->win_size) {
600 pr_debug("Using non remapping memory functions\n");
601 dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base;
602 if (dev->pcmcia_map.bankwidth == 1) {
603 dev->pcmcia_map.read = pcmcia_read8;
604 dev->pcmcia_map.write = pcmcia_write8;
605 } else {
606 dev->pcmcia_map.read = pcmcia_read16;
607 dev->pcmcia_map.write = pcmcia_write16;
609 dev->pcmcia_map.copy_from = pcmcia_copy_from;
610 dev->pcmcia_map.copy_to = pcmcia_copy_to;
613 if (mtd_device_register(mtd, NULL, 0)) {
614 map_destroy(mtd);
615 dev->mtd_info = NULL;
616 dev_err(&dev->p_dev->dev,
617 "Could not register the MTD device\n");
618 pcmciamtd_release(link);
619 return -ENODEV;
621 dev_info(&dev->p_dev->dev, "mtd%d: %s\n", mtd->index, mtd->name);
622 return 0;
626 static int pcmciamtd_suspend(struct pcmcia_device *dev)
628 pr_debug("EVENT_PM_RESUME\n");
630 /* get_lock(link); */
632 return 0;
635 static int pcmciamtd_resume(struct pcmcia_device *dev)
637 pr_debug("EVENT_PM_SUSPEND\n");
639 /* free_lock(link); */
641 return 0;
645 static void pcmciamtd_detach(struct pcmcia_device *link)
647 struct pcmciamtd_dev *dev = link->priv;
649 pr_debug("link=0x%p\n", link);
651 if(dev->mtd_info) {
652 mtd_device_unregister(dev->mtd_info);
653 dev_info(&dev->p_dev->dev, "mtd%d: Removing\n",
654 dev->mtd_info->index);
655 map_destroy(dev->mtd_info);
658 pcmciamtd_release(link);
662 static int pcmciamtd_probe(struct pcmcia_device *link)
664 struct pcmciamtd_dev *dev;
666 /* Create new memory card device */
667 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
668 if (!dev) return -ENOMEM;
669 pr_debug("dev=0x%p\n", dev);
671 dev->p_dev = link;
672 link->priv = dev;
674 return pcmciamtd_config(link);
677 static const struct pcmcia_device_id pcmciamtd_ids[] = {
678 PCMCIA_DEVICE_FUNC_ID(1),
679 PCMCIA_DEVICE_PROD_ID123("IO DATA", "PCS-2M", "2MB SRAM", 0x547e66dc, 0x1fed36cd, 0x36eadd21),
680 PCMCIA_DEVICE_PROD_ID12("IBM", "2MB SRAM", 0xb569a6e5, 0x36eadd21),
681 PCMCIA_DEVICE_PROD_ID12("IBM", "4MB FLASH", 0xb569a6e5, 0x8bc54d2a),
682 PCMCIA_DEVICE_PROD_ID12("IBM", "8MB FLASH", 0xb569a6e5, 0x6df1be3e),
683 PCMCIA_DEVICE_PROD_ID12("Intel", "S2E20SW", 0x816cc815, 0xd14c9dcf),
684 PCMCIA_DEVICE_PROD_ID12("Intel", "S2E8 SW", 0x816cc815, 0xa2d7dedb),
685 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-02 ", 0x40ade711, 0x145cea5c),
686 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-04 ", 0x40ade711, 0x42064dda),
687 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-20 ", 0x40ade711, 0x25ee5cb0),
688 PCMCIA_DEVICE_PROD_ID12("intel", "VALUE SERIES 100 ", 0x40ade711, 0xdf8506d8),
689 PCMCIA_DEVICE_PROD_ID12("KINGMAX TECHNOLOGY INC.", "SRAM 256K Bytes", 0x54d0c69c, 0xad12c29c),
690 PCMCIA_DEVICE_PROD_ID12("Maxtor", "MAXFL MobileMax Flash Memory Card", 0xb68968c8, 0x2dfb47b0),
691 PCMCIA_DEVICE_PROD_ID123("M-Systems", "M-SYS Flash Memory Card", "(c) M-Systems", 0x7ed2ad87, 0x675dc3fb, 0x7aef3965),
692 PCMCIA_DEVICE_PROD_ID12("PRETEC", " 2MB SRAM CARD", 0xebf91155, 0x805360ca),
693 PCMCIA_DEVICE_PROD_ID12("SEIKO EPSON", "WWB101EN20", 0xf9876baf, 0xad0b207b),
694 PCMCIA_DEVICE_PROD_ID12("SEIKO EPSON", "WWB513EN20", 0xf9876baf, 0xe8d884ad),
695 PCMCIA_DEVICE_PROD_ID12("SMART Modular Technologies", " 4MB FLASH Card", 0x96fd8277, 0x737a5b05),
696 PCMCIA_DEVICE_PROD_ID12("Starfish, Inc.", "REX-3000", 0x05ddca47, 0xe7d67bca),
697 PCMCIA_DEVICE_PROD_ID12("Starfish, Inc.", "REX-4100", 0x05ddca47, 0x7bc32944),
698 /* the following was commented out in pcmcia-cs-3.2.7 */
699 /* PCMCIA_DEVICE_PROD_ID12("RATOC Systems,Inc.", "SmartMedia ADAPTER PC Card", 0xf4a2fefe, 0x5885b2ae), */
700 #ifdef CONFIG_MTD_PCMCIA_ANONYMOUS
701 { .match_flags = PCMCIA_DEV_ID_MATCH_ANONYMOUS, },
702 #endif
703 PCMCIA_DEVICE_NULL
705 MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids);
707 static struct pcmcia_driver pcmciamtd_driver = {
708 .name = "pcmciamtd",
709 .probe = pcmciamtd_probe,
710 .remove = pcmciamtd_detach,
711 .owner = THIS_MODULE,
712 .id_table = pcmciamtd_ids,
713 .suspend = pcmciamtd_suspend,
714 .resume = pcmciamtd_resume,
718 static int __init init_pcmciamtd(void)
720 if(bankwidth && bankwidth != 1 && bankwidth != 2) {
721 info("bad bankwidth (%d), using default", bankwidth);
722 bankwidth = 2;
724 if(force_size && (force_size < 1 || force_size > 64)) {
725 info("bad force_size (%d), using default", force_size);
726 force_size = 0;
728 if(mem_type && mem_type != 1 && mem_type != 2) {
729 info("bad mem_type (%d), using default", mem_type);
730 mem_type = 0;
732 return pcmcia_register_driver(&pcmciamtd_driver);
736 static void __exit exit_pcmciamtd(void)
738 pr_debug(DRIVER_DESC " unloading");
739 pcmcia_unregister_driver(&pcmciamtd_driver);
742 module_init(init_pcmciamtd);
743 module_exit(exit_pcmciamtd);