diff options
author | Philippe Schenker <philippe.schenker@toradex.com> | 2020-04-07 18:05:55 +0200 |
---|---|---|
committer | Philippe Schenker <philippe.schenker@toradex.com> | 2020-04-07 18:24:27 +0200 |
commit | bbaead34f0d3b3bfe65dd806372ae3d7c9a16ca5 (patch) | |
tree | dc941fe1524b0ff4a2feb36e4f7db7802231ba4d | |
parent | 96fda21809edc7094f0c4d3f46e3ac4d39f7c9f5 (diff) |
Revert "MLK-22713-1 dmaengine: sdma: drop dma_pool_alloc for BDs"
This reverts commit dc1f576a8423568cb16eb077f7406c08affec9ec.
This patch breaks dma for HDMI-Audio. So reverting it.
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Conflicts:
drivers/dma/imx-sdma.c
-rw-r--r-- | drivers/dma/imx-sdma.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 3ea0ab830c1a..ec33c53b15a9 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -33,6 +33,7 @@ #include <linux/device.h> #include <linux/genalloc.h> #include <linux/dma-mapping.h> +#include <linux/dmapool.h> #include <linux/firmware.h> #include <linux/slab.h> #include <linux/platform_device.h> @@ -368,7 +369,8 @@ struct sdma_channel { unsigned int fifo_num; bool sw_done; u32 sw_done_sel; - struct work_struct terminate_worker; + struct work_struct terminate_worker; + struct dma_pool *bd_pool; }; #define IMX_DMA_SG_LOOP BIT(0) @@ -1259,8 +1261,8 @@ static int sdma_alloc_bd(struct sdma_desc *desc) &desc->bd_phys); if (!desc->bd) { desc->bd_iram = false; - desc->bd = dma_zalloc_coherent(desc->sdmac->sdma->dev, bd_size, - &desc->bd_phys, GFP_NOWAIT); + desc->bd = dma_pool_alloc(desc->sdmac->bd_pool, GFP_ATOMIC, + &desc->bd_phys); if (!desc->bd) return ret; } @@ -1268,6 +1270,8 @@ static int sdma_alloc_bd(struct sdma_desc *desc) desc->sdmac->bd_size_sum += bd_size; spin_unlock_irqrestore(&desc->sdmac->vc.lock, flags); + memset(desc->bd, 0, bd_size); + return 0; } @@ -1281,8 +1285,8 @@ static void sdma_free_bd(struct sdma_desc *desc) gen_pool_free(desc->sdmac->sdma->iram_pool, (unsigned long)desc->bd, bd_size); else - dma_free_coherent(desc->sdmac->sdma->dev, bd_size, - desc->bd, desc->bd_phys); + dma_pool_free(desc->sdmac->bd_pool, desc->bd, + desc->bd_phys); spin_lock_irqsave(&desc->sdmac->vc.lock, flags); desc->sdmac->bd_size_sum -= bd_size; spin_unlock_irqrestore(&desc->sdmac->vc.lock, flags); @@ -1473,6 +1477,10 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan) sdmac->bd_size_sum = 0; + sdmac->bd_pool = dma_pool_create("bd_pool", chan->device->dev, + sizeof(struct sdma_buffer_descriptor), + 32, 0); + return 0; disable_clk_ahb: @@ -1502,6 +1510,9 @@ static void sdma_free_chan_resources(struct dma_chan *chan) clk_disable(sdma->clk_ipg); clk_disable(sdma->clk_ahb); + + dma_pool_destroy(sdmac->bd_pool); + sdmac->bd_pool = NULL; } static struct sdma_desc *sdma_transfer_init(struct sdma_channel *sdmac, |