/* bfin_bmdma_stop - Stop IDE DMA transfer @qc: Command we are ending DMA for  */
static void bfin_bmdma_stop(struct ata_queued_cmd *qc)
/* bfin_bmdma_stop - Stop IDE DMA transfer @qc: Command we are ending DMA for  */
static void bfin_bmdma_stop(struct ata_queued_cmd *qc)
{
	struct ata_port *ap = qc->ap;
	struct scatterlist *sg;
	unsigned int si;
	dev_dbg(qc->ap->dev, "in atapi dma stop\n");
	if (!(ap->udma_mask || ap->mwdma_mask))
		return;
	if (qc->tf.flags & ATA_TFLAG_WRITE)
		disable_dma(CH_ATAPI_TX);
	else {
		disable_dma(CH_ATAPI_RX);
		if (ap->hsm_task_state & HSM_ST_LAST) {
			for_each_sg(qc->sg, sg, qc->n_elem, si) {
				invalidate_dcache_range(
					sg_dma_address(sg),
					sg_dma_address(sg)
					+ sg_dma_len(sg));
			}
		}
	}
}