Commit ad0d92d7 authored by Robin Gong's avatar Robin Gong Committed by Vinod Koul

dmaengine: imx-sdma: refine to load context only once

The context loaded only one time before channel running,but
currently sdma_config_channel() and dma_prep_* duplicated with
sdma_load_context(), so refine it to load context only one time
before channel running and reload after the channel terminated.
Signed-off-by: default avatarRobin Gong <yibin.gong@nxp.com>
Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent bfeffd15
...@@ -377,6 +377,7 @@ struct sdma_channel { ...@@ -377,6 +377,7 @@ struct sdma_channel {
unsigned long watermark_level; unsigned long watermark_level;
u32 shp_addr, per_addr; u32 shp_addr, per_addr;
enum dma_status status; enum dma_status status;
bool context_loaded;
struct imx_dma_data data; struct imx_dma_data data;
struct work_struct terminate_worker; struct work_struct terminate_worker;
}; };
...@@ -970,6 +971,9 @@ static int sdma_load_context(struct sdma_channel *sdmac) ...@@ -970,6 +971,9 @@ static int sdma_load_context(struct sdma_channel *sdmac)
int ret; int ret;
unsigned long flags; unsigned long flags;
if (sdmac->context_loaded)
return 0;
if (sdmac->direction == DMA_DEV_TO_MEM) if (sdmac->direction == DMA_DEV_TO_MEM)
load_address = sdmac->pc_from_device; load_address = sdmac->pc_from_device;
else if (sdmac->direction == DMA_DEV_TO_DEV) else if (sdmac->direction == DMA_DEV_TO_DEV)
...@@ -1012,6 +1016,8 @@ static int sdma_load_context(struct sdma_channel *sdmac) ...@@ -1012,6 +1016,8 @@ static int sdma_load_context(struct sdma_channel *sdmac)
spin_unlock_irqrestore(&sdma->channel_0_lock, flags); spin_unlock_irqrestore(&sdma->channel_0_lock, flags);
sdmac->context_loaded = true;
return ret; return ret;
} }
...@@ -1051,6 +1057,7 @@ static void sdma_channel_terminate_work(struct work_struct *work) ...@@ -1051,6 +1057,7 @@ static void sdma_channel_terminate_work(struct work_struct *work)
sdmac->desc = NULL; sdmac->desc = NULL;
spin_unlock_irqrestore(&sdmac->vc.lock, flags); spin_unlock_irqrestore(&sdmac->vc.lock, flags);
vchan_dma_desc_free_list(&sdmac->vc, &head); vchan_dma_desc_free_list(&sdmac->vc, &head);
sdmac->context_loaded = false;
} }
static int sdma_disable_channel_async(struct dma_chan *chan) static int sdma_disable_channel_async(struct dma_chan *chan)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment