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.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index c895ed52b2e8..89574b0bd56d 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -97,7 +97,7 @@ static void ide_disk_init_mult_count(ide_drive_t *drive)
97 drive->mult_req = id[ATA_ID_MULTSECT] & 0xff; 97 drive->mult_req = id[ATA_ID_MULTSECT] & 0xff;
98 98
99 if (drive->mult_req) 99 if (drive->mult_req)
100 drive->special.b.set_multmode = 1; 100 drive->special_flags |= IDE_SFLAG_SET_MULTMODE;
101 } 101 }
102} 102}
103 103
@@ -1035,6 +1035,15 @@ static void ide_port_init_devices(ide_hwif_t *hwif)
1035 if (port_ops && port_ops->init_dev) 1035 if (port_ops && port_ops->init_dev)
1036 port_ops->init_dev(drive); 1036 port_ops->init_dev(drive);
1037 } 1037 }
1038
1039 ide_port_for_each_dev(i, drive, hwif) {
1040 /*
1041 * default to PIO Mode 0 before we figure out
1042 * the most suited mode for the attached device
1043 */
1044 if (port_ops && port_ops->set_pio_mode)
1045 port_ops->set_pio_mode(drive, 0);
1046 }
1038} 1047}
1039 1048
1040static void ide_init_port(ide_hwif_t *hwif, unsigned int port, 1049static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
@@ -1042,8 +1051,7 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1042{ 1051{
1043 hwif->channel = port; 1052 hwif->channel = port;
1044 1053
1045 if (d->chipset) 1054 hwif->chipset = d->chipset ? d->chipset : ide_pci;
1046 hwif->chipset = d->chipset;
1047 1055
1048 if (d->init_iops) 1056 if (d->init_iops)
1049 d->init_iops(hwif); 1057 d->init_iops(hwif);
@@ -1132,8 +1140,8 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif)
1132 drive->hwif = hwif; 1140 drive->hwif = hwif;
1133 drive->ready_stat = ATA_DRDY; 1141 drive->ready_stat = ATA_DRDY;
1134 drive->bad_wstat = BAD_W_STAT; 1142 drive->bad_wstat = BAD_W_STAT;
1135 drive->special.b.recalibrate = 1; 1143 drive->special_flags = IDE_SFLAG_RECALIBRATE |
1136 drive->special.b.set_geometry = 1; 1144 IDE_SFLAG_SET_GEOMETRY;
1137 drive->name[0] = 'h'; 1145 drive->name[0] = 'h';
1138 drive->name[1] = 'd'; 1146 drive->name[1] = 'd';
1139 drive->name[2] = 'a' + j; 1147 drive->name[2] = 'a' + j;
@@ -1168,11 +1176,10 @@ static void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
1168 ide_port_init_devices_data(hwif); 1176 ide_port_init_devices_data(hwif);
1169} 1177}
1170 1178
1171static void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) 1179static void ide_init_port_hw(ide_hwif_t *hwif, struct ide_hw *hw)
1172{ 1180{
1173 memcpy(&hwif->io_ports, &hw->io_ports, sizeof(hwif->io_ports)); 1181 memcpy(&hwif->io_ports, &hw->io_ports, sizeof(hwif->io_ports));
1174 hwif->irq = hw->irq; 1182 hwif->irq = hw->irq;
1175 hwif->chipset = hw->chipset;
1176 hwif->dev = hw->dev; 1183 hwif->dev = hw->dev;
1177 hwif->gendev.parent = hw->parent ? hw->parent : hw->dev; 1184 hwif->gendev.parent = hw->parent ? hw->parent : hw->dev;
1178 hwif->ack_intr = hw->ack_intr; 1185 hwif->ack_intr = hw->ack_intr;
@@ -1257,7 +1264,8 @@ out_nomem:
1257 return -ENOMEM; 1264 return -ENOMEM;
1258} 1265}
1259 1266
1260struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) 1267struct ide_host *ide_host_alloc(const struct ide_port_info *d,
1268 struct ide_hw **hws, unsigned int n_ports)
1261{ 1269{
1262 struct ide_host *host; 1270 struct ide_host *host;
1263 struct device *dev = hws[0] ? hws[0]->dev : NULL; 1271 struct device *dev = hws[0] ? hws[0]->dev : NULL;
@@ -1268,7 +1276,7 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws)
1268 if (host == NULL) 1276 if (host == NULL)
1269 return NULL; 1277 return NULL;
1270 1278
1271 for (i = 0; i < MAX_HOST_PORTS; i++) { 1279 for (i = 0; i < n_ports; i++) {
1272 ide_hwif_t *hwif; 1280 ide_hwif_t *hwif;
1273 int idx; 1281 int idx;
1274 1282
@@ -1344,7 +1352,7 @@ static void ide_disable_port(ide_hwif_t *hwif)
1344} 1352}
1345 1353
1346int ide_host_register(struct ide_host *host, const struct ide_port_info *d, 1354int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1347 hw_regs_t **hws) 1355 struct ide_hw **hws)
1348{ 1356{
1349 ide_hwif_t *hwif, *mate = NULL; 1357 ide_hwif_t *hwif, *mate = NULL;
1350 int i, j = 0; 1358 int i, j = 0;
@@ -1438,13 +1446,13 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
1438} 1446}
1439EXPORT_SYMBOL_GPL(ide_host_register); 1447EXPORT_SYMBOL_GPL(ide_host_register);
1440 1448
1441int ide_host_add(const struct ide_port_info *d, hw_regs_t **hws, 1449int ide_host_add(const struct ide_port_info *d, struct ide_hw **hws,
1442 struct ide_host **hostp) 1450 unsigned int n_ports, struct ide_host **hostp)
1443{ 1451{
1444 struct ide_host *host; 1452 struct ide_host *host;
1445 int rc; 1453 int rc;
1446 1454
1447 host = ide_host_alloc(d, hws); 1455 host = ide_host_alloc(d, hws, n_ports);
1448 if (host == NULL) 1456 if (host == NULL)
1449 return -ENOMEM; 1457 return -ENOMEM;
1450 1458