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>
This commit is contained in:
parent
5b16464ac3
commit
792a1a9856
1 changed files with 14 additions and 19 deletions
|
@ -194,6 +194,16 @@ static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl,
|
||||||
if (hwif->present)
|
if (hwif->present)
|
||||||
return hwif;
|
return hwif;
|
||||||
|
|
||||||
|
/* retry registration in case device is still spinning up */
|
||||||
|
for (i = 0; i < 10; i++) {
|
||||||
|
msleep(100);
|
||||||
|
ide_port_scan(hwif);
|
||||||
|
if (hwif->present)
|
||||||
|
return hwif;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hwif;
|
||||||
|
|
||||||
out_release:
|
out_release:
|
||||||
release_region(ctl, 1);
|
release_region(ctl, 1);
|
||||||
release_region(io, 8);
|
release_region(io, 8);
|
||||||
|
@ -222,7 +232,7 @@ static int ide_config(struct pcmcia_device *link)
|
||||||
cistpl_cftable_entry_t dflt;
|
cistpl_cftable_entry_t dflt;
|
||||||
} *stk = NULL;
|
} *stk = NULL;
|
||||||
cistpl_cftable_entry_t *cfg;
|
cistpl_cftable_entry_t *cfg;
|
||||||
int i, pass, last_ret = 0, last_fn = 0, is_kme = 0;
|
int pass, last_ret = 0, last_fn = 0, is_kme = 0;
|
||||||
unsigned long io_base, ctl_base;
|
unsigned long io_base, ctl_base;
|
||||||
ide_hwif_t *hwif;
|
ide_hwif_t *hwif;
|
||||||
|
|
||||||
|
@ -319,30 +329,15 @@ static int ide_config(struct pcmcia_device *link)
|
||||||
if (is_kme)
|
if (is_kme)
|
||||||
outb(0x81, ctl_base+1);
|
outb(0x81, ctl_base+1);
|
||||||
|
|
||||||
/* retry registration in case device is still spinning up */
|
hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
|
||||||
for (i = 0; i < 10; i++) {
|
if (hwif == NULL && link->io.NumPorts1 == 0x20) {
|
||||||
hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link);
|
|
||||||
if (hwif)
|
|
||||||
break;
|
|
||||||
if (link->io.NumPorts1 == 0x20) {
|
|
||||||
outb(0x02, ctl_base + 0x10);
|
outb(0x02, ctl_base + 0x10);
|
||||||
hwif = idecs_register(io_base + 0x10, ctl_base + 0x10,
|
hwif = idecs_register(io_base + 0x10, ctl_base + 0x10,
|
||||||
link->irq.AssignedIRQ, link);
|
link->irq.AssignedIRQ, link);
|
||||||
if (hwif) {
|
|
||||||
io_base += 0x10;
|
|
||||||
ctl_base += 0x10;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
msleep(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hwif == NULL) {
|
if (hwif == NULL)
|
||||||
printk(KERN_NOTICE "ide-cs: ide_register() at 0x%3lx & 0x%3lx"
|
|
||||||
", irq %u failed\n", io_base, ctl_base,
|
|
||||||
link->irq.AssignedIRQ);
|
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
|
||||||
|
|
||||||
info->ndev = 1;
|
info->ndev = 1;
|
||||||
sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2);
|
sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue