/* Enable or disable a DMA channel (by index ch: 0..15) by setting or clearing a DMA_SxCR bit.  */
static int __stm32_dma_ch_enable(int ch, int enable)
/* Enable or disable a DMA channel (by index ch: 0..15) by setting or clearing a DMA_SxCR bit.  */
static int __stm32_dma_ch_enable(int ch, int enable)
{
	volatile struct stm32_dma_ch_regs *ch_regs;
	DMAAPI_LOCKED_BEGIN
	ch_regs = dma_ch_regs(ch);
	if (enable) {
		stm32_dma_clear_irq_flags(ch,
			STM32_DMA_IRQF_TC | STM32_DMA_IRQF_HT |
			STM32_DMA_IRQF_TE | STM32_DMA_IRQF_DME |
			STM32_DMA_IRQF_FE);
		ch_regs->cr |= STM32_DMA_CR_EN;
	} else {
		ch_regs->cr &= ~STM32_DMA_CR_EN;
	}
	DMAAPI_LOCKED_END
}