--- zzzz-none-000/linux-4.9.279/drivers/dma/dw/core.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/drivers/dma/dw/core.c 2023-02-08 11:43:42.000000000 +0000 @@ -145,9 +145,6 @@ u32 cfglo = DWC_CFGL_CH_PRIOR(dwc->priority); bool hs_polarity = dwc->dws.hs_polarity; - if (test_bit(DW_DMA_IS_INITIALIZED, &dwc->flags)) - return; - cfghi |= DWC_CFGH_DST_PER(dwc->dws.dst_id); cfghi |= DWC_CFGH_SRC_PER(dwc->dws.src_id); @@ -160,8 +157,6 @@ /* Enable interrupts */ channel_set_bit(dw, MASK.XFER, dwc->mask); channel_set_bit(dw, MASK.ERROR, dwc->mask); - - set_bit(DW_DMA_IS_INITIALIZED, &dwc->flags); } /*----------------------------------------------------------------------*/ @@ -179,8 +174,10 @@ static inline void dwc_chan_disable(struct dw_dma *dw, struct dw_dma_chan *dwc) { + unsigned int count = 20; + channel_clear_bit(dw, CH_EN, dwc->mask); - while (dma_readl(dw, CH_EN) & dwc->mask) + while (dma_readl(dw, CH_EN) & dwc->mask && count--) cpu_relax(); } @@ -1087,7 +1084,7 @@ static void dw_dma_off(struct dw_dma *dw) { - unsigned int i; + unsigned int count = 20; dma_writel(dw, CFG, 0); @@ -1097,11 +1094,8 @@ channel_clear_bit(dw, MASK.DST_TRAN, dw->all_chan_mask); channel_clear_bit(dw, MASK.ERROR, dw->all_chan_mask); - while (dma_readl(dw, CFG) & DW_CFG_DMA_EN) + while (dma_readl(dw, CFG) & DW_CFG_DMA_EN && count--) cpu_relax(); - - for (i = 0; i < dw->dma.chancnt; i++) - clear_bit(DW_DMA_IS_INITIALIZED, &dw->chan[i].flags); } static void dw_dma_on(struct dw_dma *dw) @@ -1166,7 +1160,6 @@ /* Clear custom channel configuration */ memset(&dwc->dws, 0, sizeof(struct dw_dma_slave)); - clear_bit(DW_DMA_IS_INITIALIZED, &dwc->flags); /* Disable interrupts */ channel_clear_bit(dw, MASK.XFER, dwc->mask);