aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-06-15 15:00:23 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-06-15 15:00:23 -0400
commit792a1a98560a2a1619491eed8b18fccb09b312a7 (patch)
tree98e2224ded6539220d0089e5ca0cf4f618a0c363 /drivers/ide
parent5b16464ac32a92c2332030d11ec445bddeb141fa (diff)
ide-cs: fix probing and add warm-plug support
* Fix probing by using ide_port_scan() and moving "retry loop" from ide_config() to idecs_register(). * Don't fail probe if there are no devices attached to a port. * Remove (now redundant) error message from ide_config(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/legacy/ide-cs.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index aa2ea3deac85..d08107db54d4 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -194,6 +194,16 @@ static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl,
194 if (hwif->present) 194 if (hwif->present)
195 return hwif; 195 return hwif;
196 196
197 /* retry registration in case device is still spinning up */
198 for (i = 0; i < 10; i++) {
199 msleep(100);
200 ide_port_scan(hwif);
201 if (hwif->present)
202 return hwif;
203 }
204
205 return hwif;
206
197out_release: 207out_release:
198 release_region(ctl, 1); 208 release_region(ctl, 1);
199 release_region(io, 8); 209 release_region(io, 8);
@@ -222,7 +232,7 @@ static int ide_config(struct pcmcia_device *link)
222 cistpl_cftable_entry_t dflt; 232 cistpl_cftable_entry_t dflt;
223 } *stk = NULL; 233 } *stk = NULL;
224 cistpl_cftable_entry_t *cfg; 234 cistpl_cftable_entry_t *cfg;
225 int i, pass, last_ret = 0, last_fn = 0, is_kme = 0; 235 int pass, last_ret = 0, last_fn = 0, is_kme = 0;
226 unsigned long io_base, ctl_base; 236 unsigned long io_base, ctl_base;
227 ide_hwif_t *hwif; 237 ide_hwif_t *hwif;
228 238
@@ -319,30 +329,15 @@ static int ide_config(struct pcmcia_device *link)
319 if (is_kme) 329 if (is_kme)
320 outb(0x81, ctl_base+1); 330 outb(0x81, ctl_base+1);
321 331
322 /* retry registration in case device is still spinning up */ 332 hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
323 for (i = 0; i < 10; i++) { 333 if (hwif == NULL && link->io.NumPorts1 == 0x20) {
324 hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
325 if (hwif)
326 break;
327 if (link->io.NumPorts1 == 0x20) {
328 outb(0x02, ctl_base + 0x10); 334 outb(0x02, ctl_base + 0x10);
329 hwif = idecs_register(io_base + 0x10, ctl_base + 0x10, 335 hwif = idecs_register(io_base + 0x10, ctl_base + 0x10,
330 link->irq.AssignedIRQ, link); 336 link->irq.AssignedIRQ, link);
331 if (hwif) {
332 io_base += 0x10;
333 ctl_base += 0x10;
334 break;
335 }
336 }
337 msleep(100);
338 } 337 }
339 338
340 if (hwif == NULL) { 339 if (hwif == NULL)
341 printk(KERN_NOTICE "ide-cs: ide_register() at 0x%3lx & 0x%3lx"
342 ", irq %u failed\n", io_base, ctl_base,
343 link->irq.AssignedIRQ);
344 goto failed; 340 goto failed;
345 }
346 341
347 info->ndev = 1; 342 info->ndev = 1;
348 sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2); 343 sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2);