diff options
Diffstat (limited to 'drivers/ide/ide-cs.c')
-rw-r--r-- | drivers/ide/ide-cs.c | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 063b933d864a..b85450865ff0 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c | |||
@@ -60,15 +60,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | |||
60 | MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); | 60 | MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); |
61 | MODULE_LICENSE("Dual MPL/GPL"); | 61 | MODULE_LICENSE("Dual MPL/GPL"); |
62 | 62 | ||
63 | #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0) | ||
64 | |||
65 | #ifdef CONFIG_PCMCIA_DEBUG | ||
66 | INT_MODULE_PARM(pc_debug, 0); | ||
67 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
68 | #else | ||
69 | #define DEBUG(n, args...) | ||
70 | #endif | ||
71 | |||
72 | /*====================================================================*/ | 63 | /*====================================================================*/ |
73 | 64 | ||
74 | typedef struct ide_info_t { | 65 | typedef struct ide_info_t { |
@@ -98,7 +89,7 @@ static int ide_probe(struct pcmcia_device *link) | |||
98 | { | 89 | { |
99 | ide_info_t *info; | 90 | ide_info_t *info; |
100 | 91 | ||
101 | DEBUG(0, "ide_attach()\n"); | 92 | dev_dbg(&link->dev, "ide_attach()\n"); |
102 | 93 | ||
103 | /* Create new ide device */ | 94 | /* Create new ide device */ |
104 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 95 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
@@ -112,7 +103,6 @@ static int ide_probe(struct pcmcia_device *link) | |||
112 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 103 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
113 | link->io.IOAddrLines = 3; | 104 | link->io.IOAddrLines = 3; |
114 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 105 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
115 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
116 | link->conf.Attributes = CONF_ENABLE_IRQ; | 106 | link->conf.Attributes = CONF_ENABLE_IRQ; |
117 | link->conf.IntType = INT_MEMORY_AND_IO; | 107 | link->conf.IntType = INT_MEMORY_AND_IO; |
118 | 108 | ||
@@ -131,19 +121,11 @@ static int ide_probe(struct pcmcia_device *link) | |||
131 | static void ide_detach(struct pcmcia_device *link) | 121 | static void ide_detach(struct pcmcia_device *link) |
132 | { | 122 | { |
133 | ide_info_t *info = link->priv; | 123 | ide_info_t *info = link->priv; |
134 | ide_hwif_t *hwif = info->host->ports[0]; | ||
135 | unsigned long data_addr, ctl_addr; | ||
136 | 124 | ||
137 | DEBUG(0, "ide_detach(0x%p)\n", link); | 125 | dev_dbg(&link->dev, "ide_detach(0x%p)\n", link); |
138 | |||
139 | data_addr = hwif->io_ports.data_addr; | ||
140 | ctl_addr = hwif->io_ports.ctl_addr; | ||
141 | 126 | ||
142 | ide_release(link); | 127 | ide_release(link); |
143 | 128 | ||
144 | release_region(ctl_addr, 1); | ||
145 | release_region(data_addr, 8); | ||
146 | |||
147 | kfree(info); | 129 | kfree(info); |
148 | } /* ide_detach */ | 130 | } /* ide_detach */ |
149 | 131 | ||
@@ -217,9 +199,6 @@ out_release: | |||
217 | 199 | ||
218 | ======================================================================*/ | 200 | ======================================================================*/ |
219 | 201 | ||
220 | #define CS_CHECK(fn, ret) \ | ||
221 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
222 | |||
223 | struct pcmcia_config_check { | 202 | struct pcmcia_config_check { |
224 | unsigned long ctl_base; | 203 | unsigned long ctl_base; |
225 | int skip_vcc; | 204 | int skip_vcc; |
@@ -282,11 +261,11 @@ static int ide_config(struct pcmcia_device *link) | |||
282 | { | 261 | { |
283 | ide_info_t *info = link->priv; | 262 | ide_info_t *info = link->priv; |
284 | struct pcmcia_config_check *stk = NULL; | 263 | struct pcmcia_config_check *stk = NULL; |
285 | int last_ret = 0, last_fn = 0, is_kme = 0; | 264 | int ret = 0, is_kme = 0; |
286 | unsigned long io_base, ctl_base; | 265 | unsigned long io_base, ctl_base; |
287 | struct ide_host *host; | 266 | struct ide_host *host; |
288 | 267 | ||
289 | DEBUG(0, "ide_config(0x%p)\n", link); | 268 | dev_dbg(&link->dev, "ide_config(0x%p)\n", link); |
290 | 269 | ||
291 | is_kme = ((link->manf_id == MANFID_KME) && | 270 | is_kme = ((link->manf_id == MANFID_KME) && |
292 | ((link->card_id == PRODID_KME_KXLC005_A) || | 271 | ((link->card_id == PRODID_KME_KXLC005_A) || |
@@ -306,8 +285,12 @@ static int ide_config(struct pcmcia_device *link) | |||
306 | io_base = link->io.BasePort1; | 285 | io_base = link->io.BasePort1; |
307 | ctl_base = stk->ctl_base; | 286 | ctl_base = stk->ctl_base; |
308 | 287 | ||
309 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 288 | ret = pcmcia_request_irq(link, &link->irq); |
310 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 289 | if (ret) |
290 | goto failed; | ||
291 | ret = pcmcia_request_configuration(link, &link->conf); | ||
292 | if (ret) | ||
293 | goto failed; | ||
311 | 294 | ||
312 | /* disable drive interrupts during IDE probe */ | 295 | /* disable drive interrupts during IDE probe */ |
313 | outb(0x02, ctl_base); | 296 | outb(0x02, ctl_base); |
@@ -342,8 +325,6 @@ err_mem: | |||
342 | printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); | 325 | printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); |
343 | goto failed; | 326 | goto failed; |
344 | 327 | ||
345 | cs_failed: | ||
346 | cs_error(link, last_fn, last_ret); | ||
347 | failed: | 328 | failed: |
348 | kfree(stk); | 329 | kfree(stk); |
349 | ide_release(link); | 330 | ide_release(link); |
@@ -363,14 +344,21 @@ static void ide_release(struct pcmcia_device *link) | |||
363 | ide_info_t *info = link->priv; | 344 | ide_info_t *info = link->priv; |
364 | struct ide_host *host = info->host; | 345 | struct ide_host *host = info->host; |
365 | 346 | ||
366 | DEBUG(0, "ide_release(0x%p)\n", link); | 347 | dev_dbg(&link->dev, "ide_release(0x%p)\n", link); |
348 | |||
349 | if (info->ndev) { | ||
350 | ide_hwif_t *hwif = host->ports[0]; | ||
351 | unsigned long data_addr, ctl_addr; | ||
352 | |||
353 | data_addr = hwif->io_ports.data_addr; | ||
354 | ctl_addr = hwif->io_ports.ctl_addr; | ||
367 | 355 | ||
368 | if (info->ndev) | ||
369 | /* FIXME: if this fails we need to queue the cleanup somehow | ||
370 | -- need to investigate the required PCMCIA magic */ | ||
371 | ide_host_remove(host); | 356 | ide_host_remove(host); |
357 | info->ndev = 0; | ||
372 | 358 | ||
373 | info->ndev = 0; | 359 | release_region(ctl_addr, 1); |
360 | release_region(data_addr, 8); | ||
361 | } | ||
374 | 362 | ||
375 | pcmcia_disable_device(link); | 363 | pcmcia_disable_device(link); |
376 | } /* ide_release */ | 364 | } /* ide_release */ |
@@ -421,6 +409,8 @@ static struct pcmcia_device_id ide_ids[] = { | |||
421 | PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420), | 409 | PCMCIA_DEVICE_PROD_ID12("Hyperstone", "Model1", 0x3d5b9ef5, 0xca6ab420), |
422 | PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), | 410 | PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), |
423 | PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), | 411 | PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), |
412 | PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF CARD 1GB", 0x2e6d1829, 0x55d5bffb), | ||
413 | PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF CARD 4GB", 0x2e6d1829, 0x531e7d10), | ||
424 | PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), | 414 | PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), |
425 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), | 415 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), |
426 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), | 416 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), |
@@ -441,6 +431,8 @@ static struct pcmcia_device_id ide_ids[] = { | |||
441 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), | 431 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), |
442 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2), | 432 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2), |
443 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), | 433 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), |
434 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF133", 0x709b1bf1, 0x7558f133), | ||
435 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS8GCF133", 0x709b1bf1, 0xb2f89b47), | ||
444 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), | 436 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), |
445 | PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), | 437 | PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), |
446 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), | 438 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), |