MLK-20598 dmaengine: imx-sdma: fix potential system hang
authorRobin Gong <yibin.gong@nxp.com>
Mon, 17 Dec 2018 14:34:13 +0000 (22:34 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 2 May 2019 08:35:28 +0000 (11:35 +0300)
In multi audio play/stop case,sdma_alloc_chan_resources/
sdma_free_chan_resources will be called quickly, especially,dma done
interrupt comes after sdma_free_chan_resources, thus, system will be
hang in interrupt since it'll check sdma register but clocks have
already been disabled in sdma_free_chan_resources. To avoid it, enable
clock in isr.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit 09b55a84522fbf404d6cd82b4640a93672c2aa27)

drivers/dma/imx-sdma.c

index 1ca6c40..2e05afa 100644 (file)
@@ -900,6 +900,9 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id)
        struct sdma_engine *sdma = dev_id;
        unsigned long stat;
 
+       clk_enable(sdma->clk_ipg);
+       clk_enable(sdma->clk_ahb);
+
        stat = readl_relaxed(sdma->regs + SDMA_H_INTR);
        writel_relaxed(stat, sdma->regs + SDMA_H_INTR);
        /* channel 0 is special and not handled here, see run_channel0() */
@@ -930,6 +933,9 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id)
                spin_unlock(&sdmac->vc.lock);
        }
 
+       clk_disable(sdma->clk_ipg);
+       clk_disable(sdma->clk_ahb);
+
        return IRQ_HANDLED;
 }