linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume
@ 2012-12-17 14:07 Andy Shevchenko
  2012-12-17 14:07 ` [PATCH 2/2] dma: dw_dmac: clear suspend during termination Andy Shevchenko
  2012-12-17 16:12 ` [PATCH 1/2] dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume Viresh Kumar
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2012-12-17 14:07 UTC (permalink / raw)
  To: Vinod Koul, spear-devel, linux-kernel, Viresh Kumar; +Cc: Andy Shevchenko

We will use at least the dwc_chan_resume() later.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw_dmac.c |   31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 4413f69..687af2a 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1008,6 +1008,26 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
 	return 0;
 }
 
+static inline void dwc_chan_pause(struct dw_dma_chan *dwc)
+{
+	u32 cfglo = channel_readl(dwc, CFG_LO);
+
+	channel_writel(dwc, CFG_LO, cfglo | DWC_CFGL_CH_SUSP);
+	while (!(channel_readl(dwc, CFG_LO) & DWC_CFGL_FIFO_EMPTY))
+		cpu_relax();
+
+	dwc->paused = true;
+}
+
+static inline void dwc_chan_resume(struct dw_dma_chan *dwc)
+{
+	u32 cfglo = channel_readl(dwc, CFG_LO);
+
+	channel_writel(dwc, CFG_LO, cfglo & ~DWC_CFGL_CH_SUSP);
+
+	dwc->paused = false;
+}
+
 static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 		       unsigned long arg)
 {
@@ -1015,18 +1035,13 @@ static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 	struct dw_dma		*dw = to_dw_dma(chan->device);
 	struct dw_desc		*desc, *_desc;
 	unsigned long		flags;
-	u32			cfglo;
 	LIST_HEAD(list);
 
 	if (cmd == DMA_PAUSE) {
 		spin_lock_irqsave(&dwc->lock, flags);
 
-		cfglo = channel_readl(dwc, CFG_LO);
-		channel_writel(dwc, CFG_LO, cfglo | DWC_CFGL_CH_SUSP);
-		while (!(channel_readl(dwc, CFG_LO) & DWC_CFGL_FIFO_EMPTY))
-			cpu_relax();
+		dwc_chan_pause(dwc);
 
-		dwc->paused = true;
 		spin_unlock_irqrestore(&dwc->lock, flags);
 	} else if (cmd == DMA_RESUME) {
 		if (!dwc->paused)
@@ -1034,9 +1049,7 @@ static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 
 		spin_lock_irqsave(&dwc->lock, flags);
 
-		cfglo = channel_readl(dwc, CFG_LO);
-		channel_writel(dwc, CFG_LO, cfglo & ~DWC_CFGL_CH_SUSP);
-		dwc->paused = false;
+		dwc_chan_resume(dwc);
 
 		spin_unlock_irqrestore(&dwc->lock, flags);
 	} else if (cmd == DMA_TERMINATE_ALL) {
-- 
1.7.10.4


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

* [PATCH 2/2] dma: dw_dmac: clear suspend during termination
  2012-12-17 14:07 [PATCH 1/2] dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume Andy Shevchenko
@ 2012-12-17 14:07 ` Andy Shevchenko
  2012-12-17 15:12   ` Viresh Kumar
  2012-12-17 16:12 ` [PATCH 1/2] dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume Viresh Kumar
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2012-12-17 14:07 UTC (permalink / raw)
  To: Vinod Koul, spear-devel, linux-kernel, Viresh Kumar
  Cc: Heikki Krogerus, Andy Shevchenko

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Clear DWC_CFGL_CH_SUSP bit during termination if the channel
was paused.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw_dmac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 687af2a..8d77643 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1059,7 +1059,7 @@ static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
 
 		dwc_chan_disable(dw, dwc);
 
-		dwc->paused = false;
+		dwc_chan_resume(dwc);
 
 		/* active_list entries will end up before queued entries */
 		list_splice_init(&dwc->queue, &list);
-- 
1.7.10.4


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

* Re: [PATCH 2/2] dma: dw_dmac: clear suspend during termination
  2012-12-17 14:07 ` [PATCH 2/2] dma: dw_dmac: clear suspend during termination Andy Shevchenko
@ 2012-12-17 15:12   ` Viresh Kumar
  2012-12-17 15:26     ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Viresh Kumar @ 2012-12-17 15:12 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Vinod Koul, spear-devel, linux-kernel, Heikki Krogerus

On 17 December 2012 19:37, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>
> Clear DWC_CFGL_CH_SUSP bit during termination if the channel
> was paused.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Insufficient commit log :(
You don't have to say here, what you are doing, but why you are doing it.

Please mention the reason here first, then repost the series after getting my
comments

--
viresh

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

* Re: [PATCH 2/2] dma: dw_dmac: clear suspend during termination
  2012-12-17 15:12   ` Viresh Kumar
@ 2012-12-17 15:26     ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2012-12-17 15:26 UTC (permalink / raw)
  To: Viresh Kumar; +Cc: Vinod Koul, spear-devel, linux-kernel, Heikki Krogerus

On Mon, 2012-12-17 at 20:42 +0530, Viresh Kumar wrote: 
> On 17 December 2012 19:37, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >
> > Clear DWC_CFGL_CH_SUSP bit during termination if the channel
> > was paused.
> >
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Insufficient commit log :(
> You don't have to say here, what you are doing, but why you are doing it.

Fighting against bug. The workflow in our case is to a) pause the dma,
b) do something in the slave driver, c) terminate all transfers, d)
submit new transfer. But d) doesn't happen because the channel is still
paused.

> Please mention the reason here first, then repost the series after getting my
> comments

Okay.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

* Re: [PATCH 1/2] dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume
  2012-12-17 14:07 [PATCH 1/2] dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume Andy Shevchenko
  2012-12-17 14:07 ` [PATCH 2/2] dma: dw_dmac: clear suspend during termination Andy Shevchenko
@ 2012-12-17 16:12 ` Viresh Kumar
  1 sibling, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2012-12-17 16:12 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Vinod Koul, spear-devel, linux-kernel

On 17 December 2012 19:37, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> We will use at least the dwc_chan_resume() later.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

For both patches:
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Just fix the logs and repost with my Acks.

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

end of thread, other threads:[~2012-12-17 16:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-17 14:07 [PATCH 1/2] dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume Andy Shevchenko
2012-12-17 14:07 ` [PATCH 2/2] dma: dw_dmac: clear suspend during termination Andy Shevchenko
2012-12-17 15:12   ` Viresh Kumar
2012-12-17 15:26     ` Andy Shevchenko
2012-12-17 16:12 ` [PATCH 1/2] dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume Viresh Kumar

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