/* Clears any DMA state so the DMA engine is ready to restart with new buffers through omap_start_dma(). Any buffers in flight are discarded.  */
void omap_clear_dma(int lch)
/* Clears any DMA state so the DMA engine is ready to restart with new buffers through omap_start_dma(). Any buffers in flight are discarded.  */
void omap_clear_dma(int lch)
{
	unsigned long flags;
	local_irq_save(flags);
	if (cpu_class_is_omap1()) {
		u32 l;
		l = dma_read(CCR(lch));
		l &= ~OMAP_DMA_CCR_EN;
		dma_write(l, CCR(lch));
		l = dma_read(CSR(lch));
	}
	if (cpu_class_is_omap2()) {
		int i;
		void __iomem *lch_base = omap_dma_base + OMAP_DMA4_CH_BASE(lch);
		for (i = 0; i < 0x44; i += 4)
			__raw_writel(0, lch_base + i);
	}
	local_irq_restore(flags);
}