MLK-11259-1: dmaengine: imx-sdma: support dual fifo for DEV_TO_DEV
authorShengjiu Wang <shengjiu.wang@freescale.com>
Fri, 17 Jul 2015 05:52:37 +0000 (13:52 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:25 +0000 (14:47 -0500)
As SSI has dual fifo, add src_dualfifo and dst_dualfifo in imx_dma_data
to support dual fifo in DMA_DEV_TO_DEV.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit cfde1308f170166a0099ca39ee8733895f9626f0)

drivers/dma/imx-sdma.c
include/linux/platform_data/dma-imx.h

index 0eb4c52..cb761a5 100644 (file)
 #define SDMA_WATERMARK_LEVEL_SPDIF     BIT(10)
 #define SDMA_WATERMARK_LEVEL_SP                BIT(11)
 #define SDMA_WATERMARK_LEVEL_DP                BIT(12)
+#define SDMA_WATERMARK_LEVEL_SD                BIT(13)
+#define SDMA_WATERMARK_LEVEL_DD                BIT(14)
 #define SDMA_WATERMARK_LEVEL_HWML      (0xFF << 16)
 #define SDMA_WATERMARK_LEVEL_LWE       BIT(28)
 #define SDMA_WATERMARK_LEVEL_HWE       BIT(29)
@@ -335,6 +337,8 @@ struct sdma_channel {
        unsigned int                    chn_real_count;
        struct tasklet_struct           tasklet;
        struct imx_dma_data             data;
+       bool                            src_dualfifo;
+       bool                            dst_dualfifo;
 };
 
 #define IMX_DMA_SG_LOOP                BIT(0)
@@ -1039,6 +1043,11 @@ static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac)
                sdmac->watermark_level |= SDMA_WATERMARK_LEVEL_DP;
 
        sdmac->watermark_level |= SDMA_WATERMARK_LEVEL_CONT;
+
+       if (sdmac->src_dualfifo)
+               sdmac->watermark_level |= SDMA_WATERMARK_LEVEL_SD;
+       if (sdmac->dst_dualfifo)
+               sdmac->watermark_level |= SDMA_WATERMARK_LEVEL_DD;
 }
 
 static int sdma_config_channel(struct dma_chan *chan)
@@ -1184,6 +1193,8 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan)
        sdmac->peripheral_type = data->peripheral_type;
        sdmac->event_id0 = data->dma_request;
        sdmac->event_id1 = data->dma_request2;
+       sdmac->src_dualfifo = data->src_dualfifo;
+       sdmac->dst_dualfifo = data->dst_dualfifo;
 
        ret = clk_enable(sdmac->sdma->clk_ipg);
        if (ret)
@@ -1882,17 +1893,11 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args *dma_spec,
        if (dma_spec->args_count != 3)
                return NULL;
 
+       memset(&data, 0, sizeof(data));
+
        data.dma_request = dma_spec->args[0];
        data.peripheral_type = dma_spec->args[1];
        data.priority = dma_spec->args[2];
-       /*
-        * init dma_request2 to zero, which is not used by the dts.
-        * For P2P, dma_request2 is init from dma_request_channel(),
-        * chan->private will point to the imx_dma_data, and in
-        * device_alloc_chan_resources(), imx_dma_data.dma_request2 will
-        * be set to sdmac->event_id1.
-        */
-       data.dma_request2 = 0;
 
        return dma_request_channel(mask, sdma_filter_fn, &data);
 }
index 092133a..bee13cf 100644 (file)
@@ -56,6 +56,8 @@ struct imx_dma_data {
        int dma_request2; /* secondary DMA request line */
        enum sdma_peripheral_type peripheral_type;
        int priority;
+       bool src_dualfifo;
+       bool dst_dualfifo;
 };
 
 static inline int imx_dma_is_ipu(struct dma_chan *chan)