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.c82
1 files changed, 78 insertions, 4 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 98a8af44bf64..4c3d2cf3be5b 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1289,12 +1289,86 @@ static void hwif_register_devices(ide_hwif_t *hwif)
1289 } 1289 }
1290} 1290}
1291 1291
1292int ide_device_add_all(u8 *idx) 1292static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1293 const struct ide_port_info *d)
1293{ 1294{
1294 ide_hwif_t *hwif; 1295 if (d->chipset != ide_etrax100)
1296 hwif->channel = port;
1297
1298 if (d->chipset)
1299 hwif->chipset = d->chipset;
1300
1301 if (d->init_iops)
1302 d->init_iops(hwif);
1303
1304 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
1305 ide_hwif_setup_dma(hwif, d);
1306
1307 if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
1308 (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS))
1309 hwif->irq = port ? 15 : 14;
1310
1311 hwif->host_flags = d->host_flags;
1312 hwif->pio_mask = d->pio_mask;
1313
1314 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
1315 hwif->mate->serialized = hwif->serialized = 1;
1316
1317 if (d->host_flags & IDE_HFLAG_IO_32BIT) {
1318 hwif->drives[0].io_32bit = 1;
1319 hwif->drives[1].io_32bit = 1;
1320 }
1321
1322 if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) {
1323 hwif->drives[0].unmask = 1;
1324 hwif->drives[1].unmask = 1;
1325 }
1326
1327 hwif->swdma_mask = d->swdma_mask;
1328 hwif->mwdma_mask = d->mwdma_mask;
1329 hwif->ultra_mask = d->udma_mask;
1330
1331 /* reset DMA masks only for SFF-style DMA controllers */
1332 if ((d->host_flags && IDE_HFLAG_NO_DMA) == 0 && hwif->dma_base == 0)
1333 hwif->swdma_mask = hwif->mwdma_mask = hwif->ultra_mask = 0;
1334
1335 if ((d->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0) {
1336 hwif->drives[0].autotune = 1;
1337 hwif->drives[1].autotune = 1;
1338 }
1339
1340 if (d->host_flags & IDE_HFLAG_RQSIZE_256)
1341 hwif->rqsize = 256;
1342
1343 /* call chipset specific routine for each enabled port */
1344 if (d->init_hwif)
1345 d->init_hwif(hwif);
1346}
1347
1348int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
1349{
1350 ide_hwif_t *hwif, *mate = NULL;
1295 int i, rc = 0; 1351 int i, rc = 0;
1296 1352
1297 for (i = 0; i < MAX_HWIFS; i++) { 1353 for (i = 0; i < MAX_HWIFS; i++) {
1354 if (d == NULL || idx[i] == 0xff) {
1355 mate = NULL;
1356 continue;
1357 }
1358
1359 hwif = &ide_hwifs[idx[i]];
1360
1361 if (d->chipset != ide_etrax100 && (i & 1) && mate) {
1362 hwif->mate = mate;
1363 mate->mate = hwif;
1364 }
1365
1366 mate = (i & 1) ? NULL : hwif;
1367
1368 ide_init_port(hwif, i & 1, d);
1369 }
1370
1371 for (i = 0; i < MAX_HWIFS; i++) {
1298 if (idx[i] == 0xff) 1372 if (idx[i] == 0xff)
1299 continue; 1373 continue;
1300 1374
@@ -1362,7 +1436,7 @@ int ide_device_add_all(u8 *idx)
1362} 1436}
1363EXPORT_SYMBOL_GPL(ide_device_add_all); 1437EXPORT_SYMBOL_GPL(ide_device_add_all);
1364 1438
1365int ide_device_add(u8 idx[4]) 1439int ide_device_add(u8 idx[4], const struct ide_port_info *d)
1366{ 1440{
1367 u8 idx_all[MAX_HWIFS]; 1441 u8 idx_all[MAX_HWIFS];
1368 int i; 1442 int i;
@@ -1370,6 +1444,6 @@ int ide_device_add(u8 idx[4])
1370 for (i = 0; i < MAX_HWIFS; i++) 1444 for (i = 0; i < MAX_HWIFS; i++)
1371 idx_all[i] = (i < 4) ? idx[i] : 0xff; 1445 idx_all[i] = (i < 4) ? idx[i] : 0xff;
1372 1446
1373 return ide_device_add_all(idx_all); 1447 return ide_device_add_all(idx_all, d);
1374} 1448}
1375EXPORT_SYMBOL_GPL(ide_device_add); 1449EXPORT_SYMBOL_GPL(ide_device_add);