aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-01-06 11:21:02 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:21:02 -0500
commit592b5315219881c6c0af4785f96456ad2043193a (patch)
tree2b330d7b4880c10013a9e3e86b5cf18160aed785
parent3f023b0138b7db21bac0074b3d5ca2854372c6ff (diff)
ide: move read_sff_dma_status() method to 'struct ide_dma_ops'
Move apparently misplaced read_sff_dma_status() method from 'struct ide_tp_ops' to 'struct ide_dma_ops', renaming it to dma_sff_read_status() and making only required for SFF-8038i compatible IDE controller drivers (greatly cutting down the number of initializers) as its only user (outside ide-dma-sff.c and such drivers) appears to be ide_pci_check_simplex() which is only called for such controllers... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/alim15x3.c1
-rw-r--r--drivers/ide/au1xxx-ide.c1
-rw-r--r--drivers/ide/cmd64x.c3
-rw-r--r--drivers/ide/falconide.c1
-rw-r--r--drivers/ide/hpt366.c3
-rw-r--r--drivers/ide/ide-dma-sff.c22
-rw-r--r--drivers/ide/ide-h8300.c1
-rw-r--r--drivers/ide/ide-iops.c10
-rw-r--r--drivers/ide/ide-probe.c7
-rw-r--r--drivers/ide/it821x.c1
-rw-r--r--drivers/ide/ns87415.c8
-rw-r--r--drivers/ide/pdc202xx_old.c2
-rw-r--r--drivers/ide/pmac.c1
-rw-r--r--drivers/ide/q40ide.c1
-rw-r--r--drivers/ide/sc1200.c1
-rw-r--r--drivers/ide/scc_pata.c4
-rw-r--r--drivers/ide/setup-pci.c7
-rw-r--r--drivers/ide/sgiioc4.c1
-rw-r--r--drivers/ide/siimage.c1
-rw-r--r--drivers/ide/sl82c105.c1
-rw-r--r--drivers/ide/tc86c001.c1
-rw-r--r--drivers/ide/tx4939ide.c21
-rw-r--r--include/linux/ide.h8
23 files changed, 65 insertions, 42 deletions
diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c
index f1c817240501..66f43083408b 100644
--- a/drivers/ide/alim15x3.c
+++ b/drivers/ide/alim15x3.c
@@ -509,6 +509,7 @@ static const struct ide_dma_ops ali_dma_ops = {
509 .dma_test_irq = ide_dma_test_irq, 509 .dma_test_irq = ide_dma_test_irq,
510 .dma_lost_irq = ide_dma_lost_irq, 510 .dma_lost_irq = ide_dma_lost_irq,
511 .dma_timeout = ide_dma_timeout, 511 .dma_timeout = ide_dma_timeout,
512 .dma_sff_read_status = ide_dma_sff_read_status,
512}; 513};
513 514
514static const struct ide_port_info ali15x3_chipset __devinitdata = { 515static const struct ide_port_info ali15x3_chipset __devinitdata = {
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c
index 11f2c8f3db48..79a2dfed8eb7 100644
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -502,7 +502,6 @@ static const struct ide_tp_ops au1xxx_tp_ops = {
502 .exec_command = ide_exec_command, 502 .exec_command = ide_exec_command,
503 .read_status = ide_read_status, 503 .read_status = ide_read_status,
504 .read_altstatus = ide_read_altstatus, 504 .read_altstatus = ide_read_altstatus,
505 .read_sff_dma_status = ide_read_sff_dma_status,
506 505
507 .set_irq = ide_set_irq, 506 .set_irq = ide_set_irq,
508 507
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c
index 265cf9268c63..2f9688d87ecd 100644
--- a/drivers/ide/cmd64x.c
+++ b/drivers/ide/cmd64x.c
@@ -385,6 +385,7 @@ static const struct ide_dma_ops cmd64x_dma_ops = {
385 .dma_test_irq = cmd64x_dma_test_irq, 385 .dma_test_irq = cmd64x_dma_test_irq,
386 .dma_lost_irq = ide_dma_lost_irq, 386 .dma_lost_irq = ide_dma_lost_irq,
387 .dma_timeout = ide_dma_timeout, 387 .dma_timeout = ide_dma_timeout,
388 .dma_sff_read_status = ide_dma_sff_read_status,
388}; 389};
389 390
390static const struct ide_dma_ops cmd646_rev1_dma_ops = { 391static const struct ide_dma_ops cmd646_rev1_dma_ops = {
@@ -396,6 +397,7 @@ static const struct ide_dma_ops cmd646_rev1_dma_ops = {
396 .dma_test_irq = ide_dma_test_irq, 397 .dma_test_irq = ide_dma_test_irq,
397 .dma_lost_irq = ide_dma_lost_irq, 398 .dma_lost_irq = ide_dma_lost_irq,
398 .dma_timeout = ide_dma_timeout, 399 .dma_timeout = ide_dma_timeout,
400 .dma_sff_read_status = ide_dma_sff_read_status,
399}; 401};
400 402
401static const struct ide_dma_ops cmd648_dma_ops = { 403static const struct ide_dma_ops cmd648_dma_ops = {
@@ -407,6 +409,7 @@ static const struct ide_dma_ops cmd648_dma_ops = {
407 .dma_test_irq = cmd648_dma_test_irq, 409 .dma_test_irq = cmd648_dma_test_irq,
408 .dma_lost_irq = ide_dma_lost_irq, 410 .dma_lost_irq = ide_dma_lost_irq,
409 .dma_timeout = ide_dma_timeout, 411 .dma_timeout = ide_dma_timeout,
412 .dma_sff_read_status = ide_dma_sff_read_status,
410}; 413};
411 414
412static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { 415static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
index 39d500d84b07..a5ba820d69bb 100644
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -70,7 +70,6 @@ static const struct ide_tp_ops falconide_tp_ops = {
70 .exec_command = ide_exec_command, 70 .exec_command = ide_exec_command,
71 .read_status = ide_read_status, 71 .read_status = ide_read_status,
72 .read_altstatus = ide_read_altstatus, 72 .read_altstatus = ide_read_altstatus,
73 .read_sff_dma_status = ide_read_sff_dma_status,
74 73
75 .set_irq = ide_set_irq, 74 .set_irq = ide_set_irq,
76 75
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c
index 208614f4dc3c..3eb9b5c63a0f 100644
--- a/drivers/ide/hpt366.c
+++ b/drivers/ide/hpt366.c
@@ -1424,6 +1424,7 @@ static const struct ide_dma_ops hpt37x_dma_ops = {
1424 .dma_test_irq = hpt374_dma_test_irq, 1424 .dma_test_irq = hpt374_dma_test_irq,
1425 .dma_lost_irq = ide_dma_lost_irq, 1425 .dma_lost_irq = ide_dma_lost_irq,
1426 .dma_timeout = ide_dma_timeout, 1426 .dma_timeout = ide_dma_timeout,
1427 .dma_sff_read_status = ide_dma_sff_read_status,
1427}; 1428};
1428 1429
1429static const struct ide_dma_ops hpt370_dma_ops = { 1430static const struct ide_dma_ops hpt370_dma_ops = {
@@ -1435,6 +1436,7 @@ static const struct ide_dma_ops hpt370_dma_ops = {
1435 .dma_test_irq = ide_dma_test_irq, 1436 .dma_test_irq = ide_dma_test_irq,
1436 .dma_lost_irq = ide_dma_lost_irq, 1437 .dma_lost_irq = ide_dma_lost_irq,
1437 .dma_timeout = hpt370_dma_timeout, 1438 .dma_timeout = hpt370_dma_timeout,
1439 .dma_sff_read_status = ide_dma_sff_read_status,
1438}; 1440};
1439 1441
1440static const struct ide_dma_ops hpt36x_dma_ops = { 1442static const struct ide_dma_ops hpt36x_dma_ops = {
@@ -1446,6 +1448,7 @@ static const struct ide_dma_ops hpt36x_dma_ops = {
1446 .dma_test_irq = ide_dma_test_irq, 1448 .dma_test_irq = ide_dma_test_irq,
1447 .dma_lost_irq = hpt366_dma_lost_irq, 1449 .dma_lost_irq = hpt366_dma_lost_irq,
1448 .dma_timeout = ide_dma_timeout, 1450 .dma_timeout = ide_dma_timeout,
1451 .dma_sff_read_status = ide_dma_sff_read_status,
1449}; 1452};
1450 1453
1451static const struct ide_port_info hpt366_chipsets[] __devinitdata = { 1454static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c
index 623a82d1535d..bcdadc777564 100644
--- a/drivers/ide/ide-dma-sff.c
+++ b/drivers/ide/ide-dma-sff.c
@@ -50,6 +50,17 @@ int config_drive_for_dma(ide_drive_t *drive)
50 return 0; 50 return 0;
51} 51}
52 52
53u8 ide_dma_sff_read_status(ide_hwif_t *hwif)
54{
55 unsigned long addr = hwif->dma_base + ATA_DMA_STATUS;
56
57 if (hwif->host_flags & IDE_HFLAG_MMIO)
58 return readb((void __iomem *)addr);
59 else
60 return inb(addr);
61}
62EXPORT_SYMBOL_GPL(ide_dma_sff_read_status);
63
53/** 64/**
54 * ide_dma_host_set - Enable/disable DMA on a host 65 * ide_dma_host_set - Enable/disable DMA on a host
55 * @drive: drive to control 66 * @drive: drive to control
@@ -62,7 +73,7 @@ void ide_dma_host_set(ide_drive_t *drive, int on)
62{ 73{
63 ide_hwif_t *hwif = drive->hwif; 74 ide_hwif_t *hwif = drive->hwif;
64 u8 unit = drive->dn & 1; 75 u8 unit = drive->dn & 1;
65 u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 76 u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
66 77
67 if (on) 78 if (on)
68 dma_stat |= (1 << (5 + unit)); 79 dma_stat |= (1 << (5 + unit));
@@ -200,7 +211,7 @@ int ide_dma_setup(ide_drive_t *drive)
200 outb(reading, hwif->dma_base + ATA_DMA_CMD); 211 outb(reading, hwif->dma_base + ATA_DMA_CMD);
201 212
202 /* read DMA status for INTR & ERROR flags */ 213 /* read DMA status for INTR & ERROR flags */
203 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 214 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
204 215
205 /* clear INTR & ERROR flags */ 216 /* clear INTR & ERROR flags */
206 if (mmio) 217 if (mmio)
@@ -232,7 +243,7 @@ EXPORT_SYMBOL_GPL(ide_dma_setup);
232static int dma_timer_expiry(ide_drive_t *drive) 243static int dma_timer_expiry(ide_drive_t *drive)
233{ 244{
234 ide_hwif_t *hwif = drive->hwif; 245 ide_hwif_t *hwif = drive->hwif;
235 u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 246 u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
236 247
237 printk(KERN_WARNING "%s: %s: DMA status (0x%02x)\n", 248 printk(KERN_WARNING "%s: %s: DMA status (0x%02x)\n",
238 drive->name, __func__, dma_stat); 249 drive->name, __func__, dma_stat);
@@ -305,7 +316,7 @@ int ide_dma_end(ide_drive_t *drive)
305 } 316 }
306 317
307 /* get DMA status */ 318 /* get DMA status */
308 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 319 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
309 320
310 if (mmio) 321 if (mmio)
311 /* clear the INTR & ERROR bits */ 322 /* clear the INTR & ERROR bits */
@@ -331,7 +342,7 @@ EXPORT_SYMBOL_GPL(ide_dma_end);
331int ide_dma_test_irq(ide_drive_t *drive) 342int ide_dma_test_irq(ide_drive_t *drive)
332{ 343{
333 ide_hwif_t *hwif = drive->hwif; 344 ide_hwif_t *hwif = drive->hwif;
334 u8 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 345 u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
335 346
336 return (dma_stat & ATA_DMA_INTR) ? 1 : 0; 347 return (dma_stat & ATA_DMA_INTR) ? 1 : 0;
337} 348}
@@ -346,5 +357,6 @@ const struct ide_dma_ops sff_dma_ops = {
346 .dma_test_irq = ide_dma_test_irq, 357 .dma_test_irq = ide_dma_test_irq,
347 .dma_timeout = ide_dma_timeout, 358 .dma_timeout = ide_dma_timeout,
348 .dma_lost_irq = ide_dma_lost_irq, 359 .dma_lost_irq = ide_dma_lost_irq,
360 .dma_sff_read_status = ide_dma_sff_read_status,
349}; 361};
350EXPORT_SYMBOL_GPL(sff_dma_ops); 362EXPORT_SYMBOL_GPL(sff_dma_ops);
diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c
index e2cdd2e9cdec..9270d3255ee0 100644
--- a/drivers/ide/ide-h8300.c
+++ b/drivers/ide/ide-h8300.c
@@ -159,7 +159,6 @@ static const struct ide_tp_ops h8300_tp_ops = {
159 .exec_command = ide_exec_command, 159 .exec_command = ide_exec_command,
160 .read_status = ide_read_status, 160 .read_status = ide_read_status,
161 .read_altstatus = ide_read_altstatus, 161 .read_altstatus = ide_read_altstatus,
162 .read_sff_dma_status = ide_read_sff_dma_status,
163 162
164 .set_irq = ide_set_irq, 163 .set_irq = ide_set_irq,
165 164
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 1a22c31ce7ac..e728cfe7273f 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -105,15 +105,6 @@ u8 ide_read_altstatus(ide_hwif_t *hwif)
105} 105}
106EXPORT_SYMBOL_GPL(ide_read_altstatus); 106EXPORT_SYMBOL_GPL(ide_read_altstatus);
107 107
108u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
109{
110 if (hwif->host_flags & IDE_HFLAG_MMIO)
111 return readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
112 else
113 return inb(hwif->dma_base + ATA_DMA_STATUS);
114}
115EXPORT_SYMBOL_GPL(ide_read_sff_dma_status);
116
117void ide_set_irq(ide_hwif_t *hwif, int on) 108void ide_set_irq(ide_hwif_t *hwif, int on)
118{ 109{
119 u8 ctl = ATA_DEVCTL_OBS; 110 u8 ctl = ATA_DEVCTL_OBS;
@@ -388,7 +379,6 @@ const struct ide_tp_ops default_tp_ops = {
388 .exec_command = ide_exec_command, 379 .exec_command = ide_exec_command,
389 .read_status = ide_read_status, 380 .read_status = ide_read_status,
390 .read_altstatus = ide_read_altstatus, 381 .read_altstatus = ide_read_altstatus,
391 .read_sff_dma_status = ide_read_sff_dma_status,
392 382
393 .set_irq = ide_set_irq, 383 .set_irq = ide_set_irq,
394 384
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index ebb1b7f863f4..0ccbb4459fb9 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1229,6 +1229,8 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1229 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) { 1229 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) {
1230 int rc; 1230 int rc;
1231 1231
1232 hwif->dma_ops = d->dma_ops;
1233
1232 if (d->init_dma) 1234 if (d->init_dma)
1233 rc = d->init_dma(hwif, d); 1235 rc = d->init_dma(hwif, d);
1234 else 1236 else
@@ -1236,12 +1238,13 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1236 1238
1237 if (rc < 0) { 1239 if (rc < 0) {
1238 printk(KERN_INFO "%s: DMA disabled\n", hwif->name); 1240 printk(KERN_INFO "%s: DMA disabled\n", hwif->name);
1241
1242 hwif->dma_ops = NULL;
1239 hwif->dma_base = 0; 1243 hwif->dma_base = 0;
1240 hwif->swdma_mask = 0; 1244 hwif->swdma_mask = 0;
1241 hwif->mwdma_mask = 0; 1245 hwif->mwdma_mask = 0;
1242 hwif->ultra_mask = 0; 1246 hwif->ultra_mask = 0;
1243 } else if (d->dma_ops) 1247 }
1244 hwif->dma_ops = d->dma_ops;
1245 } 1248 }
1246 1249
1247 if ((d->host_flags & IDE_HFLAG_SERIALIZE) || 1250 if ((d->host_flags & IDE_HFLAG_SERIALIZE) ||
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c
index 879056645352..0be27ac1f077 100644
--- a/drivers/ide/it821x.c
+++ b/drivers/ide/it821x.c
@@ -512,6 +512,7 @@ static struct ide_dma_ops it821x_pass_through_dma_ops = {
512 .dma_test_irq = ide_dma_test_irq, 512 .dma_test_irq = ide_dma_test_irq,
513 .dma_timeout = ide_dma_timeout, 513 .dma_timeout = ide_dma_timeout,
514 .dma_lost_irq = ide_dma_lost_irq, 514 .dma_lost_irq = ide_dma_lost_irq,
515 .dma_sff_read_status = ide_dma_sff_read_status,
515}; 516};
516 517
517/** 518/**
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c
index aceb2fcbe1d1..83643ed9a426 100644
--- a/drivers/ide/ns87415.c
+++ b/drivers/ide/ns87415.c
@@ -56,7 +56,7 @@ static u8 superio_read_status(ide_hwif_t *hwif)
56 return superio_ide_inb(hwif->io_ports.status_addr); 56 return superio_ide_inb(hwif->io_ports.status_addr);
57} 57}
58 58
59static u8 superio_read_sff_dma_status(ide_hwif_t *hwif) 59static u8 superio_dma_sff_read_status(ide_hwif_t *hwif)
60{ 60{
61 return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); 61 return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
62} 62}
@@ -109,7 +109,6 @@ static const struct ide_tp_ops superio_tp_ops = {
109 .exec_command = ide_exec_command, 109 .exec_command = ide_exec_command,
110 .read_status = superio_read_status, 110 .read_status = superio_read_status,
111 .read_altstatus = ide_read_altstatus, 111 .read_altstatus = ide_read_altstatus,
112 .read_sff_dma_status = superio_read_sff_dma_status,
113 112
114 .set_irq = ide_set_irq, 113 .set_irq = ide_set_irq,
115 114
@@ -132,6 +131,8 @@ static void __devinit superio_init_iops(struct hwif_s *hwif)
132 tmp = superio_ide_inb(dma_stat); 131 tmp = superio_ide_inb(dma_stat);
133 outb(tmp | 0x66, dma_stat); 132 outb(tmp | 0x66, dma_stat);
134} 133}
134#else
135#define superio_dma_sff_read_status ide_dma_sff_read_status
135#endif 136#endif
136 137
137static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 }; 138static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 };
@@ -201,7 +202,7 @@ static int ns87415_dma_end(ide_drive_t *drive)
201 u8 dma_stat = 0, dma_cmd = 0; 202 u8 dma_stat = 0, dma_cmd = 0;
202 203
203 drive->waiting_for_dma = 0; 204 drive->waiting_for_dma = 0;
204 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 205 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
205 /* get DMA command mode */ 206 /* get DMA command mode */
206 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); 207 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
207 /* stop DMA */ 208 /* stop DMA */
@@ -308,6 +309,7 @@ static const struct ide_dma_ops ns87415_dma_ops = {
308 .dma_test_irq = ide_dma_test_irq, 309 .dma_test_irq = ide_dma_test_irq,
309 .dma_lost_irq = ide_dma_lost_irq, 310 .dma_lost_irq = ide_dma_lost_irq,
310 .dma_timeout = ide_dma_timeout, 311 .dma_timeout = ide_dma_timeout,
312 .dma_sff_read_status = superio_dma_sff_read_status,
311}; 313};
312 314
313static const struct ide_port_info ns87415_chipset __devinitdata = { 315static const struct ide_port_info ns87415_chipset __devinitdata = {
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c
index e8e6b29d9e41..97193323aebf 100644
--- a/drivers/ide/pdc202xx_old.c
+++ b/drivers/ide/pdc202xx_old.c
@@ -337,6 +337,7 @@ static const struct ide_dma_ops pdc20246_dma_ops = {
337 .dma_test_irq = pdc202xx_dma_test_irq, 337 .dma_test_irq = pdc202xx_dma_test_irq,
338 .dma_lost_irq = pdc202xx_dma_lost_irq, 338 .dma_lost_irq = pdc202xx_dma_lost_irq,
339 .dma_timeout = pdc202xx_dma_timeout, 339 .dma_timeout = pdc202xx_dma_timeout,
340 .dma_sff_read_status = ide_dma_sff_read_status,
340}; 341};
341 342
342static const struct ide_dma_ops pdc2026x_dma_ops = { 343static const struct ide_dma_ops pdc2026x_dma_ops = {
@@ -348,6 +349,7 @@ static const struct ide_dma_ops pdc2026x_dma_ops = {
348 .dma_test_irq = pdc202xx_dma_test_irq, 349 .dma_test_irq = pdc202xx_dma_test_irq,
349 .dma_lost_irq = pdc202xx_dma_lost_irq, 350 .dma_lost_irq = pdc202xx_dma_lost_irq,
350 .dma_timeout = pdc202xx_dma_timeout, 351 .dma_timeout = pdc202xx_dma_timeout,
352 .dma_sff_read_status = ide_dma_sff_read_status,
351}; 353};
352 354
353#define DECLARE_PDC2026X_DEV(udma, sectors) \ 355#define DECLARE_PDC2026X_DEV(udma, sectors) \
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index ee52a21af1be..74625e821a43 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -955,7 +955,6 @@ static const struct ide_tp_ops pmac_tp_ops = {
955 .exec_command = pmac_exec_command, 955 .exec_command = pmac_exec_command,
956 .read_status = ide_read_status, 956 .read_status = ide_read_status,
957 .read_altstatus = ide_read_altstatus, 957 .read_altstatus = ide_read_altstatus,
958 .read_sff_dma_status = ide_read_sff_dma_status,
959 958
960 .set_irq = pmac_set_irq, 959 .set_irq = pmac_set_irq,
961 960
diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c
index 4af4a8ce4cdf..9f9c0b3cc3a3 100644
--- a/drivers/ide/q40ide.c
+++ b/drivers/ide/q40ide.c
@@ -99,7 +99,6 @@ static const struct ide_tp_ops q40ide_tp_ops = {
99 .exec_command = ide_exec_command, 99 .exec_command = ide_exec_command,
100 .read_status = ide_read_status, 100 .read_status = ide_read_status,
101 .read_altstatus = ide_read_altstatus, 101 .read_altstatus = ide_read_altstatus,
102 .read_sff_dma_status = ide_read_sff_dma_status,
103 102
104 .set_irq = ide_set_irq, 103 .set_irq = ide_set_irq,
105 104
diff --git a/drivers/ide/sc1200.c b/drivers/ide/sc1200.c
index 1cf477aaae36..dbdd2985a0d8 100644
--- a/drivers/ide/sc1200.c
+++ b/drivers/ide/sc1200.c
@@ -292,6 +292,7 @@ static const struct ide_dma_ops sc1200_dma_ops = {
292 .dma_test_irq = ide_dma_test_irq, 292 .dma_test_irq = ide_dma_test_irq,
293 .dma_lost_irq = ide_dma_lost_irq, 293 .dma_lost_irq = ide_dma_lost_irq,
294 .dma_timeout = ide_dma_timeout, 294 .dma_timeout = ide_dma_timeout,
295 .dma_sff_read_status = ide_dma_sff_read_status,
295}; 296};
296 297
297static const struct ide_port_info sc1200_chipset __devinitdata = { 298static const struct ide_port_info sc1200_chipset __devinitdata = {
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 5d53850c79d7..1cb43068455a 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -143,7 +143,7 @@ static u8 scc_read_altstatus(ide_hwif_t *hwif)
143 return (u8)in_be32((void *)hwif->io_ports.ctl_addr); 143 return (u8)in_be32((void *)hwif->io_ports.ctl_addr);
144} 144}
145 145
146static u8 scc_read_sff_dma_status(ide_hwif_t *hwif) 146static u8 scc_dma_sff_read_status(ide_hwif_t *hwif)
147{ 147{
148 return (u8)in_be32((void *)(hwif->dma_base + 4)); 148 return (u8)in_be32((void *)(hwif->dma_base + 4));
149} 149}
@@ -853,7 +853,6 @@ static const struct ide_tp_ops scc_tp_ops = {
853 .exec_command = scc_exec_command, 853 .exec_command = scc_exec_command,
854 .read_status = scc_read_status, 854 .read_status = scc_read_status,
855 .read_altstatus = scc_read_altstatus, 855 .read_altstatus = scc_read_altstatus,
856 .read_sff_dma_status = scc_read_sff_dma_status,
857 856
858 .set_irq = scc_set_irq, 857 .set_irq = scc_set_irq,
859 858
@@ -880,6 +879,7 @@ static const struct ide_dma_ops scc_dma_ops = {
880 .dma_test_irq = scc_dma_test_irq, 879 .dma_test_irq = scc_dma_test_irq,
881 .dma_lost_irq = ide_dma_lost_irq, 880 .dma_lost_irq = ide_dma_lost_irq,
882 .dma_timeout = ide_dma_timeout, 881 .dma_timeout = ide_dma_timeout,
882 .dma_sff_read_status = scc_dma_sff_read_status,
883}; 883};
884 884
885#define DECLARE_SCC_DEV(name_str) \ 885#define DECLARE_SCC_DEV(name_str) \
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index bc37dff8c675..e85d1ed29c2a 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -130,7 +130,7 @@ int ide_pci_check_simplex(ide_hwif_t *hwif, const struct ide_port_info *d)
130 * we tune the drive then try to grab DMA ownership if we want to be 130 * we tune the drive then try to grab DMA ownership if we want to be
131 * the DMA end. This has to be become dynamic to handle hot-plug. 131 * the DMA end. This has to be become dynamic to handle hot-plug.
132 */ 132 */
133 dma_stat = hwif->tp_ops->read_sff_dma_status(hwif); 133 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);
134 if ((dma_stat & 0x80) && hwif->mate && hwif->mate->dma_base) { 134 if ((dma_stat & 0x80) && hwif->mate && hwif->mate->dma_base) {
135 printk(KERN_INFO "%s %s: simplex device: DMA disabled\n", 135 printk(KERN_INFO "%s %s: simplex device: DMA disabled\n",
136 d->name, pci_name(dev)); 136 d->name, pci_name(dev));
@@ -377,6 +377,9 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
377 377
378 hwif->dma_base = base; 378 hwif->dma_base = base;
379 379
380 if (hwif->dma_ops == NULL)
381 hwif->dma_ops = &sff_dma_ops;
382
380 if (ide_pci_check_simplex(hwif, d) < 0) 383 if (ide_pci_check_simplex(hwif, d) < 0)
381 return -1; 384 return -1;
382 385
@@ -393,8 +396,6 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
393 396
394 if (ide_allocate_dma_engine(hwif)) 397 if (ide_allocate_dma_engine(hwif))
395 return -1; 398 return -1;
396
397 hwif->dma_ops = &sff_dma_ops;
398 } 399 }
399 400
400 return 0; 401 return 0;
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c
index 8e1ffd57a86d..fdb9d7037694 100644
--- a/drivers/ide/sgiioc4.c
+++ b/drivers/ide/sgiioc4.c
@@ -523,7 +523,6 @@ static const struct ide_tp_ops sgiioc4_tp_ops = {
523 .exec_command = ide_exec_command, 523 .exec_command = ide_exec_command,
524 .read_status = sgiioc4_read_status, 524 .read_status = sgiioc4_read_status,
525 .read_altstatus = ide_read_altstatus, 525 .read_altstatus = ide_read_altstatus,
526 .read_sff_dma_status = ide_read_sff_dma_status,
527 526
528 .set_irq = ide_set_irq, 527 .set_irq = ide_set_irq,
529 528
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c
index 652b3a04620f..cb2b352b876b 100644
--- a/drivers/ide/siimage.c
+++ b/drivers/ide/siimage.c
@@ -717,6 +717,7 @@ static const struct ide_dma_ops sil_dma_ops = {
717 .dma_test_irq = siimage_dma_test_irq, 717 .dma_test_irq = siimage_dma_test_irq,
718 .dma_timeout = ide_dma_timeout, 718 .dma_timeout = ide_dma_timeout,
719 .dma_lost_irq = ide_dma_lost_irq, 719 .dma_lost_irq = ide_dma_lost_irq,
720 .dma_sff_read_status = ide_dma_sff_read_status,
720}; 721};
721 722
722#define DECLARE_SII_DEV(p_ops) \ 723#define DECLARE_SII_DEV(p_ops) \
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c
index 1ded01d81ab3..48cc748c5043 100644
--- a/drivers/ide/sl82c105.c
+++ b/drivers/ide/sl82c105.c
@@ -299,6 +299,7 @@ static const struct ide_dma_ops sl82c105_dma_ops = {
299 .dma_test_irq = ide_dma_test_irq, 299 .dma_test_irq = ide_dma_test_irq,
300 .dma_lost_irq = sl82c105_dma_lost_irq, 300 .dma_lost_irq = sl82c105_dma_lost_irq,
301 .dma_timeout = sl82c105_dma_timeout, 301 .dma_timeout = sl82c105_dma_timeout,
302 .dma_sff_read_status = ide_dma_sff_read_status,
302}; 303};
303 304
304static const struct ide_port_info sl82c105_chipset __devinitdata = { 305static const struct ide_port_info sl82c105_chipset __devinitdata = {
diff --git a/drivers/ide/tc86c001.c b/drivers/ide/tc86c001.c
index d2c00fb928e4..84109f5a1632 100644
--- a/drivers/ide/tc86c001.c
+++ b/drivers/ide/tc86c001.c
@@ -188,6 +188,7 @@ static const struct ide_dma_ops tc86c001_dma_ops = {
188 .dma_test_irq = ide_dma_test_irq, 188 .dma_test_irq = ide_dma_test_irq,
189 .dma_lost_irq = ide_dma_lost_irq, 189 .dma_lost_irq = ide_dma_lost_irq,
190 .dma_timeout = ide_dma_timeout, 190 .dma_timeout = ide_dma_timeout,
191 .dma_sff_read_status = ide_dma_sff_read_status,
191}; 192};
192 193
193static const struct ide_port_info tc86c001_chipset __devinitdata = { 194static const struct ide_port_info tc86c001_chipset __devinitdata = {
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index 1ac27ac7283b..882f6f07c476 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -397,6 +397,17 @@ static int tx4939ide_dma_test_irq(ide_drive_t *drive)
397 return found; 397 return found;
398} 398}
399 399
400#ifdef __BIG_ENDIAN
401static u8 tx4939ide_dma_sff_read_status(ide_hwif_t *hwif)
402{
403 void __iomem *base = TX4939IDE_BASE(hwif);
404
405 return tx4939ide_readb(base, TX4939IDE_DMA_Stat);
406}
407#else
408#define tx4939ide_dma_sff_read_status ide_dma_sff_read_status
409#endif
410
400static void tx4939ide_init_hwif(ide_hwif_t *hwif) 411static void tx4939ide_init_hwif(ide_hwif_t *hwif)
401{ 412{
402 void __iomem *base = TX4939IDE_BASE(hwif); 413 void __iomem *base = TX4939IDE_BASE(hwif);
@@ -443,13 +454,6 @@ static void tx4939ide_tf_load_fixup(ide_drive_t *drive, ide_task_t *task)
443 454
444#ifdef __BIG_ENDIAN 455#ifdef __BIG_ENDIAN
445 456
446static u8 tx4939ide_read_sff_dma_status(ide_hwif_t *hwif)
447{
448 void __iomem *base = TX4939IDE_BASE(hwif);
449
450 return tx4939ide_readb(base, TX4939IDE_DMA_Stat);
451}
452
453/* custom iops (independent from SWAP_IO_SPACE) */ 457/* custom iops (independent from SWAP_IO_SPACE) */
454static u8 tx4939ide_inb(unsigned long port) 458static u8 tx4939ide_inb(unsigned long port)
455{ 459{
@@ -585,7 +589,6 @@ static const struct ide_tp_ops tx4939ide_tp_ops = {
585 .exec_command = ide_exec_command, 589 .exec_command = ide_exec_command,
586 .read_status = ide_read_status, 590 .read_status = ide_read_status,
587 .read_altstatus = ide_read_altstatus, 591 .read_altstatus = ide_read_altstatus,
588 .read_sff_dma_status = tx4939ide_read_sff_dma_status,
589 592
590 .set_irq = ide_set_irq, 593 .set_irq = ide_set_irq,
591 594
@@ -609,7 +612,6 @@ static const struct ide_tp_ops tx4939ide_tp_ops = {
609 .exec_command = ide_exec_command, 612 .exec_command = ide_exec_command,
610 .read_status = ide_read_status, 613 .read_status = ide_read_status,
611 .read_altstatus = ide_read_altstatus, 614 .read_altstatus = ide_read_altstatus,
612 .read_sff_dma_status = ide_read_sff_dma_status,
613 615
614 .set_irq = ide_set_irq, 616 .set_irq = ide_set_irq,
615 617
@@ -638,6 +640,7 @@ static const struct ide_dma_ops tx4939ide_dma_ops = {
638 .dma_test_irq = tx4939ide_dma_test_irq, 640 .dma_test_irq = tx4939ide_dma_test_irq,
639 .dma_lost_irq = ide_dma_lost_irq, 641 .dma_lost_irq = ide_dma_lost_irq,
640 .dma_timeout = ide_dma_timeout, 642 .dma_timeout = ide_dma_timeout,
643 .dma_sff_read_status = tx4939ide_dma_sff_read_status,
641}; 644};
642 645
643static const struct ide_port_info tx4939ide_port_info __initdata = { 646static const struct ide_port_info tx4939ide_port_info __initdata = {
diff --git a/include/linux/ide.h b/include/linux/ide.h
index ebc22a836520..3644f6323384 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -674,7 +674,6 @@ struct ide_tp_ops {
674 void (*exec_command)(struct hwif_s *, u8); 674 void (*exec_command)(struct hwif_s *, u8);
675 u8 (*read_status)(struct hwif_s *); 675 u8 (*read_status)(struct hwif_s *);
676 u8 (*read_altstatus)(struct hwif_s *); 676 u8 (*read_altstatus)(struct hwif_s *);
677 u8 (*read_sff_dma_status)(struct hwif_s *);
678 677
679 void (*set_irq)(struct hwif_s *, int); 678 void (*set_irq)(struct hwif_s *, int);
680 679
@@ -735,6 +734,11 @@ struct ide_dma_ops {
735 int (*dma_test_irq)(struct ide_drive_s *); 734 int (*dma_test_irq)(struct ide_drive_s *);
736 void (*dma_lost_irq)(struct ide_drive_s *); 735 void (*dma_lost_irq)(struct ide_drive_s *);
737 void (*dma_timeout)(struct ide_drive_s *); 736 void (*dma_timeout)(struct ide_drive_s *);
737 /*
738 * The following method is optional and only required to be
739 * implemented for the SFF-8038i compatible controllers.
740 */
741 u8 (*dma_sff_read_status)(struct hwif_s *);
738}; 742};
739 743
740struct ide_host; 744struct ide_host;
@@ -1177,7 +1181,6 @@ void ide_tf_dump(const char *, struct ide_taskfile *);
1177void ide_exec_command(ide_hwif_t *, u8); 1181void ide_exec_command(ide_hwif_t *, u8);
1178u8 ide_read_status(ide_hwif_t *); 1182u8 ide_read_status(ide_hwif_t *);
1179u8 ide_read_altstatus(ide_hwif_t *); 1183u8 ide_read_altstatus(ide_hwif_t *);
1180u8 ide_read_sff_dma_status(ide_hwif_t *);
1181 1184
1182void ide_set_irq(ide_hwif_t *, int); 1185void ide_set_irq(ide_hwif_t *, int);
1183 1186
@@ -1458,6 +1461,7 @@ void ide_dma_exec_cmd(ide_drive_t *, u8);
1458extern void ide_dma_start(ide_drive_t *); 1461extern void ide_dma_start(ide_drive_t *);
1459int ide_dma_end(ide_drive_t *); 1462int ide_dma_end(ide_drive_t *);
1460int ide_dma_test_irq(ide_drive_t *); 1463int ide_dma_test_irq(ide_drive_t *);
1464u8 ide_dma_sff_read_status(ide_hwif_t *);
1461extern const struct ide_dma_ops sff_dma_ops; 1465extern const struct ide_dma_ops sff_dma_ops;
1462#else 1466#else
1463static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } 1467static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }