linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] dmaengine: imx-sdma: refine to load context only once
@ 2018-12-06  6:36 Robin Gong
  2019-01-04 15:14 ` Vinod Koul
  0 siblings, 1 reply; 3+ messages in thread
From: Robin Gong @ 2018-12-06  6:36 UTC (permalink / raw)
  To: vkoul, dan.j.williams, kernel; +Cc: dmaengine, linux-kernel, dl-linux-imx

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: Robin Gong <yibin.gong@nxp.com>
---
 drivers/dma/imx-sdma.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index a2b0a0e..015c17a 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -377,6 +377,7 @@ struct sdma_channel {
 	unsigned long			watermark_level;
 	u32				shp_addr, per_addr;
 	enum dma_status			status;
+	bool				context_loaded;
 	struct imx_dma_data		data;
 	struct work_struct		terminate_worker;
 };
@@ -970,6 +971,9 @@ static int sdma_load_context(struct sdma_channel *sdmac)
 	int ret;
 	unsigned long flags;
 
+	if (sdmac->context_loaded)
+		return 0;
+
 	if (sdmac->direction == DMA_DEV_TO_MEM)
 		load_address = sdmac->pc_from_device;
 	else if (sdmac->direction == DMA_DEV_TO_DEV)
@@ -1012,6 +1016,8 @@ static int sdma_load_context(struct sdma_channel *sdmac)
 
 	spin_unlock_irqrestore(&sdma->channel_0_lock, flags);
 
+	sdmac->context_loaded = true;
+
 	return ret;
 }
 
@@ -1051,6 +1057,7 @@ static void sdma_channel_terminate_work(struct work_struct *work)
 	sdmac->desc = NULL;
 	spin_unlock_irqrestore(&sdmac->vc.lock, flags);
 	vchan_dma_desc_free_list(&sdmac->vc, &head);
+	sdmac->context_loaded = false;
 }
 
 static int sdma_disable_channel_async(struct dma_chan *chan)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] dmaengine: imx-sdma: refine to load context only once
  2018-12-06  6:36 [PATCH v1] dmaengine: imx-sdma: refine to load context only once Robin Gong
@ 2019-01-04 15:14 ` Vinod Koul
  2019-01-08 12:02   ` Robin Gong
  0 siblings, 1 reply; 3+ messages in thread
From: Vinod Koul @ 2019-01-04 15:14 UTC (permalink / raw)
  To: Robin Gong; +Cc: dan.j.williams, kernel, dmaengine, linux-kernel, dl-linux-imx

On 06-12-18, 06:36, Robin Gong wrote:
> The context loaded only one time before channel running,but
                                                        ^^
space after comma please

> 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.

I was going to apply it, but it fails to apply for me, please rebase and
send

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v1] dmaengine: imx-sdma: refine to load context only once
  2019-01-04 15:14 ` Vinod Koul
@ 2019-01-08 12:02   ` Robin Gong
  0 siblings, 0 replies; 3+ messages in thread
From: Robin Gong @ 2019-01-08 12:02 UTC (permalink / raw)
  To: Vinod Koul; +Cc: dan.j.williams, kernel, dmaengine, linux-kernel, dl-linux-imx

Hi Vinod,
	I have sent v2 after rebase. Please have a try. 

> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: 2019年1月4日 23:15
> To: Robin Gong <yibin.gong@nxp.com>
> Cc: dan.j.williams@intel.com; kernel@pengutronix.de;
> dmaengine@vger.kernel.org; linux-kernel@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: Re: [PATCH v1] dmaengine: imx-sdma: refine to load context only once
> 
> On 06-12-18, 06:36, Robin Gong wrote:
> > The context loaded only one time before channel running,but
>                                                         ^^ space
> after comma please
> 
> > 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.
> 
> I was going to apply it, but it fails to apply for me, please rebase and send
> 
> --
> ~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-08 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06  6:36 [PATCH v1] dmaengine: imx-sdma: refine to load context only once Robin Gong
2019-01-04 15:14 ` Vinod Koul
2019-01-08 12:02   ` Robin Gong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).