aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:31 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:31 -0500
commitc413b9b94d9a8e7548cc4b2e04b7df0439ce76fd (patch)
tree5d23110a0d1f87ad0c88fb1746194e532808eaab /drivers/ide
parent1ebf74936b1fccb5b65940f99ccddd74ec4d1fef (diff)
ide: add struct ide_port_info instances to legacy host drivers
* Remove 'struct pci_dev *dev' argument from ide_hwif_setup_dma(). * Un-static ide_hwif_setup_dma() and add CONFIG_BLK_DEV_IDEDMA_PCI=n version. * Add 'const struct ide_port_info *d' argument to ide_device_add[_all](). * Factor out generic ports init from ide_pci_setup_ports() to ide_init_port(), move it to ide-probe.c and call it in in ide_device_add_all() instead of ide_pci_setup_ports(). * Move ->mate setup to ide_device_add_all() from ide_port_init(). * Add IDE_HFLAG_NO_AUTOTUNE host flag for host drivers that don't enable ->autotune currently. * Setup hwif->chipset in ide_init_port() but iff pi->chipset is set (to not override setup done by ide_hwif_configure()). * Add ETRAX host handling to ide_device_add_all(). * cmd640.c: set IDE_HFLAG_ABUSE_* also for CONFIG_BLK_DEV_CMD640_ENHANCED=n. * pmac.c: make pmac_ide_setup_dma() return an error value and move DMA masks setup to pmac_ide_setup_device(). * Add 'struct ide_port_info' instances to legacy host drivers, pass them to ide_device_add() calls and then remove open-coded ports initialization. Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/arm/icside.c25
-rw-r--r--drivers/ide/arm/ide_arm.c2
-rw-r--r--drivers/ide/arm/rapide.c2
-rw-r--r--drivers/ide/cris/ide-cris.c18
-rw-r--r--drivers/ide/h8300/ide-h8300.c2
-rw-r--r--drivers/ide/ide-generic.c2
-rw-r--r--drivers/ide/ide-pnp.c2
-rw-r--r--drivers/ide/ide-probe.c82
-rw-r--r--drivers/ide/ide.c2
-rw-r--r--drivers/ide/legacy/ali14xx.c24
-rw-r--r--drivers/ide/legacy/buddha.c2
-rw-r--r--drivers/ide/legacy/dtc2278.c24
-rw-r--r--drivers/ide/legacy/falconide.c2
-rw-r--r--drivers/ide/legacy/gayle.c2
-rw-r--r--drivers/ide/legacy/ht6560b.c22
-rw-r--r--drivers/ide/legacy/ide_platform.c2
-rw-r--r--drivers/ide/legacy/macide.c2
-rw-r--r--drivers/ide/legacy/q40ide.c2
-rw-r--r--drivers/ide/legacy/qd65xx.c23
-rw-r--r--drivers/ide/legacy/umc8672.c24
-rw-r--r--drivers/ide/mips/au1xxx-ide.c31
-rw-r--r--drivers/ide/mips/swarm.c2
-rw-r--r--drivers/ide/pci/cmd640.c29
-rw-r--r--drivers/ide/pci/cs5520.c2
-rw-r--r--drivers/ide/pci/sgiioc4.c18
-rw-r--r--drivers/ide/ppc/mpc8xx.c2
-rw-r--r--drivers/ide/ppc/pmac.c84
-rw-r--r--drivers/ide/setup-pci.c81
28 files changed, 247 insertions, 268 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 8d2cc47a362e..fb00f3827ecd 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -377,9 +377,6 @@ static void icside_dma_lost_irq(ide_drive_t *drive)
377 377
378static void icside_dma_init(ide_hwif_t *hwif) 378static void icside_dma_init(ide_hwif_t *hwif)
379{ 379{
380 hwif->mwdma_mask = 7; /* MW0..2 */
381 hwif->swdma_mask = 7; /* SW0..2 */
382
383 hwif->dmatable_cpu = NULL; 380 hwif->dmatable_cpu = NULL;
384 hwif->dmatable_dma = 0; 381 hwif->dmatable_dma = 0;
385 hwif->set_dma_mode = icside_set_dma_mode; 382 hwif->set_dma_mode = icside_set_dma_mode;
@@ -459,11 +456,19 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
459 456
460 idx[0] = hwif->index; 457 idx[0] = hwif->index;
461 458
462 ide_device_add(idx); 459 ide_device_add(idx, NULL);
463 460
464 return 0; 461 return 0;
465} 462}
466 463
464static const struct ide_port_info icside_v6_port_info __initdata = {
465 .host_flags = IDE_HFLAG_SERIALIZE |
466 IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
467 IDE_HFLAG_NO_AUTOTUNE,
468 .mwdma_mask = ATA_MWDMA2,
469 .swdma_mask = ATA_SWDMA2,
470};
471
467static int __init 472static int __init
468icside_register_v6(struct icside_state *state, struct expansion_card *ec) 473icside_register_v6(struct icside_state *state, struct expansion_card *ec)
469{ 474{
@@ -472,6 +477,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
472 unsigned int sel = 0; 477 unsigned int sel = 0;
473 int ret; 478 int ret;
474 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 479 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
480 struct ide_port_info d = icside_v6_port_info;
475 481
476 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); 482 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
477 if (!ioc_base) { 483 if (!ioc_base) {
@@ -521,30 +527,25 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
521 state->hwif[1] = mate; 527 state->hwif[1] = mate;
522 528
523 hwif->maskproc = icside_maskproc; 529 hwif->maskproc = icside_maskproc;
524 hwif->channel = 0;
525 hwif->hwif_data = state; 530 hwif->hwif_data = state;
526 hwif->mate = mate;
527 hwif->serialized = 1;
528 hwif->config_data = (unsigned long)ioc_base; 531 hwif->config_data = (unsigned long)ioc_base;
529 hwif->select_data = sel; 532 hwif->select_data = sel;
530 533
531 mate->maskproc = icside_maskproc; 534 mate->maskproc = icside_maskproc;
532 mate->channel = 1;
533 mate->hwif_data = state; 535 mate->hwif_data = state;
534 mate->mate = hwif;
535 mate->serialized = 1;
536 mate->config_data = (unsigned long)ioc_base; 536 mate->config_data = (unsigned long)ioc_base;
537 mate->select_data = sel | 1; 537 mate->select_data = sel | 1;
538 538
539 if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { 539 if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) {
540 icside_dma_init(hwif); 540 icside_dma_init(hwif);
541 icside_dma_init(mate); 541 icside_dma_init(mate);
542 } 542 } else
543 d.mwdma_mask = d.swdma_mask = 0;
543 544
544 idx[0] = hwif->index; 545 idx[0] = hwif->index;
545 idx[1] = mate->index; 546 idx[1] = mate->index;
546 547
547 ide_device_add(idx); 548 ide_device_add(idx, &d);
548 549
549 return 0; 550 return 0;
550 551
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c
index 60f2497542c0..43a70e91363e 100644
--- a/drivers/ide/arm/ide_arm.c
+++ b/drivers/ide/arm/ide_arm.c
@@ -39,7 +39,7 @@ static int __init ide_arm_init(void)
39 ide_init_port_hw(hwif, &hw); 39 ide_init_port_hw(hwif, &hw);
40 idx[0] = hwif->index; 40 idx[0] = hwif->index;
41 41
42 ide_device_add(idx); 42 ide_device_add(idx, NULL);
43 } 43 }
44 44
45 return 0; 45 return 0;
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index c8b6581e624e..b30adcf321c3 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -58,7 +58,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
58 58
59 idx[0] = hwif->index; 59 idx[0] = hwif->index;
60 60
61 ide_device_add(idx); 61 ide_device_add(idx, NULL);
62 62
63 ecard_set_drvdata(ec, hwif); 63 ecard_set_drvdata(ec, hwif);
64 goto out; 64 goto out;
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index 0640a38ff127..ac645263fd09 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -753,6 +753,15 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed)
753 cris_ide_set_speed(TYPE_DMA, 0, strobe, hold); 753 cris_ide_set_speed(TYPE_DMA, 0, strobe, hold);
754} 754}
755 755
756static const struct ide_port_info cris_port_info __initdata = {
757 .chipset = ide_etrax100,
758 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
759 IDE_HFLAG_NO_DMA, /* no SFF-style DMA */
760 .pio_mask = ATA_PIO4,
761 .udma_mask = cris_ultra_mask,
762 .mwdma_mask = ATA_MWDMA2,
763};
764
756static int __init init_e100_ide(void) 765static int __init init_e100_ide(void)
757{ 766{
758 hw_regs_t hw; 767 hw_regs_t hw;
@@ -780,7 +789,6 @@ static int __init init_e100_ide(void)
780 ide_init_port_data(hwif, hwif->index); 789 ide_init_port_data(hwif, hwif->index);
781 ide_init_port_hw(hwif, &hw); 790 ide_init_port_hw(hwif, &hw);
782 hwif->mmio = 1; 791 hwif->mmio = 1;
783 hwif->chipset = ide_etrax100;
784 hwif->set_pio_mode = &cris_set_pio_mode; 792 hwif->set_pio_mode = &cris_set_pio_mode;
785 hwif->set_dma_mode = &cris_set_dma_mode; 793 hwif->set_dma_mode = &cris_set_dma_mode;
786 hwif->ata_input_data = &cris_ide_input_data; 794 hwif->ata_input_data = &cris_ide_input_data;
@@ -799,12 +807,6 @@ static int __init init_e100_ide(void)
799 hwif->INB = &cris_ide_inb; 807 hwif->INB = &cris_ide_inb;
800 hwif->INW = &cris_ide_inw; 808 hwif->INW = &cris_ide_inw;
801 hwif->cbl = ATA_CBL_PATA40; 809 hwif->cbl = ATA_CBL_PATA40;
802 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
803 hwif->pio_mask = ATA_PIO4,
804 hwif->drives[0].autotune = 1;
805 hwif->drives[1].autotune = 1;
806 hwif->ultra_mask = cris_ultra_mask;
807 hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
808 810
809 idx[h] = hwif->index; 811 idx[h] = hwif->index;
810 } 812 }
@@ -820,7 +822,7 @@ static int __init init_e100_ide(void)
820 cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD); 822 cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD);
821 cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0); 823 cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0);
822 824
823 ide_device_add(idx); 825 ide_device_add(idx, &cris_port_info);
824 826
825 return 0; 827 return 0;
826} 828}
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index 02432958dfe1..520aec075700 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -114,7 +114,7 @@ static int __init h8300_ide_init(void)
114 114
115 idx[0] = index; 115 idx[0] = index;
116 116
117 ide_device_add(idx); 117 ide_device_add(idx, NULL);
118 118
119 return 0; 119 return 0;
120 120
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
index bb30c29f6ec0..be469dbbe8fb 100644
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -23,7 +23,7 @@ static int __init ide_generic_init(void)
23 for (i = 0; i < MAX_HWIFS; i++) 23 for (i = 0; i < MAX_HWIFS; i++)
24 idx[i] = ide_hwifs[i].present ? 0xff : i; 24 idx[i] = ide_hwifs[i].present ? 0xff : i;
25 25
26 ide_device_add_all(idx); 26 ide_device_add_all(idx, NULL);
27 27
28 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) 28 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
29 ide_release_lock(); /* for atari only */ 29 ide_release_lock(); /* for atari only */
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index 4bda5cf2be37..61c33ef64bda 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -49,7 +49,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
49 printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); 49 printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
50 pnp_set_drvdata(dev,hwif); 50 pnp_set_drvdata(dev,hwif);
51 51
52 ide_device_add(idx); 52 ide_device_add(idx, NULL);
53 53
54 return 0; 54 return 0;
55 } 55 }
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);
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index fb0c47c8819d..eeb0e6a77f5b 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -728,7 +728,7 @@ found:
728 728
729 idx[0] = index; 729 idx[0] = index;
730 730
731 ide_device_add(idx); 731 ide_device_add(idx, NULL);
732 732
733 if (hwifp) 733 if (hwifp)
734 *hwifp = hwif; 734 *hwifp = hwif;
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index e3ea2096804a..d4d1a6bea599 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -191,9 +191,14 @@ static int __init initRegisters (void) {
191 return t; 191 return t;
192} 192}
193 193
194static const struct ide_port_info ali14xx_port_info = {
195 .chipset = ide_ali14xx,
196 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
197 .pio_mask = ATA_PIO4,
198};
199
194static int __init ali14xx_probe(void) 200static int __init ali14xx_probe(void)
195{ 201{
196 ide_hwif_t *hwif, *mate;
197 static u8 idx[4] = { 0, 1, 0xff, 0xff }; 202 static u8 idx[4] = { 0, 1, 0xff, 0xff };
198 203
199 printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", 204 printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n",
@@ -205,21 +210,10 @@ static int __init ali14xx_probe(void)
205 return 1; 210 return 1;
206 } 211 }
207 212
208 hwif = &ide_hwifs[0]; 213 ide_hwifs[0].set_pio_mode = &ali14xx_set_pio_mode;
209 mate = &ide_hwifs[1]; 214 ide_hwifs[1].set_pio_mode = &ali14xx_set_pio_mode;
210
211 hwif->chipset = ide_ali14xx;
212 hwif->pio_mask = ATA_PIO4;
213 hwif->set_pio_mode = &ali14xx_set_pio_mode;
214 hwif->mate = mate;
215
216 mate->chipset = ide_ali14xx;
217 mate->pio_mask = ATA_PIO4;
218 mate->set_pio_mode = &ali14xx_set_pio_mode;
219 mate->mate = hwif;
220 mate->channel = 1;
221 215
222 ide_device_add(idx); 216 ide_device_add(idx, &ali14xx_port_info);
223 217
224 return 0; 218 return 0;
225} 219}
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index dd3d198ade47..8bdb79da17e8 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -232,7 +232,7 @@ fail_base2:
232 } 232 }
233 } 233 }
234 234
235 ide_device_add(idx); 235 ide_device_add(idx, NULL);
236 } 236 }
237 237
238 return 0; 238 return 0;
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index 092c04abbe7a..7cbf2f1f35f9 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -86,6 +86,15 @@ static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio)
86 } 86 }
87} 87}
88 88
89static const struct ide_port_info dtc2278_port_info __initdata = {
90 .chipset = ide_dtc2278,
91 .host_flags = IDE_HFLAG_SERIALIZE |
92 IDE_HFLAG_IO_32BIT |
93 IDE_HFLAG_NO_DMA |
94 IDE_HFLAG_NO_AUTOTUNE,
95 .pio_mask = ATA_PIO4,
96};
97
89static int __init dtc2278_probe(void) 98static int __init dtc2278_probe(void)
90{ 99{
91 unsigned long flags; 100 unsigned long flags;
@@ -116,29 +125,16 @@ static int __init dtc2278_probe(void)
116#endif 125#endif
117 local_irq_restore(flags); 126 local_irq_restore(flags);
118 127
119 hwif->serialized = 1;
120 hwif->no_io_32bit = 1; /* disallow ->io_32bit changes */ 128 hwif->no_io_32bit = 1; /* disallow ->io_32bit changes */
121 hwif->chipset = ide_dtc2278;
122 hwif->pio_mask = ATA_PIO4;
123 hwif->set_pio_mode = &dtc2278_set_pio_mode; 129 hwif->set_pio_mode = &dtc2278_set_pio_mode;
124 hwif->drives[0].no_unmask = 1; 130 hwif->drives[0].no_unmask = 1;
125 hwif->drives[1].no_unmask = 1; 131 hwif->drives[1].no_unmask = 1;
126 hwif->drives[0].io_32bit = 1;
127 hwif->drives[1].io_32bit = 1;
128 hwif->mate = mate;
129 132
130 mate->serialized = 1;
131 mate->no_io_32bit = 1; 133 mate->no_io_32bit = 1;
132 mate->chipset = ide_dtc2278;
133 mate->pio_mask = ATA_PIO4;
134 mate->drives[0].no_unmask = 1; 134 mate->drives[0].no_unmask = 1;
135 mate->drives[1].no_unmask = 1; 135 mate->drives[1].no_unmask = 1;
136 mate->drives[0].io_32bit = 1;
137 mate->drives[1].io_32bit = 1;
138 mate->mate = hwif;
139 mate->channel = 1;
140 136
141 ide_device_add(idx); 137 ide_device_add(idx, &dtc2278_port_info);
142 138
143 return 0; 139 return 0;
144} 140}
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index c9bd6bfb1f3b..85b69a82825f 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -83,7 +83,7 @@ static int __init falconide_init(void)
83 ide_init_port_data(hwif, index); 83 ide_init_port_data(hwif, index);
84 ide_init_port_hw(hwif, &hw); 84 ide_init_port_hw(hwif, &hw);
85 85
86 ide_device_add(idx); 86 ide_device_add(idx, NULL);
87 } 87 }
88 } 88 }
89 89
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index f67c51a2c84a..fc29ce75aff1 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -186,7 +186,7 @@ found:
186 release_mem_region(res_start, res_n); 186 release_mem_region(res_start, res_n);
187 } 187 }
188 188
189 ide_device_add(idx); 189 ide_device_add(idx, NULL);
190 190
191 return 0; 191 return 0;
192} 192}
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 57bc15cddca0..a89cd80d8124 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -305,6 +305,15 @@ int probe_ht6560b = 0;
305module_param_named(probe, probe_ht6560b, bool, 0); 305module_param_named(probe, probe_ht6560b, bool, 0);
306MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); 306MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
307 307
308static const struct ide_port_info ht6560b_port_info __initdata = {
309 .chipset = ide_ht6560b,
310 .host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */
311 IDE_HFLAG_NO_DMA |
312 IDE_HFLAG_NO_AUTOTUNE |
313 IDE_HFLAG_ABUSE_PREFETCH,
314 .pio_mask = ATA_PIO5,
315};
316
308static int __init ht6560b_init(void) 317static int __init ht6560b_init(void)
309{ 318{
310 ide_hwif_t *hwif, *mate; 319 ide_hwif_t *hwif, *mate;
@@ -328,22 +337,11 @@ static int __init ht6560b_init(void)
328 goto release_region; 337 goto release_region;
329 } 338 }
330 339
331 hwif->chipset = ide_ht6560b;
332 hwif->selectproc = &ht6560b_selectproc; 340 hwif->selectproc = &ht6560b_selectproc;
333 hwif->host_flags = IDE_HFLAG_ABUSE_PREFETCH;
334 hwif->pio_mask = ATA_PIO5;
335 hwif->set_pio_mode = &ht6560b_set_pio_mode; 341 hwif->set_pio_mode = &ht6560b_set_pio_mode;
336 hwif->serialized = 1; /* is this needed? */
337 hwif->mate = mate;
338 342
339 mate->chipset = ide_ht6560b;
340 mate->selectproc = &ht6560b_selectproc; 343 mate->selectproc = &ht6560b_selectproc;
341 mate->host_flags = IDE_HFLAG_ABUSE_PREFETCH;
342 mate->pio_mask = ATA_PIO5;
343 mate->set_pio_mode = &ht6560b_set_pio_mode; 344 mate->set_pio_mode = &ht6560b_set_pio_mode;
344 mate->serialized = 1; /* is this needed? */
345 mate->mate = hwif;
346 mate->channel = 1;
347 345
348 /* 346 /*
349 * Setting default configurations for drives 347 * Setting default configurations for drives
@@ -357,7 +355,7 @@ static int __init ht6560b_init(void)
357 mate->drives[0].drive_data = t; 355 mate->drives[0].drive_data = t;
358 mate->drives[1].drive_data = t; 356 mate->drives[1].drive_data = t;
359 357
360 ide_device_add(idx); 358 ide_device_add(idx, &ht6560b_port_info);
361 359
362 return 0; 360 return 0;
363 361
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
index 7c3231a21d17..7c7f42a1fffa 100644
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -108,7 +108,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
108 108
109 idx[0] = hwif->index; 109 idx[0] = hwif->index;
110 110
111 ide_device_add(idx); 111 ide_device_add(idx, NULL);
112 112
113 platform_set_drvdata(pdev, hwif); 113 platform_set_drvdata(pdev, hwif);
114 114
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index 12cd26d0aa20..06df8df857a3 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -125,7 +125,7 @@ static int __init macide_init(void)
125 125
126 hwif->mmio = 1; 126 hwif->mmio = 1;
127 127
128 ide_device_add(idx); 128 ide_device_add(idx, NULL);
129 } 129 }
130 130
131 return 0; 131 return 0;
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index a9c6b0609c54..2f0b34d892a1 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -154,7 +154,7 @@ static int __init q40ide_init(void)
154 } 154 }
155 } 155 }
156 156
157 ide_device_add(idx); 157 ide_device_add(idx, NULL);
158 158
159 return 0; 159 return 0;
160} 160}
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 37534bb483a7..60a6ed1088df 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -308,15 +308,10 @@ static int __init qd_testreg(int port)
308static void __init qd_setup(ide_hwif_t *hwif, int base, int config, 308static void __init qd_setup(ide_hwif_t *hwif, int base, int config,
309 unsigned int data0, unsigned int data1) 309 unsigned int data0, unsigned int data1)
310{ 310{
311 hwif->chipset = ide_qd65xx;
312 hwif->channel = hwif->index;
313 hwif->select_data = base; 311 hwif->select_data = base;
314 hwif->config_data = config; 312 hwif->config_data = config;
315 hwif->drives[0].drive_data = data0; 313 hwif->drives[0].drive_data = data0;
316 hwif->drives[1].drive_data = data1; 314 hwif->drives[1].drive_data = data1;
317 hwif->drives[0].io_32bit =
318 hwif->drives[1].io_32bit = 1;
319 hwif->pio_mask = ATA_PIO4;
320} 315}
321 316
322/* 317/*
@@ -356,6 +351,14 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
356} 351}
357*/ 352*/
358 353
354static const struct ide_port_info qd65xx_port_info __initdata = {
355 .chipset = ide_qd65xx,
356 .host_flags = IDE_HFLAG_IO_32BIT |
357 IDE_HFLAG_NO_DMA |
358 IDE_HFLAG_NO_AUTOTUNE,
359 .pio_mask = ATA_PIO4,
360};
361
359/* 362/*
360 * qd_probe: 363 * qd_probe:
361 * 364 *
@@ -397,9 +400,9 @@ static int __init qd_probe(int base)
397 400
398 hwif->set_pio_mode = &qd6500_set_pio_mode; 401 hwif->set_pio_mode = &qd6500_set_pio_mode;
399 402
400 idx[0] = unit; 403 idx[unit] = unit;
401 404
402 ide_device_add(idx); 405 ide_device_add(idx, &qd65xx_port_info);
403 406
404 return 1; 407 return 1;
405 } 408 }
@@ -431,9 +434,9 @@ static int __init qd_probe(int base)
431 434
432 hwif->set_pio_mode = &qd6580_set_pio_mode; 435 hwif->set_pio_mode = &qd6580_set_pio_mode;
433 436
434 idx[0] = unit; 437 idx[unit] = unit;
435 438
436 ide_device_add(idx); 439 ide_device_add(idx, &qd65xx_port_info);
437 440
438 outb(QD_DEF_CONTR, QD_CONTROL_PORT); 441 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
439 442
@@ -460,7 +463,7 @@ static int __init qd_probe(int base)
460 idx[0] = 0; 463 idx[0] = 0;
461 idx[1] = 1; 464 idx[1] = 1;
462 465
463 ide_device_add(idx); 466 ide_device_add(idx, &qd65xx_port_info);
464 467
465 outb(QD_DEF_CONTR, QD_CONTROL_PORT); 468 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
466 469
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index 26f38ce58776..5696ba026005 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -120,9 +120,14 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio)
120 spin_unlock_irqrestore(&ide_lock, flags); 120 spin_unlock_irqrestore(&ide_lock, flags);
121} 121}
122 122
123static const struct ide_port_info umc8672_port_info __initdata = {
124 .chipset = ide_umc8672,
125 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE,
126 .pio_mask = ATA_PIO4,
127};
128
123static int __init umc8672_probe(void) 129static int __init umc8672_probe(void)
124{ 130{
125 ide_hwif_t *hwif, *mate;
126 unsigned long flags; 131 unsigned long flags;
127 static u8 idx[4] = { 0, 1, 0xff, 0xff }; 132 static u8 idx[4] = { 0, 1, 0xff, 0xff };
128 133
@@ -143,21 +148,10 @@ static int __init umc8672_probe(void)
143 umc_set_speeds (current_speeds); 148 umc_set_speeds (current_speeds);
144 local_irq_restore(flags); 149 local_irq_restore(flags);
145 150
146 hwif = &ide_hwifs[0]; 151 ide_hwifs[0].set_pio_mode = &umc_set_pio_mode;
147 mate = &ide_hwifs[1]; 152 ide_hwifs[1].set_pio_mode = &umc_set_pio_mode;
148
149 hwif->chipset = ide_umc8672;
150 hwif->pio_mask = ATA_PIO4;
151 hwif->set_pio_mode = &umc_set_pio_mode;
152 hwif->mate = mate;
153
154 mate->chipset = ide_umc8672;
155 mate->pio_mask = ATA_PIO4;
156 mate->set_pio_mode = &umc_set_pio_mode;
157 mate->mate = hwif;
158 mate->channel = 1;
159 153
160 ide_device_add(idx); 154 ide_device_add(idx, &umc8672_port_info);
161 155
162 return 0; 156 return 0;
163} 157}
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 6e98662b1192..b80d77a260da 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -548,6 +548,16 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
548 *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET); 548 *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET);
549} 549}
550 550
551static const struct ide_port_info au1xxx_port_info = {
552 .host_flags = IDE_HFLAG_POST_SET_MODE |
553 IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
554 IDE_HFLAG_UNMASK_IRQS,
555 .pio_mask = ATA_PIO4,
556#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
557 .mwdma_mask = ATA_MWDMA2,
558#endif
559};
560
551static int au_ide_probe(struct device *dev) 561static int au_ide_probe(struct device *dev)
552{ 562{
553 struct platform_device *pdev = to_platform_device(dev); 563 struct platform_device *pdev = to_platform_device(dev);
@@ -606,21 +616,6 @@ static int au_ide_probe(struct device *dev)
606 616
607 hwif->dev = dev; 617 hwif->dev = dev;
608 618
609 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */
610#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
611 hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */
612 hwif->swdma_mask = 0x00;
613#else
614 hwif->mwdma_mask = 0x0;
615 hwif->swdma_mask = 0x0;
616#endif
617
618 hwif->pio_mask = ATA_PIO4;
619 hwif->host_flags = IDE_HFLAG_POST_SET_MODE;
620
621 hwif->drives[0].unmask = 1;
622 hwif->drives[1].unmask = 1;
623
624 /* hold should be on in all cases */ 619 /* hold should be on in all cases */
625 hwif->hold = 1; 620 hwif->hold = 1;
626 621
@@ -651,13 +646,9 @@ static int au_ide_probe(struct device *dev)
651 hwif->ide_dma_test_irq = &auide_dma_test_irq; 646 hwif->ide_dma_test_irq = &auide_dma_test_irq;
652 hwif->dma_lost_irq = &auide_dma_lost_irq; 647 hwif->dma_lost_irq = &auide_dma_lost_irq;
653#endif 648#endif
654 hwif->channel = 0;
655 hwif->select_data = 0; /* no chipset-specific code */ 649 hwif->select_data = 0; /* no chipset-specific code */
656 hwif->config_data = 0; /* no chipset-specific code */ 650 hwif->config_data = 0; /* no chipset-specific code */
657 651
658 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */
659 hwif->drives[1].autotune = 1;
660
661 hwif->no_io_32bit = 1; 652 hwif->no_io_32bit = 1;
662 653
663 auide_hwif.hwif = hwif; 654 auide_hwif.hwif = hwif;
@@ -670,7 +661,7 @@ static int au_ide_probe(struct device *dev)
670 661
671 idx[0] = hwif->index; 662 idx[0] = hwif->index;
672 663
673 ide_device_add(idx); 664 ide_device_add(idx, &au1xxx_port_info);
674 665
675 dev_set_drvdata(dev, hwif); 666 dev_set_drvdata(dev, hwif);
676 667
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
index 8b3959dfa2b7..956259fc09ba 100644
--- a/drivers/ide/mips/swarm.c
+++ b/drivers/ide/mips/swarm.c
@@ -129,7 +129,7 @@ static int __devinit swarm_ide_probe(struct device *dev)
129 129
130 idx[0] = hwif->index; 130 idx[0] = hwif->index;
131 131
132 ide_device_add(idx); 132 ide_device_add(idx, NULL);
133 133
134 dev_set_drvdata(dev, hwif); 134 dev_set_drvdata(dev, hwif);
135 135
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index 7240c20b9593..ea0cb500df6a 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -703,6 +703,18 @@ static int pci_conf2(void)
703 return 0; 703 return 0;
704} 704}
705 705
706static const struct ide_port_info cmd640_port_info __initdata = {
707 .chipset = ide_cmd640,
708 .host_flags = IDE_HFLAG_SERIALIZE |
709 IDE_HFLAG_NO_DMA |
710 IDE_HFLAG_NO_AUTOTUNE |
711 IDE_HFLAG_ABUSE_PREFETCH |
712 IDE_HFLAG_ABUSE_FAST_DEVSEL,
713#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
714 .pio_mask = ATA_PIO5,
715#endif
716};
717
706/* 718/*
707 * Probe for a cmd640 chipset, and initialize it if found. 719 * Probe for a cmd640 chipset, and initialize it if found.
708 */ 720 */
@@ -760,11 +772,7 @@ static int __init cmd640x_init(void)
760 setup_device_ptrs (); 772 setup_device_ptrs ();
761 printk("%s: buggy cmd640%c interface on %s, config=0x%02x\n", 773 printk("%s: buggy cmd640%c interface on %s, config=0x%02x\n",
762 cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); 774 cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr);
763 cmd_hwif0->chipset = ide_cmd640;
764#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 775#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
765 cmd_hwif0->host_flags = IDE_HFLAG_ABUSE_PREFETCH |
766 IDE_HFLAG_ABUSE_FAST_DEVSEL;
767 cmd_hwif0->pio_mask = ATA_PIO5;
768 cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; 776 cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode;
769#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 777#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
770 778
@@ -815,23 +823,14 @@ static int __init cmd640x_init(void)
815 * Initialize data for secondary cmd640 port, if enabled 823 * Initialize data for secondary cmd640 port, if enabled
816 */ 824 */
817 if (second_port_cmd640) { 825 if (second_port_cmd640) {
818 cmd_hwif0->serialized = 1;
819 cmd_hwif1->serialized = 1;
820 cmd_hwif1->chipset = ide_cmd640;
821 cmd_hwif0->mate = cmd_hwif1;
822 cmd_hwif1->mate = cmd_hwif0;
823 cmd_hwif1->channel = 1;
824#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 826#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED
825 cmd_hwif1->host_flags = IDE_HFLAG_ABUSE_PREFETCH |
826 IDE_HFLAG_ABUSE_FAST_DEVSEL;
827 cmd_hwif1->pio_mask = ATA_PIO5;
828 cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; 827 cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode;
829#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 828#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
830 829
831 idx[1] = cmd_hwif1->index; 830 idx[1] = cmd_hwif1->index;
832 } 831 }
833 printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name, 832 printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name,
834 cmd_hwif0->serialized ? "" : "not ", port2); 833 second_port_cmd640 ? "" : "not ", port2);
835 834
836 /* 835 /*
837 * Establish initial timings/prefetch for all drives. 836 * Establish initial timings/prefetch for all drives.
@@ -876,7 +875,7 @@ static int __init cmd640x_init(void)
876 cmd640_dump_regs(); 875 cmd640_dump_regs();
877#endif 876#endif
878 877
879 ide_device_add(idx); 878 ide_device_add(idx, &cmd640_port_info);
880 879
881 return 1; 880 return 1;
882} 881}
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index eb68a9ad0c98..793528666672 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -180,7 +180,7 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
180 180
181 ide_pci_setup_ports(dev, d, 14, &idx[0]); 181 ide_pci_setup_ports(dev, d, 14, &idx[0]);
182 182
183 ide_device_add(idx); 183 ide_device_add(idx, d);
184 184
185 return 0; 185 return 0;
186} 186}
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 85902074b1fc..651845bf1ae5 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -555,7 +555,6 @@ static void __devinit
555ide_init_sgiioc4(ide_hwif_t * hwif) 555ide_init_sgiioc4(ide_hwif_t * hwif)
556{ 556{
557 hwif->mmio = 1; 557 hwif->mmio = 1;
558 hwif->pio_mask = 0x00;
559 hwif->set_pio_mode = NULL; /* Sets timing for PIO mode */ 558 hwif->set_pio_mode = NULL; /* Sets timing for PIO mode */
560 hwif->set_dma_mode = &sgiioc4_set_dma_mode; 559 hwif->set_dma_mode = &sgiioc4_set_dma_mode;
561 hwif->selectproc = NULL;/* Use the default routine to select drive */ 560 hwif->selectproc = NULL;/* Use the default routine to select drive */
@@ -572,8 +571,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
572 if (hwif->dma_base == 0) 571 if (hwif->dma_base == 0)
573 return; 572 return;
574 573
575 hwif->mwdma_mask = ATA_MWDMA2_ONLY;
576
577 hwif->dma_host_set = &sgiioc4_dma_host_set; 574 hwif->dma_host_set = &sgiioc4_dma_host_set;
578 hwif->dma_setup = &sgiioc4_ide_dma_setup; 575 hwif->dma_setup = &sgiioc4_ide_dma_setup;
579 hwif->dma_start = &sgiioc4_ide_dma_start; 576 hwif->dma_start = &sgiioc4_ide_dma_start;
@@ -583,6 +580,13 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
583 hwif->dma_timeout = &ide_dma_timeout; 580 hwif->dma_timeout = &ide_dma_timeout;
584} 581}
585 582
583static const struct ide_port_info sgiioc4_port_info __devinitdata = {
584 .chipset = ide_pci,
585 .host_flags = IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
586 IDE_HFLAG_NO_AUTOTUNE,
587 .mwdma_mask = ATA_MWDMA2_ONLY,
588};
589
586static int __devinit 590static int __devinit
587sgiioc4_ide_setup_pci_device(struct pci_dev *dev) 591sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
588{ 592{
@@ -593,6 +597,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
593 int h; 597 int h;
594 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 598 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
595 hw_regs_t hw; 599 hw_regs_t hw;
600 struct ide_port_info d = sgiioc4_port_info;
596 601
597 /* 602 /*
598 * Find an empty HWIF; if none available, return -ENOMEM. 603 * Find an empty HWIF; if none available, return -ENOMEM.
@@ -641,7 +646,6 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
641 ide_init_port_hw(hwif, &hw); 646 ide_init_port_hw(hwif, &hw);
642 647
643 hwif->dev = &dev->dev; 648 hwif->dev = &dev->dev;
644 hwif->channel = 0; /* Single Channel chip */
645 649
646 /* The IOC4 uses MMIO rather than Port IO. */ 650 /* The IOC4 uses MMIO rather than Port IO. */
647 default_hwif_mmiops(hwif); 651 default_hwif_mmiops(hwif);
@@ -649,15 +653,17 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
649 /* Initializing chipset IRQ Registers */ 653 /* Initializing chipset IRQ Registers */
650 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); 654 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
651 655
652 if (dma_base == 0 || ide_dma_sgiioc4(hwif, dma_base)) 656 if (dma_base == 0 || ide_dma_sgiioc4(hwif, dma_base)) {
653 printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n", 657 printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n",
654 hwif->name, DRV_NAME); 658 hwif->name, DRV_NAME);
659 d.mwdma_mask = 0;
660 }
655 661
656 ide_init_sgiioc4(hwif); 662 ide_init_sgiioc4(hwif);
657 663
658 idx[0] = hwif->index; 664 idx[0] = hwif->index;
659 665
660 if (ide_device_add(idx)) 666 if (ide_device_add(idx, &d))
661 return -EIO; 667 return -EIO;
662 668
663 return 0; 669 return 0;
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index 45c1d55e60df..06190b1c4ec5 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -848,7 +848,7 @@ static int __init mpc8xx_ide_probe(void)
848#endif 848#endif
849#endif 849#endif
850 850
851 ide_device_add(idx); 851 ide_device_add(idx, NULL);
852 852
853 return 0; 853 return 0;
854} 854}
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 23112ef68f67..12ac3bfb4f9a 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -412,7 +412,7 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time)
412 */ 412 */
413#define IDE_WAKEUP_DELAY (1*HZ) 413#define IDE_WAKEUP_DELAY (1*HZ)
414 414
415static void pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif); 415static int pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif);
416static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); 416static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq);
417static void pmac_ide_selectproc(ide_drive_t *drive); 417static void pmac_ide_selectproc(ide_drive_t *drive);
418static void pmac_ide_kauai_selectproc(ide_drive_t *drive); 418static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
@@ -1003,6 +1003,17 @@ pmac_ide_do_resume(ide_hwif_t *hwif)
1003 return 0; 1003 return 0;
1004} 1004}
1005 1005
1006static const struct ide_port_info pmac_port_info = {
1007 .chipset = ide_pmac,
1008 .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA |
1009 IDE_HFLAG_PIO_NO_DOWNGRADE |
1010 IDE_HFLAG_POST_SET_MODE |
1011 IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
1012 IDE_HFLAG_UNMASK_IRQS,
1013 .pio_mask = ATA_PIO4,
1014 .mwdma_mask = ATA_MWDMA2,
1015};
1016
1006/* 1017/*
1007 * Setup, register & probe an IDE channel driven by this driver, this is 1018 * Setup, register & probe an IDE channel driven by this driver, this is
1008 * called by one of the 2 probe functions (macio or PCI). Note that a channel 1019 * called by one of the 2 probe functions (macio or PCI). Note that a channel
@@ -1016,23 +1027,28 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1016 struct device_node *np = pmif->node; 1027 struct device_node *np = pmif->node;
1017 const int *bidp; 1028 const int *bidp;
1018 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 1029 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
1030 struct ide_port_info d = pmac_port_info;
1019 1031
1020 pmif->cable_80 = 0; 1032 pmif->cable_80 = 0;
1021 pmif->broken_dma = pmif->broken_dma_warn = 0; 1033 pmif->broken_dma = pmif->broken_dma_warn = 0;
1022 if (of_device_is_compatible(np, "shasta-ata")) 1034 if (of_device_is_compatible(np, "shasta-ata")) {
1023 pmif->kind = controller_sh_ata6; 1035 pmif->kind = controller_sh_ata6;
1024 else if (of_device_is_compatible(np, "kauai-ata")) 1036 d.udma_mask = ATA_UDMA6;
1037 } else if (of_device_is_compatible(np, "kauai-ata")) {
1025 pmif->kind = controller_un_ata6; 1038 pmif->kind = controller_un_ata6;
1026 else if (of_device_is_compatible(np, "K2-UATA")) 1039 d.udma_mask = ATA_UDMA5;
1040 } else if (of_device_is_compatible(np, "K2-UATA")) {
1027 pmif->kind = controller_k2_ata6; 1041 pmif->kind = controller_k2_ata6;
1028 else if (of_device_is_compatible(np, "keylargo-ata")) { 1042 d.udma_mask = ATA_UDMA5;
1029 if (strcmp(np->name, "ata-4") == 0) 1043 } else if (of_device_is_compatible(np, "keylargo-ata")) {
1044 if (strcmp(np->name, "ata-4") == 0) {
1030 pmif->kind = controller_kl_ata4; 1045 pmif->kind = controller_kl_ata4;
1031 else 1046 d.udma_mask = ATA_UDMA4;
1047 } else
1032 pmif->kind = controller_kl_ata3; 1048 pmif->kind = controller_kl_ata3;
1033 } else if (of_device_is_compatible(np, "heathrow-ata")) 1049 } else if (of_device_is_compatible(np, "heathrow-ata")) {
1034 pmif->kind = controller_heathrow; 1050 pmif->kind = controller_heathrow;
1035 else { 1051 } else {
1036 pmif->kind = controller_ohare; 1052 pmif->kind = controller_ohare;
1037 pmif->broken_dma = 1; 1053 pmif->broken_dma = 1;
1038 } 1054 }
@@ -1101,19 +1117,10 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1101 /* Tell common code _not_ to mess with resources */ 1117 /* Tell common code _not_ to mess with resources */
1102 hwif->mmio = 1; 1118 hwif->mmio = 1;
1103 hwif->hwif_data = pmif; 1119 hwif->hwif_data = pmif;
1104 hw->chipset = ide_pmac;
1105 ide_init_port_hw(hwif, hw); 1120 ide_init_port_hw(hwif, hw);
1106 hwif->noprobe = pmif->mediabay; 1121 hwif->noprobe = pmif->mediabay;
1107 hwif->hold = pmif->mediabay; 1122 hwif->hold = pmif->mediabay;
1108 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 1123 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
1109 hwif->drives[0].unmask = 1;
1110 hwif->drives[1].unmask = 1;
1111 hwif->drives[0].autotune = IDE_TUNE_AUTO;
1112 hwif->drives[1].autotune = IDE_TUNE_AUTO;
1113 hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA |
1114 IDE_HFLAG_PIO_NO_DOWNGRADE |
1115 IDE_HFLAG_POST_SET_MODE;
1116 hwif->pio_mask = ATA_PIO4;
1117 hwif->set_pio_mode = pmac_ide_set_pio_mode; 1124 hwif->set_pio_mode = pmac_ide_set_pio_mode;
1118 if (pmif->kind == controller_un_ata6 1125 if (pmif->kind == controller_un_ata6
1119 || pmif->kind == controller_k2_ata6 1126 || pmif->kind == controller_k2_ata6
@@ -1133,14 +1140,16 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw)
1133#endif /* CONFIG_PMAC_MEDIABAY */ 1140#endif /* CONFIG_PMAC_MEDIABAY */
1134 1141
1135#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC 1142#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC
1143 if (pmif->cable_80 == 0)
1144 d.udma_mask &= ATA_UDMA2;
1136 /* has a DBDMA controller channel */ 1145 /* has a DBDMA controller channel */
1137 if (pmif->dma_regs) 1146 if (pmif->dma_regs == 0 || pmac_ide_setup_dma(pmif, hwif) < 0)
1138 pmac_ide_setup_dma(pmif, hwif); 1147#endif
1139#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 1148 d.udma_mask = d.mwdma_mask = 0;
1140 1149
1141 idx[0] = hwif->index; 1150 idx[0] = hwif->index;
1142 1151
1143 ide_device_add(idx); 1152 ide_device_add(idx, &d);
1144 1153
1145 return 0; 1154 return 0;
1146} 1155}
@@ -1721,8 +1730,7 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive)
1721 * Allocate the data structures needed for using DMA with an interface 1730 * Allocate the data structures needed for using DMA with an interface
1722 * and fill the proper list of functions pointers 1731 * and fill the proper list of functions pointers
1723 */ 1732 */
1724static void __devinit 1733static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1725pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1726{ 1734{
1727 struct pci_dev *dev = to_pci_dev(hwif->dev); 1735 struct pci_dev *dev = to_pci_dev(hwif->dev);
1728 1736
@@ -1730,7 +1738,7 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1730 * DMA routines ... 1738 * DMA routines ...
1731 */ 1739 */
1732 if (dev == NULL) 1740 if (dev == NULL)
1733 return; 1741 return -ENODEV;
1734 /* 1742 /*
1735 * Allocate space for the DBDMA commands. 1743 * Allocate space for the DBDMA commands.
1736 * The +2 is +1 for the stop command and +1 to allow for 1744 * The +2 is +1 for the stop command and +1 to allow for
@@ -1743,7 +1751,7 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1743 if (pmif->dma_table_cpu == NULL) { 1751 if (pmif->dma_table_cpu == NULL) {
1744 printk(KERN_ERR "%s: unable to allocate DMA command list\n", 1752 printk(KERN_ERR "%s: unable to allocate DMA command list\n",
1745 hwif->name); 1753 hwif->name);
1746 return; 1754 return -ENOMEM;
1747 } 1755 }
1748 1756
1749 hwif->sg_max_nents = MAX_DCMDS; 1757 hwif->sg_max_nents = MAX_DCMDS;
@@ -1757,29 +1765,7 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1757 hwif->dma_timeout = &ide_dma_timeout; 1765 hwif->dma_timeout = &ide_dma_timeout;
1758 hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; 1766 hwif->dma_lost_irq = &pmac_ide_dma_lost_irq;
1759 1767
1760 switch(pmif->kind) { 1768 return 0;
1761 case controller_sh_ata6:
1762 hwif->ultra_mask = pmif->cable_80 ? 0x7f : 0x07;
1763 hwif->mwdma_mask = 0x07;
1764 hwif->swdma_mask = 0x00;
1765 break;
1766 case controller_un_ata6:
1767 case controller_k2_ata6:
1768 hwif->ultra_mask = pmif->cable_80 ? 0x3f : 0x07;
1769 hwif->mwdma_mask = 0x07;
1770 hwif->swdma_mask = 0x00;
1771 break;
1772 case controller_kl_ata4:
1773 hwif->ultra_mask = pmif->cable_80 ? 0x1f : 0x07;
1774 hwif->mwdma_mask = 0x07;
1775 hwif->swdma_mask = 0x00;
1776 break;
1777 default:
1778 hwif->ultra_mask = 0x00;
1779 hwif->mwdma_mask = 0x07;
1780 hwif->swdma_mask = 0x00;
1781 break;
1782 }
1783} 1769}
1784 1770
1785#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 1771#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 53d9979edc72..634e3f6a9608 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -401,20 +401,20 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
401 return hwif; 401 return hwif;
402} 402}
403 403
404#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
404/** 405/**
405 * ide_hwif_setup_dma - configure DMA interface 406 * ide_hwif_setup_dma - configure DMA interface
406 * @dev: PCI device
407 * @d: IDE port info
408 * @hwif: IDE interface 407 * @hwif: IDE interface
408 * @d: IDE port info
409 * 409 *
410 * Set up the DMA base for the interface. Enable the master bits as 410 * Set up the DMA base for the interface. Enable the master bits as
411 * necessary and attempt to bring the device DMA into a ready to use 411 * necessary and attempt to bring the device DMA into a ready to use
412 * state 412 * state
413 */ 413 */
414 414
415static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *hwif) 415void ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
416{ 416{
417#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 417 struct pci_dev *dev = to_pci_dev(hwif->dev);
418 u16 pcicmd; 418 u16 pcicmd;
419 419
420 pci_read_config_word(dev, PCI_COMMAND, &pcicmd); 420 pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
@@ -446,8 +446,8 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info *
446 "(BIOS)\n", hwif->name, d->name); 446 "(BIOS)\n", hwif->name, d->name);
447 } 447 }
448 } 448 }
449#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/
450} 449}
450#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
451 451
452/** 452/**
453 * ide_setup_pci_controller - set up IDE PCI 453 * ide_setup_pci_controller - set up IDE PCI
@@ -509,7 +509,7 @@ out:
509void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx) 509void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx)
510{ 510{
511 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; 511 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
512 ide_hwif_t *hwif, *mate = NULL; 512 ide_hwif_t *hwif;
513 u8 tmp; 513 u8 tmp;
514 514
515 /* 515 /*
@@ -531,71 +531,6 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int
531 531
532 *(idx + port) = hwif->index; 532 *(idx + port) = hwif->index;
533 } 533 }
534
535 for (port = 0; port < channels; ++port) {
536 if (*(idx + port) == 0xff)
537 continue;
538
539 hwif = &ide_hwifs[*(idx + port)];
540
541 if (mate) {
542 hwif->mate = mate;
543 mate->mate = hwif;
544 }
545
546 hwif->channel = port;
547
548 if (d->init_iops)
549 d->init_iops(hwif);
550
551 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
552 ide_hwif_setup_dma(dev, d, hwif);
553
554 if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
555 (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS))
556 hwif->irq = port ? 15 : 14;
557
558 hwif->host_flags = d->host_flags;
559 hwif->pio_mask = d->pio_mask;
560
561 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
562 hwif->mate->serialized = hwif->serialized = 1;
563
564 if (d->host_flags & IDE_HFLAG_IO_32BIT) {
565 hwif->drives[0].io_32bit = 1;
566 hwif->drives[1].io_32bit = 1;
567 }
568
569 if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) {
570 hwif->drives[0].unmask = 1;
571 hwif->drives[1].unmask = 1;
572 }
573
574 hwif->swdma_mask = d->swdma_mask;
575 hwif->mwdma_mask = d->mwdma_mask;
576 hwif->ultra_mask = d->udma_mask;
577
578 if ((d->host_flags && IDE_HFLAG_NO_DMA) == 0 &&
579 hwif->dma_base == 0) {
580 hwif->swdma_mask = 0;
581 hwif->mwdma_mask = 0;
582 hwif->ultra_mask = 0;
583 }
584
585 hwif->drives[0].autotune = 1;
586 hwif->drives[1].autotune = 1;
587
588 if (d->host_flags & IDE_HFLAG_RQSIZE_256)
589 hwif->rqsize = 256;
590
591 if (d->init_hwif)
592 /* Call chipset-specific routine
593 * for each enabled hwif
594 */
595 d->init_hwif(hwif);
596
597 mate = hwif;
598 }
599} 534}
600 535
601EXPORT_SYMBOL_GPL(ide_pci_setup_ports); 536EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
@@ -676,7 +611,7 @@ int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
676 ret = do_ide_setup_pci_device(dev, d, &idx[0], 1); 611 ret = do_ide_setup_pci_device(dev, d, &idx[0], 1);
677 612
678 if (ret >= 0) 613 if (ret >= 0)
679 ide_device_add(idx); 614 ide_device_add(idx, d);
680 615
681 return ret; 616 return ret;
682} 617}
@@ -700,7 +635,7 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
700 goto out; 635 goto out;
701 } 636 }
702 637
703 ide_device_add(idx); 638 ide_device_add(idx, d);
704out: 639out:
705 return ret; 640 return ret;
706} 641}