2 * pcmciamtd.c - MTD driver for PCMCIA flash memory cards
4 * Author: Simon Evans <spse@secret.org.uk>
6 * Copyright (C) 2002 Simon Evans
12 #include <linux/module.h>
13 #include <linux/slab.h>
14 #include <linux/timer.h>
15 #include <linux/init.h>
17 #include <asm/system.h>
19 #include <pcmcia/cs.h>
20 #include <pcmcia/cistpl.h>
21 #include <pcmcia/ds.h>
23 #include <linux/mtd/map.h>
24 #include <linux/mtd/mtd.h>
26 #ifdef CONFIG_MTD_DEBUG
27 static int debug = CONFIG_MTD_DEBUG_VERBOSE;
28 module_param(debug, int, 0);
29 MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy");
31 #define DEBUG(n, format, arg...) \
33 printk(KERN_DEBUG __FILE__ ":%s(): " format "\n", __func__ , ## arg); \
38 #define DEBUG(n, arg...)
39 static const int debug = 0;
42 #define info(format, arg...) printk(KERN_INFO "pcmciamtd: " format "\n" , ## arg)
44 #define DRIVER_DESC "PCMCIA Flash memory card driver"
46 /* Size of the PCMCIA address space: 26 bits = 64 MB */
47 #define MAX_PCMCIA_ADDR 0x4000000
49 struct pcmciamtd_dev {
50 struct pcmcia_device *p_dev;
51 caddr_t win_base; /* ioremapped address of PCMCIA window */
52 unsigned int win_size; /* size of window */
53 unsigned int offset; /* offset into card the window currently points at */
54 struct map_info pcmcia_map;
55 struct mtd_info *mtd_info;
57 char mtd_name[sizeof(struct cistpl_vers_1_t)];
61 /* Module parameters */
63 /* 2 = do 16-bit transfers, 1 = do 8-bit transfers */
64 static int bankwidth = 2;
66 /* Speed of memory accesses, in ns */
69 /* Force the size of an SRAM card */
70 static int force_size;
78 /* Force card to be treated as FLASH, ROM or RAM */
81 MODULE_LICENSE("GPL");
82 MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>");
83 MODULE_DESCRIPTION(DRIVER_DESC);
84 module_param(bankwidth, int, 0);
85 MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)");
86 module_param(mem_speed, int, 0);
87 MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns");
88 module_param(force_size, int, 0);
89 MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)");
90 module_param(setvpp, int, 0);
91 MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)");
92 module_param(vpp, int, 0);
93 MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)");
94 module_param(mem_type, int, 0);
95 MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)");
98 /* read/write{8,16} copy_{from,to} routines with window remapping
99 * to access whole card
101 static caddr_t remap_window(struct map_info *map, unsigned long to)
103 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
104 struct resource *win = (struct resource *) map->map_priv_2;
108 if (!pcmcia_dev_present(dev->p_dev)) {
109 DEBUG(1, "device removed");
113 offset = to & ~(dev->win_size-1);
114 if (offset != dev->offset) {
115 DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x",
116 dev->offset, offset);
117 ret = pcmcia_map_mem_page(dev->p_dev, win, offset);
120 dev->offset = offset;
122 return dev->win_base + (to & (dev->win_size-1));
126 static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs)
131 addr = remap_window(map, ofs);
135 d.x[0] = readb(addr);
136 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx", ofs, addr, d.x[0]);
141 static map_word pcmcia_read16_remap(struct map_info *map, unsigned long ofs)
146 addr = remap_window(map, ofs);
150 d.x[0] = readw(addr);
151 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx", ofs, addr, d.x[0]);
156 static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long from, ssize_t len)
158 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
159 unsigned long win_size = dev->win_size;
161 DEBUG(3, "to = %p from = %lu len = %zd", to, from, len);
163 int toread = win_size - (from & (win_size-1));
169 addr = remap_window(map, from);
173 DEBUG(4, "memcpy from %p to %p len = %d", addr, to, toread);
174 memcpy_fromio(to, addr, toread);
182 static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long adr)
184 caddr_t addr = remap_window(map, adr);
189 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02lx", adr, addr, d.x[0]);
190 writeb(d.x[0], addr);
194 static void pcmcia_write16_remap(struct map_info *map, map_word d, unsigned long adr)
196 caddr_t addr = remap_window(map, adr);
200 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04lx", adr, addr, d.x[0]);
201 writew(d.x[0], addr);
205 static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const void *from, ssize_t len)
207 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
208 unsigned long win_size = dev->win_size;
210 DEBUG(3, "to = %lu from = %p len = %zd", to, from, len);
212 int towrite = win_size - (to & (win_size-1));
218 addr = remap_window(map, to);
222 DEBUG(4, "memcpy from %p to %p len = %d", from, addr, towrite);
223 memcpy_toio(addr, from, towrite);
231 /* read/write{8,16} copy_{from,to} routines with direct access */
233 #define DEV_REMOVED(x) (!(pcmcia_dev_present(((struct pcmciamtd_dev *)map->map_priv_1)->p_dev)))
235 static map_word pcmcia_read8(struct map_info *map, unsigned long ofs)
237 caddr_t win_base = (caddr_t)map->map_priv_2;
243 d.x[0] = readb(win_base + ofs);
244 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx",
245 ofs, win_base + ofs, d.x[0]);
250 static map_word pcmcia_read16(struct map_info *map, unsigned long ofs)
252 caddr_t win_base = (caddr_t)map->map_priv_2;
258 d.x[0] = readw(win_base + ofs);
259 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx",
260 ofs, win_base + ofs, d.x[0]);
265 static void pcmcia_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
267 caddr_t win_base = (caddr_t)map->map_priv_2;
272 DEBUG(3, "to = %p from = %lu len = %zd", to, from, len);
273 memcpy_fromio(to, win_base + from, len);
277 static void pcmcia_write8(struct map_info *map, map_word d, unsigned long adr)
279 caddr_t win_base = (caddr_t)map->map_priv_2;
284 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02lx",
285 adr, win_base + adr, d.x[0]);
286 writeb(d.x[0], win_base + adr);
290 static void pcmcia_write16(struct map_info *map, map_word d, unsigned long adr)
292 caddr_t win_base = (caddr_t)map->map_priv_2;
297 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04lx",
298 adr, win_base + adr, d.x[0]);
299 writew(d.x[0], win_base + adr);
303 static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
305 caddr_t win_base = (caddr_t)map->map_priv_2;
310 DEBUG(3, "to = %lu from = %p len = %zd", to, from, len);
311 memcpy_toio(win_base + to, from, len);
315 static void pcmciamtd_set_vpp(struct map_info *map, int on)
317 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
318 struct pcmcia_device *link = dev->p_dev;
320 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
321 pcmcia_fixup_vpp(link, on ? dev->vpp : 0);
325 /* After a card is removed, pcmciamtd_release() will unregister the
326 * device, and release the PCMCIA configuration. If the device is
327 * still open, this will be postponed until it is closed.
330 static void pcmciamtd_release(struct pcmcia_device *link)
332 struct pcmciamtd_dev *dev = link->priv;
334 DEBUG(3, "link = 0x%p", link);
336 if (link->resource[2]->end) {
338 iounmap(dev->win_base);
339 dev->win_base = NULL;
342 pcmcia_disable_device(link);
346 #ifdef CONFIG_MTD_DEBUG
347 static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev,
353 if (!pcmcia_parse_tuple(tuple, &parse)) {
354 cistpl_format_t *t = &parse.format;
355 (void)t; /* Shut up, gcc */
356 DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u",
357 t->type, t->edc, t->offset, t->length);
362 static int pcmciamtd_cistpl_jedec(struct pcmcia_device *p_dev,
369 if (!pcmcia_parse_tuple(tuple, &parse)) {
370 cistpl_jedec_t *t = &parse.jedec;
371 for (i = 0; i < t->nid; i++)
372 DEBUG(2, "JEDEC: 0x%02x 0x%02x",
373 t->id[i].mfr, t->id[i].info);
379 static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev,
383 struct pcmciamtd_dev *dev = priv_data;
385 cistpl_device_t *t = &parse.device;
388 if (pcmcia_parse_tuple(tuple, &parse))
391 DEBUG(2, "Common memory:");
392 dev->pcmcia_map.size = t->dev[0].size;
393 /* from here on: DEBUG only */
394 for (i = 0; i < t->ndev; i++) {
395 DEBUG(2, "Region %d, type = %u", i, t->dev[i].type);
396 DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp);
397 DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed);
398 DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size);
403 static int pcmciamtd_cistpl_geo(struct pcmcia_device *p_dev,
407 struct pcmciamtd_dev *dev = priv_data;
409 cistpl_device_geo_t *t = &parse.device_geo;
412 if (pcmcia_parse_tuple(tuple, &parse))
415 dev->pcmcia_map.bankwidth = t->geo[0].buswidth;
416 /* from here on: DEBUG only */
417 for (i = 0; i < t->ngeo; i++) {
418 DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth);
419 DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block);
420 DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block);
421 DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block);
422 DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition);
423 DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave);
429 static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev, int *new_name)
433 if (p_dev->prod_id[0]) {
434 dev->mtd_name[0] = '\0';
435 for (i = 0; i < 4; i++) {
437 strcat(dev->mtd_name, " ");
438 if (p_dev->prod_id[i])
439 strcat(dev->mtd_name, p_dev->prod_id[i]);
441 DEBUG(2, "Found name: %s", dev->mtd_name);
444 #ifdef CONFIG_MTD_DEBUG
445 pcmcia_loop_tuple(p_dev, CISTPL_FORMAT, pcmciamtd_cistpl_format, NULL);
446 pcmcia_loop_tuple(p_dev, CISTPL_JEDEC_C, pcmciamtd_cistpl_jedec, NULL);
448 pcmcia_loop_tuple(p_dev, CISTPL_DEVICE, pcmciamtd_cistpl_device, dev);
449 pcmcia_loop_tuple(p_dev, CISTPL_DEVICE_GEO, pcmciamtd_cistpl_geo, dev);
451 if(!dev->pcmcia_map.size)
452 dev->pcmcia_map.size = MAX_PCMCIA_ADDR;
454 if(!dev->pcmcia_map.bankwidth)
455 dev->pcmcia_map.bankwidth = 2;
458 dev->pcmcia_map.size = force_size << 20;
459 DEBUG(2, "size forced to %dM", force_size);
463 dev->pcmcia_map.bankwidth = bankwidth;
464 DEBUG(2, "bankwidth forced to %d", bankwidth);
467 dev->pcmcia_map.name = dev->mtd_name;
468 if(!dev->mtd_name[0]) {
469 strcpy(dev->mtd_name, "PCMCIA Memory card");
473 DEBUG(1, "Device: Size: %lu Width:%d Name: %s",
474 dev->pcmcia_map.size,
475 dev->pcmcia_map.bankwidth << 3, dev->mtd_name);
479 /* pcmciamtd_config() is scheduled to run after a CARD_INSERTION event
480 * is received, to configure the PCMCIA socket, and to make the
481 * MTD device available to the system.
484 static int pcmciamtd_config(struct pcmcia_device *link)
486 struct pcmciamtd_dev *dev = link->priv;
487 struct mtd_info *mtd = NULL;
490 static char *probes[] = { "jedec_probe", "cfi_probe" };
493 DEBUG(3, "link=0x%p", link);
495 card_settings(dev, link, &new_name);
497 dev->pcmcia_map.phys = NO_XIP;
498 dev->pcmcia_map.copy_from = pcmcia_copy_from_remap;
499 dev->pcmcia_map.copy_to = pcmcia_copy_to_remap;
500 if (dev->pcmcia_map.bankwidth == 1) {
501 dev->pcmcia_map.read = pcmcia_read8_remap;
502 dev->pcmcia_map.write = pcmcia_write8_remap;
504 dev->pcmcia_map.read = pcmcia_read16_remap;
505 dev->pcmcia_map.write = pcmcia_write16_remap;
508 dev->pcmcia_map.set_vpp = pcmciamtd_set_vpp;
510 /* Request a memory window for PCMCIA. Some architeures can map windows
511 * upto the maximum that PCMCIA can support (64MiB) - this is ideal and
512 * we aim for a window the size of the whole card - otherwise we try
513 * smaller windows until we succeed
516 link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE;
517 link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ?
518 WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16;
519 link->resource[2]->start = 0;
520 link->resource[2]->end = (force_size) ? force_size << 20 :
526 DEBUG(2, "requesting window with size = %luKiB memspeed = %d",
527 (unsigned long) resource_size(link->resource[2]) >> 10,
529 ret = pcmcia_request_window(link, link->resource[2], mem_speed);
530 DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size);
533 link->resource[2]->start = 0;
534 link->resource[2]->end = (force_size) ?
535 force_size << 20 : MAX_PCMCIA_ADDR;
536 link->resource[2]->end >>= j;
538 DEBUG(2, "Got window of size %luKiB", (unsigned long)
539 resource_size(link->resource[2]) >> 10);
540 dev->win_size = resource_size(link->resource[2]);
543 } while (link->resource[2]->end >= 0x1000);
545 DEBUG(2, "dev->win_size = %d", dev->win_size);
548 dev_err(&dev->p_dev->dev, "Cannot allocate memory window\n");
549 pcmciamtd_release(link);
552 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
554 /* Get write protect status */
555 dev->win_base = ioremap(link->resource[2]->start,
556 resource_size(link->resource[2]));
558 dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n",
560 pcmciamtd_release(link);
563 DEBUG(1, "mapped window dev = %p @ %pR, base = %p",
564 dev, link->resource[2], dev->win_base);
567 dev->pcmcia_map.map_priv_1 = (unsigned long)dev;
568 dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2];
570 dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp;
571 link->conf.Attributes = 0;
573 link->conf.Vpp = dev->vpp;
578 link->conf.IntType = INT_MEMORY;
579 link->conf.ConfigIndex = 0;
580 DEBUG(2, "Setting Configuration");
581 ret = pcmcia_request_configuration(link, &link->conf);
584 iounmap(dev->win_base);
585 dev->win_base = NULL;
591 mtd = do_map_probe("map_ram", &dev->pcmcia_map);
592 } else if(mem_type == 2) {
593 mtd = do_map_probe("map_rom", &dev->pcmcia_map);
595 for(i = 0; i < ARRAY_SIZE(probes); i++) {
596 DEBUG(1, "Trying %s", probes[i]);
597 mtd = do_map_probe(probes[i], &dev->pcmcia_map);
601 DEBUG(1, "FAILED: %s", probes[i]);
606 DEBUG(1, "Can not find an MTD");
607 pcmciamtd_release(link);
612 mtd->owner = THIS_MODULE;
617 /* Since we are using a default name, make it better by adding
620 if(mtd->size < 1048576) { /* <1MiB in size, show size in KiB */
621 size = mtd->size >> 10;
624 size = mtd->size >> 20;
627 snprintf(dev->mtd_name, sizeof(dev->mtd_name), "%d%ciB %s", size, unit, "PCMCIA Memory card");
630 /* If the memory found is fits completely into the mapped PCMCIA window,
631 use the faster non-remapping read/write functions */
632 if(mtd->size <= dev->win_size) {
633 DEBUG(1, "Using non remapping memory functions");
634 dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base;
635 if (dev->pcmcia_map.bankwidth == 1) {
636 dev->pcmcia_map.read = pcmcia_read8;
637 dev->pcmcia_map.write = pcmcia_write8;
639 dev->pcmcia_map.read = pcmcia_read16;
640 dev->pcmcia_map.write = pcmcia_write16;
642 dev->pcmcia_map.copy_from = pcmcia_copy_from;
643 dev->pcmcia_map.copy_to = pcmcia_copy_to;
646 if(add_mtd_device(mtd)) {
648 dev->mtd_info = NULL;
649 dev_err(&dev->p_dev->dev,
650 "Could not register the MTD device\n");
651 pcmciamtd_release(link);
654 dev_info(&dev->p_dev->dev, "mtd%d: %s\n", mtd->index, mtd->name);
657 dev_err(&dev->p_dev->dev, "CS Error, exiting\n");
658 pcmciamtd_release(link);
663 static int pcmciamtd_suspend(struct pcmcia_device *dev)
665 DEBUG(2, "EVENT_PM_RESUME");
667 /* get_lock(link); */
672 static int pcmciamtd_resume(struct pcmcia_device *dev)
674 DEBUG(2, "EVENT_PM_SUSPEND");
676 /* free_lock(link); */
682 /* This deletes a driver "instance". The device is de-registered
683 * with Card Services. If it has been released, all local data
684 * structures are freed. Otherwise, the structures will be freed
685 * when the device is released.
688 static void pcmciamtd_detach(struct pcmcia_device *link)
690 struct pcmciamtd_dev *dev = link->priv;
692 DEBUG(3, "link=0x%p", link);
695 del_mtd_device(dev->mtd_info);
696 dev_info(&dev->p_dev->dev, "mtd%d: Removing\n",
697 dev->mtd_info->index);
698 map_destroy(dev->mtd_info);
701 pcmciamtd_release(link);
705 /* pcmciamtd_attach() creates an "instance" of the driver, allocating
706 * local data structures for one device. The device is registered
707 * with Card Services.
710 static int pcmciamtd_probe(struct pcmcia_device *link)
712 struct pcmciamtd_dev *dev;
714 /* Create new memory card device */
715 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
716 if (!dev) return -ENOMEM;
717 DEBUG(1, "dev=0x%p", dev);
722 link->conf.Attributes = 0;
723 link->conf.IntType = INT_MEMORY;
725 return pcmciamtd_config(link);
728 static struct pcmcia_device_id pcmciamtd_ids[] = {
729 PCMCIA_DEVICE_FUNC_ID(1),
730 PCMCIA_DEVICE_PROD_ID123("IO DATA", "PCS-2M", "2MB SRAM", 0x547e66dc, 0x1fed36cd, 0x36eadd21),
731 PCMCIA_DEVICE_PROD_ID12("IBM", "2MB SRAM", 0xb569a6e5, 0x36eadd21),
732 PCMCIA_DEVICE_PROD_ID12("IBM", "4MB FLASH", 0xb569a6e5, 0x8bc54d2a),
733 PCMCIA_DEVICE_PROD_ID12("IBM", "8MB FLASH", 0xb569a6e5, 0x6df1be3e),
734 PCMCIA_DEVICE_PROD_ID12("Intel", "S2E20SW", 0x816cc815, 0xd14c9dcf),
735 PCMCIA_DEVICE_PROD_ID12("Intel", "S2E8 SW", 0x816cc815, 0xa2d7dedb),
736 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-02 ", 0x40ade711, 0x145cea5c),
737 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-04 ", 0x40ade711, 0x42064dda),
738 PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-20 ", 0x40ade711, 0x25ee5cb0),
739 PCMCIA_DEVICE_PROD_ID12("intel", "VALUE SERIES 100 ", 0x40ade711, 0xdf8506d8),
740 PCMCIA_DEVICE_PROD_ID12("KINGMAX TECHNOLOGY INC.", "SRAM 256K Bytes", 0x54d0c69c, 0xad12c29c),
741 PCMCIA_DEVICE_PROD_ID12("Maxtor", "MAXFL MobileMax Flash Memory Card", 0xb68968c8, 0x2dfb47b0),
742 PCMCIA_DEVICE_PROD_ID123("M-Systems", "M-SYS Flash Memory Card", "(c) M-Systems", 0x7ed2ad87, 0x675dc3fb, 0x7aef3965),
743 PCMCIA_DEVICE_PROD_ID12("PRETEC", " 2MB SRAM CARD", 0xebf91155, 0x805360ca),
744 PCMCIA_DEVICE_PROD_ID12("SEIKO EPSON", "WWB101EN20", 0xf9876baf, 0xad0b207b),
745 PCMCIA_DEVICE_PROD_ID12("SEIKO EPSON", "WWB513EN20", 0xf9876baf, 0xe8d884ad),
746 PCMCIA_DEVICE_PROD_ID12("SMART Modular Technologies", " 4MB FLASH Card", 0x96fd8277, 0x737a5b05),
747 PCMCIA_DEVICE_PROD_ID12("Starfish, Inc.", "REX-3000", 0x05ddca47, 0xe7d67bca),
748 PCMCIA_DEVICE_PROD_ID12("Starfish, Inc.", "REX-4100", 0x05ddca47, 0x7bc32944),
749 /* the following was commented out in pcmcia-cs-3.2.7 */
750 /* PCMCIA_DEVICE_PROD_ID12("RATOC Systems,Inc.", "SmartMedia ADAPTER PC Card", 0xf4a2fefe, 0x5885b2ae), */
751 #ifdef CONFIG_MTD_PCMCIA_ANONYMOUS
752 { .match_flags = PCMCIA_DEV_ID_MATCH_ANONYMOUS, },
756 MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids);
758 static struct pcmcia_driver pcmciamtd_driver = {
762 .probe = pcmciamtd_probe,
763 .remove = pcmciamtd_detach,
764 .owner = THIS_MODULE,
765 .id_table = pcmciamtd_ids,
766 .suspend = pcmciamtd_suspend,
767 .resume = pcmciamtd_resume,
771 static int __init init_pcmciamtd(void)
775 if(bankwidth && bankwidth != 1 && bankwidth != 2) {
776 info("bad bankwidth (%d), using default", bankwidth);
779 if(force_size && (force_size < 1 || force_size > 64)) {
780 info("bad force_size (%d), using default", force_size);
783 if(mem_type && mem_type != 1 && mem_type != 2) {
784 info("bad mem_type (%d), using default", mem_type);
787 return pcmcia_register_driver(&pcmciamtd_driver);
791 static void __exit exit_pcmciamtd(void)
793 DEBUG(1, DRIVER_DESC " unloading");
794 pcmcia_unregister_driver(&pcmciamtd_driver);
797 module_init(init_pcmciamtd);
798 module_exit(exit_pcmciamtd);