Blame view
drivers/ide/delkin_cb.c
4.35 KB
78281c535 IDE Driver for De... |
1 |
/* |
78281c535 IDE Driver for De... |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
* Created 20 Oct 2004 by Mark Lord * * Basic support for Delkin/ASKA/Workbit Cardbus CompactFlash adapter * * Modeled after the 16-bit PCMCIA driver: ide-cs.c * * This is slightly peculiar, in that it is a PCI driver, * but is NOT an IDE PCI driver -- the IDE layer does not directly * support hot insertion/removal of PCI interfaces, so this driver * is unable to use the IDE PCI interfaces. Instead, it uses the * same interfaces as the ide-cs (PCMCIA) driver uses. * On the plus side, the driver is also smaller/simpler this way. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive for * more details. */ |
78829dd92 ide: remove needl... |
19 |
|
78281c535 IDE Driver for De... |
20 21 |
#include <linux/types.h> #include <linux/module.h> |
78281c535 IDE Driver for De... |
22 23 24 |
#include <linux/ide.h> #include <linux/init.h> #include <linux/pci.h> |
78829dd92 ide: remove needl... |
25 |
|
78281c535 IDE Driver for De... |
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#include <asm/io.h> /* * No chip documentation has yet been found, * so these configuration values were pulled from * a running Win98 system using "debug". * This gives around 3MByte/second read performance, * which is about 2/3 of what the chip is capable of. * * There is also a 4KByte mmio region on the card, * but its purpose has yet to be reverse-engineered. */ static const u8 setup[] = { 0x00, 0x05, 0xbe, 0x01, 0x20, 0x8f, 0x00, 0x00, 0xa4, 0x1f, 0xb3, 0x1b, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x83, 0x02, 0x13, }; |
ac95beedf ide: add struct i... |
44 45 46 |
static const struct ide_port_ops delkin_cb_port_ops = { .quirkproc = ide_undecoded_slave, }; |
2ed0ef543 ide: fix ->init_c... |
47 |
static int delkin_cb_init_chipset(struct pci_dev *dev) |
8c061a40c delkin_cb: add PM... |
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
{ unsigned long base = pci_resource_start(dev, 0); int i; outb(0x02, base + 0x1e); /* set nIEN to block interrupts */ inb(base + 0x17); /* read status to clear interrupts */ for (i = 0; i < sizeof(setup); ++i) { if (setup[i]) outb(setup[i], base + i); } return 0; } |
1c4d4ad50 delkin_cb: use st... |
62 63 64 65 |
static const struct ide_port_info delkin_cb_port_info = { .port_ops = &delkin_cb_port_ops, .host_flags = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS | IDE_HFLAG_NO_DMA, |
255115fb3 ide: allow host d... |
66 |
.irq_flags = IRQF_SHARED, |
8c061a40c delkin_cb: add PM... |
67 |
.init_chipset = delkin_cb_init_chipset, |
29e52cf79 ide: remove chips... |
68 |
.chipset = ide_pci, |
1c4d4ad50 delkin_cb: use st... |
69 |
}; |
fe31edc8a Drivers: ide: rem... |
70 |
static int delkin_cb_probe(struct pci_dev *dev, const struct pci_device_id *id) |
78281c535 IDE Driver for De... |
71 |
{ |
48c3c1072 ide: add struct i... |
72 |
struct ide_host *host; |
78281c535 IDE Driver for De... |
73 |
unsigned long base; |
8c061a40c delkin_cb: add PM... |
74 |
int rc; |
9f36d3143 ide: remove hw_re... |
75 |
struct ide_hw hw, *hws[] = { &hw }; |
78281c535 IDE Driver for De... |
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
rc = pci_enable_device(dev); if (rc) { printk(KERN_ERR "delkin_cb: pci_enable_device failed (%d) ", rc); return rc; } rc = pci_request_regions(dev, "delkin_cb"); if (rc) { printk(KERN_ERR "delkin_cb: pci_request_regions failed (%d) ", rc); pci_disable_device(dev); return rc; } base = pci_resource_start(dev, 0); |
8c061a40c delkin_cb: add PM... |
91 92 |
delkin_cb_init_chipset(dev); |
78281c535 IDE Driver for De... |
93 94 95 96 |
memset(&hw, 0, sizeof(hw)); ide_std_init_ports(&hw, base + 0x10, base + 0x1e); hw.irq = dev->irq; |
8a7dbb976 delkin_cb: set pr... |
97 |
hw.dev = &dev->dev; |
78281c535 IDE Driver for De... |
98 |
|
dca398305 ide: pass number ... |
99 |
rc = ide_host_add(&delkin_cb_port_info, hws, 1, &host); |
6f904d015 ide: add ide_host... |
100 |
if (rc) |
9e016a719 ide: add ide_depr... |
101 |
goto out_disable; |
48c3c1072 ide: add struct i... |
102 |
pci_set_drvdata(dev, host); |
8a7dbb976 delkin_cb: set pr... |
103 |
|
78281c535 IDE Driver for De... |
104 |
return 0; |
9e016a719 ide: add ide_depr... |
105 106 |
out_disable: |
7f6f33c13 delkin_cb: fix re... |
107 |
pci_release_regions(dev); |
9e016a719 ide: add ide_depr... |
108 |
pci_disable_device(dev); |
6f904d015 ide: add ide_host... |
109 |
return rc; |
78281c535 IDE Driver for De... |
110 111 112 113 114 |
} static void delkin_cb_remove (struct pci_dev *dev) { |
48c3c1072 ide: add struct i... |
115 |
struct ide_host *host = pci_get_drvdata(dev); |
78281c535 IDE Driver for De... |
116 |
|
48c3c1072 ide: add struct i... |
117 |
ide_host_remove(host); |
f82c2b171 ide: add 'init_de... |
118 |
|
7f6f33c13 delkin_cb: fix re... |
119 |
pci_release_regions(dev); |
78281c535 IDE Driver for De... |
120 121 |
pci_disable_device(dev); } |
8c061a40c delkin_cb: add PM... |
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
#ifdef CONFIG_PM static int delkin_cb_suspend(struct pci_dev *dev, pm_message_t state) { pci_save_state(dev); pci_disable_device(dev); pci_set_power_state(dev, pci_choose_state(dev, state)); return 0; } static int delkin_cb_resume(struct pci_dev *dev) { struct ide_host *host = pci_get_drvdata(dev); int rc; pci_set_power_state(dev, PCI_D0); rc = pci_enable_device(dev); if (rc) return rc; pci_restore_state(dev); pci_set_master(dev); if (host->init_chipset) host->init_chipset(dev); return 0; } #else #define delkin_cb_suspend NULL #define delkin_cb_resume NULL #endif |
fe31edc8a Drivers: ide: rem... |
155 |
static struct pci_device_id delkin_cb_pci_tbl[] = { |
78281c535 IDE Driver for De... |
156 |
{ 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
2571b16dd ide/pci/delkin_cb... |
157 |
{ 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
78281c535 IDE Driver for De... |
158 159 160 |
{ 0, }, }; MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl); |
a9ab09e26 ide: use unique n... |
161 |
static struct pci_driver delkin_cb_pci_driver = { |
78281c535 IDE Driver for De... |
162 163 164 165 |
.name = "Delkin-ASKA-Workbit Cardbus IDE", .id_table = delkin_cb_pci_tbl, .probe = delkin_cb_probe, .remove = delkin_cb_remove, |
8c061a40c delkin_cb: add PM... |
166 167 |
.suspend = delkin_cb_suspend, .resume = delkin_cb_resume, |
78281c535 IDE Driver for De... |
168 |
}; |
99bfdd878 drivers/ide/delki... |
169 |
module_pci_driver(delkin_cb_pci_driver); |
78281c535 IDE Driver for De... |
170 171 172 173 |
MODULE_AUTHOR("Mark Lord"); MODULE_DESCRIPTION("Basic support for Delkin/ASKA/Workbit Cardbus IDE"); MODULE_LICENSE("GPL"); |