aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/Kconfig7
-rw-r--r--drivers/ide/pci/Makefile1
-rw-r--r--drivers/ide/pci/delkin_cb.c140
3 files changed, 148 insertions, 0 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index d781b2cd3d62..0e511ca50b84 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -167,6 +167,13 @@ config BLK_DEV_IDECS
167 Support for Compact Flash cards, outboard IDE disks, tape drives, 167 Support for Compact Flash cards, outboard IDE disks, tape drives,
168 and CD-ROM drives connected through a PCMCIA card. 168 and CD-ROM drives connected through a PCMCIA card.
169 169
170config BLK_DEV_DELKIN
171 tristate "Cardbus IDE support (Delkin/ASKA/Workbit)"
172 depends on CARDBUS && PCI
173 help
174 Support for Delkin, ASKA, and Workbit Cardbus CompactFlash
175 Adapters. This may also work for similar SD and XD adapters.
176
170config BLK_DEV_IDECD 177config BLK_DEV_IDECD
171 tristate "Include IDE/ATAPI CDROM support" 178 tristate "Include IDE/ATAPI CDROM support"
172 ---help--- 179 ---help---
diff --git a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile
index 64776ab4329f..6591ff4753cb 100644
--- a/drivers/ide/pci/Makefile
+++ b/drivers/ide/pci/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_BLK_DEV_CS5530) += cs5530.o
9obj-$(CONFIG_BLK_DEV_CS5535) += cs5535.o 9obj-$(CONFIG_BLK_DEV_CS5535) += cs5535.o
10obj-$(CONFIG_BLK_DEV_SC1200) += sc1200.o 10obj-$(CONFIG_BLK_DEV_SC1200) += sc1200.o
11obj-$(CONFIG_BLK_DEV_CY82C693) += cy82c693.o 11obj-$(CONFIG_BLK_DEV_CY82C693) += cy82c693.o
12obj-$(CONFIG_BLK_DEV_DELKIN) += delkin_cb.o
12obj-$(CONFIG_BLK_DEV_HPT34X) += hpt34x.o 13obj-$(CONFIG_BLK_DEV_HPT34X) += hpt34x.o
13obj-$(CONFIG_BLK_DEV_HPT366) += hpt366.o 14obj-$(CONFIG_BLK_DEV_HPT366) += hpt366.o
14obj-$(CONFIG_BLK_DEV_IT8213) += it8213.o 15obj-$(CONFIG_BLK_DEV_IT8213) += it8213.o
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c
new file mode 100644
index 000000000000..e2672fc65d30
--- /dev/null
+++ b/drivers/ide/pci/delkin_cb.c
@@ -0,0 +1,140 @@
1/*
2 * linux/drivers/ide/pci/delkin_cb.c
3 *
4 * Created 20 Oct 2004 by Mark Lord
5 *
6 * Basic support for Delkin/ASKA/Workbit Cardbus CompactFlash adapter
7 *
8 * Modeled after the 16-bit PCMCIA driver: ide-cs.c
9 *
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.
16 *
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
19 * more details.
20 */
21#include <linux/autoconf.h>
22#include <linux/types.h>
23#include <linux/module.h>
24#include <linux/mm.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>
30#include <asm/io.h>
31
32/*
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.
38 *
39 * There is also a 4KByte mmio region on the card,
40 * but its purpose has yet to be reverse-engineered.
41 */
42static 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,
47};
48
49static int __devinit
50delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
51{
52 unsigned long base;
53 hw_regs_t hw;
54 ide_hwif_t *hwif = NULL;
55 ide_drive_t *drive;
56 int i, rc;
57
58 rc = pci_enable_device(dev);
59 if (rc) {
60 printk(KERN_ERR "delkin_cb: pci_enable_device failed (%d)\n", rc);
61 return rc;
62 }
63 rc = pci_request_regions(dev, "delkin_cb");
64 if (rc) {
65 printk(KERN_ERR "delkin_cb: pci_request_regions failed (%d)\n", rc);
66 pci_disable_device(dev);
67 return rc;
68 }
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) {
73 if (setup[i])
74 outb(setup[i], base + i);
75 }
76 pci_release_regions(dev); /* IDE layer handles regions itself */
77
78 memset(&hw, 0, sizeof(hw));
79 ide_std_init_ports(&hw, base + 0x10, base + 0x1e);
80 hw.irq = dev->irq;
81 hw.chipset = ide_pci; /* this enables IRQ sharing */
82
83 rc = ide_register_hw_with_fixup(&hw, &hwif, ide_undecoded_slave);
84 if (rc < 0) {
85 printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc);
86 pci_disable_device(dev);
87 return -ENODEV;
88 }
89 pci_set_drvdata(dev, hwif);
90 hwif->pci_dev = dev;
91 drive = &hwif->drives[0];
92 if (drive->present) {
93 drive->io_32bit = 1;
94 drive->unmask = 1;
95 }
96 return 0;
97}
98
99static void
100delkin_cb_remove (struct pci_dev *dev)
101{
102 ide_hwif_t *hwif = pci_get_drvdata(dev);
103
104 if (hwif)
105 ide_unregister(hwif->index);
106 pci_disable_device(dev);
107}
108
109static struct pci_device_id delkin_cb_pci_tbl[] __devinitdata = {
110 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
111 { 0, },
112};
113MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl);
114
115static struct pci_driver driver = {
116 .name = "Delkin-ASKA-Workbit Cardbus IDE",
117 .id_table = delkin_cb_pci_tbl,
118 .probe = delkin_cb_probe,
119 .remove = delkin_cb_remove,
120};
121
122static int
123delkin_cb_init (void)
124{
125 return pci_module_init(&driver);
126}
127
128static void
129delkin_cb_exit (void)
130{
131 pci_unregister_driver(&driver);
132}
133
134module_init(delkin_cb_init);
135module_exit(delkin_cb_exit);
136
137MODULE_AUTHOR("Mark Lord");
138MODULE_DESCRIPTION("Basic support for Delkin/ASKA/Workbit Cardbus IDE");
139MODULE_LICENSE("GPL");
140