aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 875429728021..dfe516fdd079 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -821,13 +821,14 @@ static int ide_probe_port(ide_hwif_t *hwif)
821 821
822static void ide_port_tune_devices(ide_hwif_t *hwif) 822static void ide_port_tune_devices(ide_hwif_t *hwif)
823{ 823{
824 const struct ide_port_ops *port_ops = hwif->port_ops;
824 int unit; 825 int unit;
825 826
826 for (unit = 0; unit < MAX_DRIVES; unit++) { 827 for (unit = 0; unit < MAX_DRIVES; unit++) {
827 ide_drive_t *drive = &hwif->drives[unit]; 828 ide_drive_t *drive = &hwif->drives[unit];
828 829
829 if (drive->present && hwif->quirkproc) 830 if (drive->present && port_ops && port_ops->quirkproc)
830 hwif->quirkproc(drive); 831 port_ops->quirkproc(drive);
831 } 832 }
832 833
833 for (unit = 0; unit < MAX_DRIVES; ++unit) { 834 for (unit = 0; unit < MAX_DRIVES; ++unit) {
@@ -1324,6 +1325,7 @@ static void hwif_register_devices(ide_hwif_t *hwif)
1324 1325
1325static void ide_port_init_devices(ide_hwif_t *hwif) 1326static void ide_port_init_devices(ide_hwif_t *hwif)
1326{ 1327{
1328 const struct ide_port_ops *port_ops = hwif->port_ops;
1327 int i; 1329 int i;
1328 1330
1329 for (i = 0; i < MAX_DRIVES; i++) { 1331 for (i = 0; i < MAX_DRIVES; i++) {
@@ -1339,8 +1341,8 @@ static void ide_port_init_devices(ide_hwif_t *hwif)
1339 drive->autotune = 1; 1341 drive->autotune = 1;
1340 } 1342 }
1341 1343
1342 if (hwif->port_init_devs) 1344 if (port_ops && port_ops->port_init_devs)
1343 hwif->port_init_devs(hwif); 1345 port_ops->port_init_devs(hwif);
1344} 1346}
1345 1347
1346static void ide_init_port(ide_hwif_t *hwif, unsigned int port, 1348static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
@@ -1365,6 +1367,10 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1365 hwif->host_flags = d->host_flags; 1367 hwif->host_flags = d->host_flags;
1366 hwif->pio_mask = d->pio_mask; 1368 hwif->pio_mask = d->pio_mask;
1367 1369
1370 /* ->set_pio_mode for DTC2278 is currently limited to port 0 */
1371 if (hwif->chipset != ide_dtc2278 || hwif->channel == 0)
1372 hwif->port_ops = d->port_ops;
1373
1368 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) 1374 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
1369 hwif->mate->serialized = hwif->serialized = 1; 1375 hwif->mate->serialized = hwif->serialized = 1;
1370 1376
@@ -1386,9 +1392,11 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1386 1392
1387static void ide_port_cable_detect(ide_hwif_t *hwif) 1393static void ide_port_cable_detect(ide_hwif_t *hwif)
1388{ 1394{
1389 if (hwif->cable_detect && (hwif->ultra_mask & 0x78)) { 1395 const struct ide_port_ops *port_ops = hwif->port_ops;
1396
1397 if (port_ops && port_ops->cable_detect && (hwif->ultra_mask & 0x78)) {
1390 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 1398 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
1391 hwif->cbl = hwif->cable_detect(hwif); 1399 hwif->cbl = port_ops->cable_detect(hwif);
1392 } 1400 }
1393} 1401}
1394 1402