aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-15 12:52:54 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-15 12:52:54 -0400
commit5880b5de7101cc123778c5d17d4f3986351f3122 (patch)
tree30deb7cee9dd1efadb2a2b27c6b5d38a0c055fd6 /drivers/ide
parentc9ef59ff01b6bd1c7360a64fcc8556a1193c2ed0 (diff)
ide: don't enable IORDY at a probe time
* Add 'unsigned long port_flags' field to ide_hwif_t. * Add IDE_PFLAG_PROBING port flag and keep it set during probing. * Fix ide_pio_need_iordy() to not enable IORDY at a probe time (IORDY may lead to controller lock up on certain controllers if the port is not occupied). Loosely based on the recent libata's fix by Tejun, thanks to Alan for the hint that IDE may also need it. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-probe.c16
-rw-r--r--drivers/ide/ide-xfer-mode.c6
2 files changed, 21 insertions, 1 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index f371b0de314f..fdd04bcd5568 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1378,6 +1378,9 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1378 1378
1379 ide_init_port(hwif, i & 1, d); 1379 ide_init_port(hwif, i & 1, d);
1380 ide_port_cable_detect(hwif); 1380 ide_port_cable_detect(hwif);
1381
1382 hwif->port_flags |= IDE_PFLAG_PROBING;
1383
1381 ide_port_init_devices(hwif); 1384 ide_port_init_devices(hwif);
1382 } 1385 }
1383 1386
@@ -1388,6 +1391,8 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1388 if (ide_probe_port(hwif) == 0) 1391 if (ide_probe_port(hwif) == 0)
1389 hwif->present = 1; 1392 hwif->present = 1;
1390 1393
1394 hwif->port_flags &= ~IDE_PFLAG_PROBING;
1395
1391 if ((hwif->host_flags & IDE_HFLAG_4DRIVES) == 0 || 1396 if ((hwif->host_flags & IDE_HFLAG_4DRIVES) == 0 ||
1392 hwif->mate == NULL || hwif->mate->present == 0) { 1397 hwif->mate == NULL || hwif->mate->present == 0) {
1393 if (ide_register_port(hwif)) { 1398 if (ide_register_port(hwif)) {
@@ -1569,11 +1574,20 @@ EXPORT_SYMBOL_GPL(ide_host_remove);
1569 1574
1570void ide_port_scan(ide_hwif_t *hwif) 1575void ide_port_scan(ide_hwif_t *hwif)
1571{ 1576{
1577 int rc;
1578
1572 ide_port_apply_params(hwif); 1579 ide_port_apply_params(hwif);
1573 ide_port_cable_detect(hwif); 1580 ide_port_cable_detect(hwif);
1581
1582 hwif->port_flags |= IDE_PFLAG_PROBING;
1583
1574 ide_port_init_devices(hwif); 1584 ide_port_init_devices(hwif);
1575 1585
1576 if (ide_probe_port(hwif) < 0) 1586 rc = ide_probe_port(hwif);
1587
1588 hwif->port_flags &= ~IDE_PFLAG_PROBING;
1589
1590 if (rc < 0)
1577 return; 1591 return;
1578 1592
1579 hwif->present = 1; 1593 hwif->present = 1;
diff --git a/drivers/ide/ide-xfer-mode.c b/drivers/ide/ide-xfer-mode.c
index 0b47ca139079..46d203ce60cc 100644
--- a/drivers/ide/ide-xfer-mode.c
+++ b/drivers/ide/ide-xfer-mode.c
@@ -109,6 +109,12 @@ EXPORT_SYMBOL_GPL(ide_get_best_pio_mode);
109 109
110int ide_pio_need_iordy(ide_drive_t *drive, const u8 pio) 110int ide_pio_need_iordy(ide_drive_t *drive, const u8 pio)
111{ 111{
112 /*
113 * IORDY may lead to controller lock up on certain controllers
114 * if the port is not occupied.
115 */
116 if (pio == 0 && (drive->hwif->port_flags & IDE_PFLAG_PROBING))
117 return 0;
112 return ata_id_pio_need_iordy(drive->id, pio); 118 return ata_id_pio_need_iordy(drive->id, pio);
113} 119}
114EXPORT_SYMBOL_GPL(ide_pio_need_iordy); 120EXPORT_SYMBOL_GPL(ide_pio_need_iordy);