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/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");
30 #define DEBUG(n, format, arg...) \
32 printk(KERN_DEBUG __FILE__ ":%s(): " format "\n", __func__ , ## arg); \
37 #define DEBUG(n, arg...)
38 static const int debug
= 0;
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
;
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 */
68 /* Force the size of an SRAM card */
69 static int force_size
;
77 /* Force card to be treated as FLASH, ROM or RAM */
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
;
107 if (!pcmcia_dev_present(dev
->p_dev
)) {
108 DEBUG(1, "device removed");
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
);
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
)
130 addr
= remap_window(map
, ofs
);
134 d
.x
[0] = readb(addr
);
135 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx", ofs
, addr
, d
.x
[0]);
140 static map_word
pcmcia_read16_remap(struct map_info
*map
, unsigned long ofs
)
145 addr
= remap_window(map
, ofs
);
149 d
.x
[0] = readw(addr
);
150 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx", ofs
, addr
, d
.x
[0]);
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
);
162 int toread
= win_size
- (from
& (win_size
-1));
168 addr
= remap_window(map
, from
);
172 DEBUG(4, "memcpy from %p to %p len = %d", addr
, to
, toread
);
173 memcpy_fromio(to
, addr
, 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
);
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
);
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
);
211 int towrite
= win_size
- (to
& (win_size
-1));
217 addr
= remap_window(map
, to
);
221 DEBUG(4, "memcpy from %p to %p len = %d", from
, addr
, towrite
);
222 memcpy_toio(addr
, 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
;
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]);
249 static map_word
pcmcia_read16(struct map_info
*map
, unsigned long ofs
)
251 caddr_t win_base
= (caddr_t
)map
->map_priv_2
;
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]);
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
;
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
;
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
;
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
;
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
) {
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
,
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
);
356 static int pcmciamtd_cistpl_jedec(struct pcmcia_device
*p_dev
,
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
);
373 static int pcmciamtd_cistpl_device(struct pcmcia_device
*p_dev
,
377 struct pcmciamtd_dev
*dev
= priv_data
;
379 cistpl_device_t
*t
= &parse
.device
;
382 if (pcmcia_parse_tuple(tuple
, &parse
))
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
);
397 static int pcmciamtd_cistpl_geo(struct pcmcia_device
*p_dev
,
401 struct pcmciamtd_dev
*dev
= priv_data
;
403 cistpl_device_geo_t
*t
= &parse
.device_geo
;
406 if (pcmcia_parse_tuple(tuple
, &parse
))
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
);
423 static void card_settings(struct pcmciamtd_dev
*dev
, struct pcmcia_device
*p_dev
, int *new_name
)
427 if (p_dev
->prod_id
[0]) {
428 dev
->mtd_name
[0] = '\0';
429 for (i
= 0; i
< 4; 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
);
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;
452 dev
->pcmcia_map
.size
= force_size
<< 20;
453 DEBUG(2, "size forced to %dM", force_size
);
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");
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
;
479 static char *probes
[] = { "jedec_probe", "cfi_probe" };
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
;
493 dev
->pcmcia_map
.read
= pcmcia_read16_remap
;
494 dev
->pcmcia_map
.write
= pcmcia_write16_remap
;
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 :
515 DEBUG(2, "requesting window with size = %luKiB memspeed = %d",
516 (unsigned long) resource_size(link
->resource
[2]) >> 10,
518 ret
= pcmcia_request_window(link
, link
->resource
[2], mem_speed
);
519 DEBUG(2, "ret = %d dev->win_size = %d", ret
, dev
->win_size
);
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
;
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]);
532 } while (link
->resource
[2]->end
>= 0x1000);
534 DEBUG(2, "dev->win_size = %d", dev
->win_size
);
537 dev_err(&dev
->p_dev
->dev
, "Cannot allocate memory window\n");
538 pcmciamtd_release(link
);
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]));
547 dev_err(&dev
->p_dev
->dev
, "ioremap(%pR) failed\n",
549 pcmciamtd_release(link
);
552 DEBUG(1, "mapped window dev = %p @ %pR, base = %p",
553 dev
, link
->resource
[2], dev
->win_base
);
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
;
561 link
->vpp
= dev
->vpp
;
566 link
->config_index
= 0;
567 DEBUG(2, "Setting Configuration");
568 ret
= pcmcia_enable_device(link
);
571 iounmap(dev
->win_base
);
572 dev
->win_base
= NULL
;
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
);
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
);
588 DEBUG(1, "FAILED: %s", probes
[i
]);
593 DEBUG(1, "Can not find an MTD");
594 pcmciamtd_release(link
);
599 mtd
->owner
= THIS_MODULE
;
604 /* Since we are using a default name, make it better by adding
607 if(mtd
->size
< 1048576) { /* <1MiB in size, show size in KiB */
608 size
= mtd
->size
>> 10;
611 size
= mtd
->size
>> 20;
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
;
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)) {
635 dev
->mtd_info
= NULL
;
636 dev_err(&dev
->p_dev
->dev
,
637 "Could not register the MTD device\n");
638 pcmciamtd_release(link
);
641 dev_info(&dev
->p_dev
->dev
, "mtd%d: %s\n", mtd
->index
, mtd
->name
);
646 static int pcmciamtd_suspend(struct pcmcia_device
*dev
)
648 DEBUG(2, "EVENT_PM_RESUME");
650 /* get_lock(link); */
655 static int pcmciamtd_resume(struct pcmcia_device
*dev
)
657 DEBUG(2, "EVENT_PM_SUSPEND");
659 /* free_lock(link); */
665 static void pcmciamtd_detach(struct pcmcia_device
*link
)
667 struct pcmciamtd_dev
*dev
= link
->priv
;
669 DEBUG(3, "link=0x%p", link
);
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
);
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
, },
725 MODULE_DEVICE_TABLE(pcmcia
, pcmciamtd_ids
);
727 static struct pcmcia_driver pcmciamtd_driver
= {
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
);
744 if(force_size
&& (force_size
< 1 || force_size
> 64)) {
745 info("bad force_size (%d), using default", force_size
);
748 if(mem_type
&& mem_type
!= 1 && mem_type
!= 2) {
749 info("bad mem_type (%d), using default", mem_type
);
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
);