2 * linux/drivers/ide/pci/delkin_cb.c
4 * Created 20 Oct 2004 by Mark Lord
6 * Basic support for Delkin/ASKA/Workbit Cardbus CompactFlash adapter
8 * Modeled after the 16-bit PCMCIA driver: ide-cs.c
10 * This is slightly peculiar, in that it is a PCI driver,
11 * but is NOT an IDE PCI driver -- the IDE layer does not directly
12 * support hot insertion/removal of PCI interfaces, so this driver
13 * is unable to use the IDE PCI interfaces. Instead, it uses the
14 * same interfaces as the ide-cs (PCMCIA) driver uses.
15 * On the plus side, the driver is also smaller/simpler this way.
17 * This file is subject to the terms and conditions of the GNU General Public
18 * License. See the file COPYING in the main directory of this archive for
21 #include <linux/autoconf.h>
22 #include <linux/types.h>
23 #include <linux/module.h>
25 #include <linux/blkdev.h>
26 #include <linux/hdreg.h>
27 #include <linux/ide.h>
28 #include <linux/init.h>
29 #include <linux/pci.h>
33 * No chip documentation has yet been found,
34 * so these configuration values were pulled from
35 * a running Win98 system using "debug".
36 * This gives around 3MByte/second read performance,
37 * which is about 2/3 of what the chip is capable of.
39 * There is also a 4KByte mmio region on the card,
40 * but its purpose has yet to be reverse-engineered.
42 static const u8 setup
[] = {
43 0x00, 0x05, 0xbe, 0x01, 0x20, 0x8f, 0x00, 0x00,
44 0xa4, 0x1f, 0xb3, 0x1b, 0x00, 0x00, 0x00, 0x80,
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0xa4, 0x83, 0x02, 0x13,
50 delkin_cb_probe (struct pci_dev
*dev
, const struct pci_device_id
*id
)
54 ide_hwif_t
*hwif
= NULL
;
58 rc
= pci_enable_device(dev
);
60 printk(KERN_ERR
"delkin_cb: pci_enable_device failed (%d)\n", rc
);
63 rc
= pci_request_regions(dev
, "delkin_cb");
65 printk(KERN_ERR
"delkin_cb: pci_request_regions failed (%d)\n", rc
);
66 pci_disable_device(dev
);
69 base
= pci_resource_start(dev
, 0);
70 outb(0x02, base
+ 0x1e); /* set nIEN to block interrupts */
71 inb(base
+ 0x17); /* read status to clear interrupts */
72 for (i
= 0; i
< sizeof(setup
); ++i
) {
74 outb(setup
[i
], base
+ i
);
76 pci_release_regions(dev
); /* IDE layer handles regions itself */
78 memset(&hw
, 0, sizeof(hw
));
79 ide_std_init_ports(&hw
, base
+ 0x10, base
+ 0x1e);
81 hw
.chipset
= ide_pci
; /* this enables IRQ sharing */
83 rc
= ide_register_hw_with_fixup(&hw
, 0, &hwif
, ide_undecoded_slave
);
85 printk(KERN_ERR
"delkin_cb: ide_register_hw failed (%d)\n", rc
);
86 pci_disable_device(dev
);
89 pci_set_drvdata(dev
, hwif
);
91 drive
= &hwif
->drives
[0];
100 delkin_cb_remove (struct pci_dev
*dev
)
102 ide_hwif_t
*hwif
= pci_get_drvdata(dev
);
105 ide_unregister(hwif
->index
);
106 pci_disable_device(dev
);
109 static struct pci_device_id delkin_cb_pci_tbl
[] __devinitdata
= {
110 { 0x1145, 0xf021, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
111 { 0x1145, 0xf024, PCI_ANY_ID
, PCI_ANY_ID
, 0, 0, 0},
114 MODULE_DEVICE_TABLE(pci
, delkin_cb_pci_tbl
);
116 static struct pci_driver driver
= {
117 .name
= "Delkin-ASKA-Workbit Cardbus IDE",
118 .id_table
= delkin_cb_pci_tbl
,
119 .probe
= delkin_cb_probe
,
120 .remove
= delkin_cb_remove
,
124 delkin_cb_init (void)
126 return pci_register_driver(&driver
);
130 delkin_cb_exit (void)
132 pci_unregister_driver(&driver
);
135 module_init(delkin_cb_init
);
136 module_exit(delkin_cb_exit
);
138 MODULE_AUTHOR("Mark Lord");
139 MODULE_DESCRIPTION("Basic support for Delkin/ASKA/Workbit Cardbus IDE");
140 MODULE_LICENSE("GPL");