MLK-11325 dma: mxs-dma: fix dma_io clock enable count mismatch issue
authorFugang Duan <b38611@freescale.com>
Wed, 5 Aug 2015 10:21:04 +0000 (18:21 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:29 +0000 (14:47 -0500)
After dma init by calling .mxs_dma_init(), disable dma_io and
dma_bch clocks. When dma chans are requested by devices, clocks
are enabled in .device_alloc_chan_resources(). The patch is to
fix clock enable count mismatch issue.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 4868cf5e39a0aeb1ad12c5c1a453d233c0f472ce)

drivers/dma/mxs-dma.c

index 4a85d32..5b2139f 100644 (file)
@@ -721,12 +721,12 @@ static int mxs_dma_init(struct mxs_dma_engine *mxs_dma)
        if (mxs_dma->dev_id == IMX7D_DMA) {
                ret = clk_prepare_enable(mxs_dma->clk_io);
                if (ret)
-                       goto err_out;
+                       goto err_clk_bch;
        }
 
        ret = stmp_reset_block(mxs_dma->base);
        if (ret)
-               goto err_out;
+               goto err_clk_io;
 
        /* enable apbh burst */
        if (dma_is_apbh(mxs_dma)) {
@@ -740,7 +740,10 @@ static int mxs_dma_init(struct mxs_dma_engine *mxs_dma)
        writel(MXS_DMA_CHANNELS_MASK << MXS_DMA_CHANNELS,
                mxs_dma->base + HW_APBHX_CTRL1 + STMP_OFFSET_REG_SET);
 
-err_out:
+err_clk_io:
+       if (mxs_dma->dev_id == IMX7D_DMA)
+               clk_disable_unprepare(mxs_dma->clk_io);
+err_clk_bch:
        clk_disable_unprepare(mxs_dma->clk);
        return ret;
 }