diff options
author | Tejun Heo <tj@kernel.org> | 2010-05-19 16:10:20 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2010-05-25 19:40:19 -0400 |
commit | 37f65b8bc262a5ae4c8e58be92fe3032f0aaaf04 (patch) | |
tree | 0a7507b26bdc61024d01b538ad7d3d25bc4f7811 /drivers/ata/libata-sff.c | |
parent | 2f20ccf8190b064468cb2c7ba92e757ae37e61b1 (diff) |
libata-sff: ata_sff_irq_clear() is BMDMA specific
ata_sff_irq_clear() is BMDMA specific. Rename it to
ata_bmdma_irq_clear(), move it to ata_bmdma_port_ops and make
->sff_irq_clear() optional.
Note: ata_bmdma_irq_clear() is actually only needed by ata_piix and
possibly by sata_sil. This should be moved to respective low
level drivers later.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r-- | drivers/ata/libata-sff.c | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 19ddf924944f..55bc4880cbf3 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -63,7 +63,6 @@ const struct ata_port_operations ata_sff_port_ops = { | |||
63 | .sff_tf_read = ata_sff_tf_read, | 63 | .sff_tf_read = ata_sff_tf_read, |
64 | .sff_exec_command = ata_sff_exec_command, | 64 | .sff_exec_command = ata_sff_exec_command, |
65 | .sff_data_xfer = ata_sff_data_xfer, | 65 | .sff_data_xfer = ata_sff_data_xfer, |
66 | .sff_irq_clear = ata_sff_irq_clear, | ||
67 | .sff_drain_fifo = ata_sff_drain_fifo, | 66 | .sff_drain_fifo = ata_sff_drain_fifo, |
68 | 67 | ||
69 | .lost_interrupt = ata_sff_lost_interrupt, | 68 | .lost_interrupt = ata_sff_lost_interrupt, |
@@ -395,33 +394,12 @@ void ata_sff_irq_on(struct ata_port *ap) | |||
395 | ata_sff_set_devctl(ap, ap->ctl); | 394 | ata_sff_set_devctl(ap, ap->ctl); |
396 | ata_wait_idle(ap); | 395 | ata_wait_idle(ap); |
397 | 396 | ||
398 | ap->ops->sff_irq_clear(ap); | 397 | if (ap->ops->sff_irq_clear) |
398 | ap->ops->sff_irq_clear(ap); | ||
399 | } | 399 | } |
400 | EXPORT_SYMBOL_GPL(ata_sff_irq_on); | 400 | EXPORT_SYMBOL_GPL(ata_sff_irq_on); |
401 | 401 | ||
402 | /** | 402 | /** |
403 | * ata_sff_irq_clear - Clear PCI IDE BMDMA interrupt. | ||
404 | * @ap: Port associated with this ATA transaction. | ||
405 | * | ||
406 | * Clear interrupt and error flags in DMA status register. | ||
407 | * | ||
408 | * May be used as the irq_clear() entry in ata_port_operations. | ||
409 | * | ||
410 | * LOCKING: | ||
411 | * spin_lock_irqsave(host lock) | ||
412 | */ | ||
413 | void ata_sff_irq_clear(struct ata_port *ap) | ||
414 | { | ||
415 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
416 | |||
417 | if (!mmio) | ||
418 | return; | ||
419 | |||
420 | iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); | ||
421 | } | ||
422 | EXPORT_SYMBOL_GPL(ata_sff_irq_clear); | ||
423 | |||
424 | /** | ||
425 | * ata_sff_tf_load - send taskfile registers to host controller | 403 | * ata_sff_tf_load - send taskfile registers to host controller |
426 | * @ap: Port to which output is sent | 404 | * @ap: Port to which output is sent |
427 | * @tf: ATA taskfile register set | 405 | * @tf: ATA taskfile register set |
@@ -1572,7 +1550,8 @@ unsigned int ata_sff_host_intr(struct ata_port *ap, | |||
1572 | } | 1550 | } |
1573 | 1551 | ||
1574 | /* clear irq events */ | 1552 | /* clear irq events */ |
1575 | ap->ops->sff_irq_clear(ap); | 1553 | if (ap->ops->sff_irq_clear) |
1554 | ap->ops->sff_irq_clear(ap); | ||
1576 | 1555 | ||
1577 | ata_sff_hsm_move(ap, qc, status, 0); | 1556 | ata_sff_hsm_move(ap, qc, status, 0); |
1578 | 1557 | ||
@@ -1588,7 +1567,8 @@ idle_irq: | |||
1588 | #ifdef ATA_IRQ_TRAP | 1567 | #ifdef ATA_IRQ_TRAP |
1589 | if ((ap->stats.idle_irq % 1000) == 0) { | 1568 | if ((ap->stats.idle_irq % 1000) == 0) { |
1590 | ap->ops->sff_check_status(ap); | 1569 | ap->ops->sff_check_status(ap); |
1591 | ap->ops->sff_irq_clear(ap); | 1570 | if (ap->ops->sff_irq_clear) |
1571 | ap->ops->sff_irq_clear(ap); | ||
1592 | ata_port_printk(ap, KERN_WARNING, "irq trap\n"); | 1572 | ata_port_printk(ap, KERN_WARNING, "irq trap\n"); |
1593 | return 1; | 1573 | return 1; |
1594 | } | 1574 | } |
@@ -1658,7 +1638,8 @@ retry: | |||
1658 | 1638 | ||
1659 | if (idle & (1 << i)) { | 1639 | if (idle & (1 << i)) { |
1660 | ap->ops->sff_check_status(ap); | 1640 | ap->ops->sff_check_status(ap); |
1661 | ap->ops->sff_irq_clear(ap); | 1641 | if (ap->ops->sff_irq_clear) |
1642 | ap->ops->sff_irq_clear(ap); | ||
1662 | } else { | 1643 | } else { |
1663 | /* clear INTRQ and check if BUSY cleared */ | 1644 | /* clear INTRQ and check if BUSY cleared */ |
1664 | if (!(ap->ops->sff_check_status(ap) & ATA_BUSY)) | 1645 | if (!(ap->ops->sff_check_status(ap) & ATA_BUSY)) |
@@ -1744,7 +1725,8 @@ void ata_sff_freeze(struct ata_port *ap) | |||
1744 | */ | 1725 | */ |
1745 | ap->ops->sff_check_status(ap); | 1726 | ap->ops->sff_check_status(ap); |
1746 | 1727 | ||
1747 | ap->ops->sff_irq_clear(ap); | 1728 | if (ap->ops->sff_irq_clear) |
1729 | ap->ops->sff_irq_clear(ap); | ||
1748 | } | 1730 | } |
1749 | EXPORT_SYMBOL_GPL(ata_sff_freeze); | 1731 | EXPORT_SYMBOL_GPL(ata_sff_freeze); |
1750 | 1732 | ||
@@ -1761,7 +1743,8 @@ void ata_sff_thaw(struct ata_port *ap) | |||
1761 | { | 1743 | { |
1762 | /* clear & re-enable interrupts */ | 1744 | /* clear & re-enable interrupts */ |
1763 | ap->ops->sff_check_status(ap); | 1745 | ap->ops->sff_check_status(ap); |
1764 | ap->ops->sff_irq_clear(ap); | 1746 | if (ap->ops->sff_irq_clear) |
1747 | ap->ops->sff_irq_clear(ap); | ||
1765 | ata_sff_irq_on(ap); | 1748 | ata_sff_irq_on(ap); |
1766 | } | 1749 | } |
1767 | EXPORT_SYMBOL_GPL(ata_sff_thaw); | 1750 | EXPORT_SYMBOL_GPL(ata_sff_thaw); |
@@ -2580,6 +2563,7 @@ const struct ata_port_operations ata_bmdma_port_ops = { | |||
2580 | .qc_prep = ata_bmdma_qc_prep, | 2563 | .qc_prep = ata_bmdma_qc_prep, |
2581 | .qc_issue = ata_bmdma_qc_issue, | 2564 | .qc_issue = ata_bmdma_qc_issue, |
2582 | 2565 | ||
2566 | .sff_irq_clear = ata_bmdma_irq_clear, | ||
2583 | .bmdma_setup = ata_bmdma_setup, | 2567 | .bmdma_setup = ata_bmdma_setup, |
2584 | .bmdma_start = ata_bmdma_start, | 2568 | .bmdma_start = ata_bmdma_start, |
2585 | .bmdma_stop = ata_bmdma_stop, | 2569 | .bmdma_stop = ata_bmdma_stop, |
@@ -2848,7 +2832,8 @@ void ata_bmdma_error_handler(struct ata_port *ap) | |||
2848 | /* if we're gonna thaw, make sure IRQ is clear */ | 2832 | /* if we're gonna thaw, make sure IRQ is clear */ |
2849 | if (thaw) { | 2833 | if (thaw) { |
2850 | ap->ops->sff_check_status(ap); | 2834 | ap->ops->sff_check_status(ap); |
2851 | ap->ops->sff_irq_clear(ap); | 2835 | if (ap->ops->sff_irq_clear) |
2836 | ap->ops->sff_irq_clear(ap); | ||
2852 | } | 2837 | } |
2853 | } | 2838 | } |
2854 | 2839 | ||
@@ -2882,6 +2867,28 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) | |||
2882 | EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); | 2867 | EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); |
2883 | 2868 | ||
2884 | /** | 2869 | /** |
2870 | * ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. | ||
2871 | * @ap: Port associated with this ATA transaction. | ||
2872 | * | ||
2873 | * Clear interrupt and error flags in DMA status register. | ||
2874 | * | ||
2875 | * May be used as the irq_clear() entry in ata_port_operations. | ||
2876 | * | ||
2877 | * LOCKING: | ||
2878 | * spin_lock_irqsave(host lock) | ||
2879 | */ | ||
2880 | void ata_bmdma_irq_clear(struct ata_port *ap) | ||
2881 | { | ||
2882 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
2883 | |||
2884 | if (!mmio) | ||
2885 | return; | ||
2886 | |||
2887 | iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); | ||
2888 | } | ||
2889 | EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear); | ||
2890 | |||
2891 | /** | ||
2885 | * ata_bmdma_setup - Set up PCI IDE BMDMA transaction | 2892 | * ata_bmdma_setup - Set up PCI IDE BMDMA transaction |
2886 | * @qc: Info associated with this ATA transaction. | 2893 | * @qc: Info associated with this ATA transaction. |
2887 | * | 2894 | * |