aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-05-19 16:10:20 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-05-25 19:40:19 -0400
commit37f65b8bc262a5ae4c8e58be92fe3032f0aaaf04 (patch)
tree0a7507b26bdc61024d01b538ad7d3d25bc4f7811
parent2f20ccf8190b064468cb2c7ba92e757ae37e61b1 (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>
-rw-r--r--drivers/ata/libata-sff.c67
-rw-r--r--drivers/ata/pata_bf54x.c2
-rw-r--r--drivers/ata/pata_scc.c2
-rw-r--r--drivers/ata/sata_nv.c2
-rw-r--r--drivers/ata/sata_sil.c4
-rw-r--r--drivers/ata/sata_via.c2
-rw-r--r--include/linux/libata.h1
7 files changed, 44 insertions, 36 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}
400EXPORT_SYMBOL_GPL(ata_sff_irq_on); 400EXPORT_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 */
413void 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}
422EXPORT_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}
1749EXPORT_SYMBOL_GPL(ata_sff_freeze); 1731EXPORT_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}
1767EXPORT_SYMBOL_GPL(ata_sff_thaw); 1750EXPORT_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)
2882EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); 2867EXPORT_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 */
2880void 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}
2889EXPORT_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 *
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 6422cfd13d0d..9cae65de750e 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1214,7 +1214,7 @@ static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf,
1214 * bfin_irq_clear - Clear ATAPI interrupt. 1214 * bfin_irq_clear - Clear ATAPI interrupt.
1215 * @ap: Port associated with this ATA transaction. 1215 * @ap: Port associated with this ATA transaction.
1216 * 1216 *
1217 * Note: Original code is ata_sff_irq_clear(). 1217 * Note: Original code is ata_bmdma_irq_clear().
1218 */ 1218 */
1219 1219
1220static void bfin_irq_clear(struct ata_port *ap) 1220static void bfin_irq_clear(struct ata_port *ap)
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 6f6193b707cb..fb318cdaffb7 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -875,7 +875,7 @@ static void scc_postreset(struct ata_link *link, unsigned int *classes)
875 * scc_irq_clear - Clear PCI IDE BMDMA interrupt. 875 * scc_irq_clear - Clear PCI IDE BMDMA interrupt.
876 * @ap: Port associated with this ATA transaction. 876 * @ap: Port associated with this ATA transaction.
877 * 877 *
878 * Note: Original code is ata_sff_irq_clear(). 878 * Note: Original code is ata_bmdma_irq_clear().
879 */ 879 */
880 880
881static void scc_irq_clear (struct ata_port *ap) 881static void scc_irq_clear (struct ata_port *ap)
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index baa8f0d2c86f..358dde0178d4 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1100,7 +1100,7 @@ static void nv_adma_irq_clear(struct ata_port *ap)
1100 u32 notifier_clears[2]; 1100 u32 notifier_clears[2];
1101 1101
1102 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) { 1102 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) {
1103 ata_sff_irq_clear(ap); 1103 ata_bmdma_irq_clear(ap);
1104 return; 1104 return;
1105 } 1105 }
1106 1106
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 2dda312b6b9a..3a4f84219719 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -503,7 +503,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
503 goto err_hsm; 503 goto err_hsm;
504 504
505 /* ack bmdma irq events */ 505 /* ack bmdma irq events */
506 ata_sff_irq_clear(ap); 506 ata_bmdma_irq_clear(ap);
507 507
508 /* kick HSM in the ass */ 508 /* kick HSM in the ass */
509 ata_sff_hsm_move(ap, qc, status, 0); 509 ata_sff_hsm_move(ap, qc, status, 0);
@@ -584,7 +584,7 @@ static void sil_thaw(struct ata_port *ap)
584 584
585 /* clear IRQ */ 585 /* clear IRQ */
586 ap->ops->sff_check_status(ap); 586 ap->ops->sff_check_status(ap);
587 ata_sff_irq_clear(ap); 587 ata_bmdma_irq_clear(ap);
588 588
589 /* turn on SATA IRQ if supported */ 589 /* turn on SATA IRQ if supported */
590 if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ)) 590 if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ))
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 08f65492cc81..7737dd5a434e 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -308,7 +308,7 @@ static void svia_noop_freeze(struct ata_port *ap)
308 * certain way. Leave it alone and just clear pending IRQ. 308 * certain way. Leave it alone and just clear pending IRQ.
309 */ 309 */
310 ap->ops->sff_check_status(ap); 310 ap->ops->sff_check_status(ap);
311 ata_sff_irq_clear(ap); 311 ata_bmdma_irq_clear(ap);
312} 312}
313 313
314/** 314/**
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ee84e7e12039..8fd1ca8c7ef3 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1630,6 +1630,7 @@ extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc);
1630extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); 1630extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc);
1631extern void ata_bmdma_error_handler(struct ata_port *ap); 1631extern void ata_bmdma_error_handler(struct ata_port *ap);
1632extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); 1632extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc);
1633extern void ata_bmdma_irq_clear(struct ata_port *ap);
1633extern void ata_bmdma_setup(struct ata_queued_cmd *qc); 1634extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1634extern void ata_bmdma_start(struct ata_queued_cmd *qc); 1635extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1635extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 1636extern void ata_bmdma_stop(struct ata_queued_cmd *qc);