Commit 37f65b8b authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

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: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 2f20ccf8
...@@ -63,7 +63,6 @@ const struct ata_port_operations ata_sff_port_ops = { ...@@ -63,7 +63,6 @@ const struct ata_port_operations ata_sff_port_ops = {
.sff_tf_read = ata_sff_tf_read, .sff_tf_read = ata_sff_tf_read,
.sff_exec_command = ata_sff_exec_command, .sff_exec_command = ata_sff_exec_command,
.sff_data_xfer = ata_sff_data_xfer, .sff_data_xfer = ata_sff_data_xfer,
.sff_irq_clear = ata_sff_irq_clear,
.sff_drain_fifo = ata_sff_drain_fifo, .sff_drain_fifo = ata_sff_drain_fifo,
.lost_interrupt = ata_sff_lost_interrupt, .lost_interrupt = ata_sff_lost_interrupt,
...@@ -395,32 +394,11 @@ void ata_sff_irq_on(struct ata_port *ap) ...@@ -395,32 +394,11 @@ void ata_sff_irq_on(struct ata_port *ap)
ata_sff_set_devctl(ap, ap->ctl); ata_sff_set_devctl(ap, ap->ctl);
ata_wait_idle(ap); ata_wait_idle(ap);
ap->ops->sff_irq_clear(ap); if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
} }
EXPORT_SYMBOL_GPL(ata_sff_irq_on); EXPORT_SYMBOL_GPL(ata_sff_irq_on);
/**
* ata_sff_irq_clear - Clear PCI IDE BMDMA interrupt.
* @ap: Port associated with this ATA transaction.
*
* Clear interrupt and error flags in DMA status register.
*
* May be used as the irq_clear() entry in ata_port_operations.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_sff_irq_clear(struct ata_port *ap)
{
void __iomem *mmio = ap->ioaddr.bmdma_addr;
if (!mmio)
return;
iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS);
}
EXPORT_SYMBOL_GPL(ata_sff_irq_clear);
/** /**
* ata_sff_tf_load - send taskfile registers to host controller * ata_sff_tf_load - send taskfile registers to host controller
* @ap: Port to which output is sent * @ap: Port to which output is sent
...@@ -1572,7 +1550,8 @@ unsigned int ata_sff_host_intr(struct ata_port *ap, ...@@ -1572,7 +1550,8 @@ unsigned int ata_sff_host_intr(struct ata_port *ap,
} }
/* clear irq events */ /* clear irq events */
ap->ops->sff_irq_clear(ap); if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
ata_sff_hsm_move(ap, qc, status, 0); ata_sff_hsm_move(ap, qc, status, 0);
...@@ -1588,7 +1567,8 @@ unsigned int ata_sff_host_intr(struct ata_port *ap, ...@@ -1588,7 +1567,8 @@ unsigned int ata_sff_host_intr(struct ata_port *ap,
#ifdef ATA_IRQ_TRAP #ifdef ATA_IRQ_TRAP
if ((ap->stats.idle_irq % 1000) == 0) { if ((ap->stats.idle_irq % 1000) == 0) {
ap->ops->sff_check_status(ap); ap->ops->sff_check_status(ap);
ap->ops->sff_irq_clear(ap); if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
ata_port_printk(ap, KERN_WARNING, "irq trap\n"); ata_port_printk(ap, KERN_WARNING, "irq trap\n");
return 1; return 1;
} }
...@@ -1658,7 +1638,8 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance) ...@@ -1658,7 +1638,8 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance)
if (idle & (1 << i)) { if (idle & (1 << i)) {
ap->ops->sff_check_status(ap); ap->ops->sff_check_status(ap);
ap->ops->sff_irq_clear(ap); if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
} else { } else {
/* clear INTRQ and check if BUSY cleared */ /* clear INTRQ and check if BUSY cleared */
if (!(ap->ops->sff_check_status(ap) & ATA_BUSY)) if (!(ap->ops->sff_check_status(ap) & ATA_BUSY))
...@@ -1744,7 +1725,8 @@ void ata_sff_freeze(struct ata_port *ap) ...@@ -1744,7 +1725,8 @@ void ata_sff_freeze(struct ata_port *ap)
*/ */
ap->ops->sff_check_status(ap); ap->ops->sff_check_status(ap);
ap->ops->sff_irq_clear(ap); if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
} }
EXPORT_SYMBOL_GPL(ata_sff_freeze); EXPORT_SYMBOL_GPL(ata_sff_freeze);
...@@ -1761,7 +1743,8 @@ void ata_sff_thaw(struct ata_port *ap) ...@@ -1761,7 +1743,8 @@ void ata_sff_thaw(struct ata_port *ap)
{ {
/* clear & re-enable interrupts */ /* clear & re-enable interrupts */
ap->ops->sff_check_status(ap); ap->ops->sff_check_status(ap);
ap->ops->sff_irq_clear(ap); if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
ata_sff_irq_on(ap); ata_sff_irq_on(ap);
} }
EXPORT_SYMBOL_GPL(ata_sff_thaw); EXPORT_SYMBOL_GPL(ata_sff_thaw);
...@@ -2580,6 +2563,7 @@ const struct ata_port_operations ata_bmdma_port_ops = { ...@@ -2580,6 +2563,7 @@ const struct ata_port_operations ata_bmdma_port_ops = {
.qc_prep = ata_bmdma_qc_prep, .qc_prep = ata_bmdma_qc_prep,
.qc_issue = ata_bmdma_qc_issue, .qc_issue = ata_bmdma_qc_issue,
.sff_irq_clear = ata_bmdma_irq_clear,
.bmdma_setup = ata_bmdma_setup, .bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start, .bmdma_start = ata_bmdma_start,
.bmdma_stop = ata_bmdma_stop, .bmdma_stop = ata_bmdma_stop,
...@@ -2848,7 +2832,8 @@ void ata_bmdma_error_handler(struct ata_port *ap) ...@@ -2848,7 +2832,8 @@ void ata_bmdma_error_handler(struct ata_port *ap)
/* if we're gonna thaw, make sure IRQ is clear */ /* if we're gonna thaw, make sure IRQ is clear */
if (thaw) { if (thaw) {
ap->ops->sff_check_status(ap); ap->ops->sff_check_status(ap);
ap->ops->sff_irq_clear(ap); if (ap->ops->sff_irq_clear)
ap->ops->sff_irq_clear(ap);
} }
} }
...@@ -2881,6 +2866,28 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) ...@@ -2881,6 +2866,28 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
} }
EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd);
/**
* ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt.
* @ap: Port associated with this ATA transaction.
*
* Clear interrupt and error flags in DMA status register.
*
* May be used as the irq_clear() entry in ata_port_operations.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_bmdma_irq_clear(struct ata_port *ap)
{
void __iomem *mmio = ap->ioaddr.bmdma_addr;
if (!mmio)
return;
iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS);
}
EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear);
/** /**
* ata_bmdma_setup - Set up PCI IDE BMDMA transaction * ata_bmdma_setup - Set up PCI IDE BMDMA transaction
* @qc: Info associated with this ATA transaction. * @qc: Info associated with this ATA transaction.
......
...@@ -1214,7 +1214,7 @@ static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf, ...@@ -1214,7 +1214,7 @@ static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf,
* bfin_irq_clear - Clear ATAPI interrupt. * bfin_irq_clear - Clear ATAPI interrupt.
* @ap: Port associated with this ATA transaction. * @ap: Port associated with this ATA transaction.
* *
* Note: Original code is ata_sff_irq_clear(). * Note: Original code is ata_bmdma_irq_clear().
*/ */
static void bfin_irq_clear(struct ata_port *ap) static void bfin_irq_clear(struct ata_port *ap)
......
...@@ -875,7 +875,7 @@ static void scc_postreset(struct ata_link *link, unsigned int *classes) ...@@ -875,7 +875,7 @@ static void scc_postreset(struct ata_link *link, unsigned int *classes)
* scc_irq_clear - Clear PCI IDE BMDMA interrupt. * scc_irq_clear - Clear PCI IDE BMDMA interrupt.
* @ap: Port associated with this ATA transaction. * @ap: Port associated with this ATA transaction.
* *
* Note: Original code is ata_sff_irq_clear(). * Note: Original code is ata_bmdma_irq_clear().
*/ */
static void scc_irq_clear (struct ata_port *ap) static void scc_irq_clear (struct ata_port *ap)
......
...@@ -1100,7 +1100,7 @@ static void nv_adma_irq_clear(struct ata_port *ap) ...@@ -1100,7 +1100,7 @@ static void nv_adma_irq_clear(struct ata_port *ap)
u32 notifier_clears[2]; u32 notifier_clears[2];
if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) { if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) {
ata_sff_irq_clear(ap); ata_bmdma_irq_clear(ap);
return; return;
} }
......
...@@ -503,7 +503,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) ...@@ -503,7 +503,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
goto err_hsm; goto err_hsm;
/* ack bmdma irq events */ /* ack bmdma irq events */
ata_sff_irq_clear(ap); ata_bmdma_irq_clear(ap);
/* kick HSM in the ass */ /* kick HSM in the ass */
ata_sff_hsm_move(ap, qc, status, 0); ata_sff_hsm_move(ap, qc, status, 0);
...@@ -584,7 +584,7 @@ static void sil_thaw(struct ata_port *ap) ...@@ -584,7 +584,7 @@ static void sil_thaw(struct ata_port *ap)
/* clear IRQ */ /* clear IRQ */
ap->ops->sff_check_status(ap); ap->ops->sff_check_status(ap);
ata_sff_irq_clear(ap); ata_bmdma_irq_clear(ap);
/* turn on SATA IRQ if supported */ /* turn on SATA IRQ if supported */
if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ)) if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ))
......
...@@ -308,7 +308,7 @@ static void svia_noop_freeze(struct ata_port *ap) ...@@ -308,7 +308,7 @@ static void svia_noop_freeze(struct ata_port *ap)
* certain way. Leave it alone and just clear pending IRQ. * certain way. Leave it alone and just clear pending IRQ.
*/ */
ap->ops->sff_check_status(ap); ap->ops->sff_check_status(ap);
ata_sff_irq_clear(ap); ata_bmdma_irq_clear(ap);
} }
/** /**
......
...@@ -1630,6 +1630,7 @@ extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc); ...@@ -1630,6 +1630,7 @@ extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc);
extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc);
extern void ata_bmdma_error_handler(struct ata_port *ap); extern void ata_bmdma_error_handler(struct ata_port *ap);
extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc);
extern void ata_bmdma_irq_clear(struct ata_port *ap);
extern void ata_bmdma_setup(struct ata_queued_cmd *qc); extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
extern void ata_bmdma_start(struct ata_queued_cmd *qc); extern void ata_bmdma_start(struct ata_queued_cmd *qc);
extern void ata_bmdma_stop(struct ata_queued_cmd *qc); extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment