Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1402084 > unrolled thread

[PATCH v1 00/10] *** imx-sdma: misc fix ***

Started byJiada Wang <jiada_wang@mentor.com>
First post2016-05-17 06:00 +0200
Last post2016-05-25 10:00 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1 00/10] *** imx-sdma: misc fix *** Jiada Wang <jiada_wang@mentor.com> - 2016-05-17 06:00 +0200
    [PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts Jiada Wang <jiada_wang@mentor.com> - 2016-05-17 06:00 +0200
    [PATCH 02/10] dma: imx-sdma: don't update BD in isr routine Jiada Wang <jiada_wang@mentor.com> - 2016-05-17 06:00 +0200
    [PATCH 04/10] dma: imx-sdma: update sdma channel status for cyclic dma Jiada Wang <jiada_wang@mentor.com> - 2016-05-17 06:00 +0200
    Re: [PATCH v1 00/10] *** imx-sdma: misc fix *** Vinod Koul <vinod.koul@intel.com> - 2016-05-17 12:00 +0200
      Re: [PATCH v1 00/10] *** imx-sdma: misc fix *** Jiada Wang <jiada_wang@mentor.com> - 2016-05-25 10:00 +0200

#1402084 — [PATCH v1 00/10] *** imx-sdma: misc fix ***

FromJiada Wang <jiada_wang@mentor.com>
Date2016-05-17 06:00 +0200
Subject[PATCH v1 00/10] *** imx-sdma: misc fix ***
Message-ID<rzEb7-7HI-5@gated-at.bofh.it>
this patch set contains the following changes
1. fix issues in cyclic dma
2. add support to SYNC DMA termination
3. avoid system hang, when SDMA channel 0 timeouts
4. add lock to prevent race condition

Jiada Wang (10):
  dma: imx-sdma: use chn_real_count to report residue for UART
  dma: imx-sdma: don't update BD in isr routine
  dma: imx-sdma: clear BD_RROR flag before pass it to sdma script
  dma: imx-sdma: update sdma channel status for cyclic dma
  dma: imx-sdma: add flag to indicate SDMA channel state
  dma: imx-sdma: add terminate_all support
  dma: imx-sdma: Add synchronization support
  dma: imx-sdma: abort updating channel when it has been terminated
  dma: imx-sdma: disable channel 0 when it timeouts
  dma: imx-sdma: clear channel0 interrupt bit in irq routine

 drivers/dma/imx-sdma.c | 113 +++++++++++++++++++++++++++++++++++--------------
 1 file changed, 82 insertions(+), 31 deletions(-)

-- 
2.4.5

[toc] | [next] | [standalone]


#1402086 — [PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts

FromJiada Wang <jiada_wang@mentor.com>
Date2016-05-17 06:00 +0200
Subject[PATCH 09/10] dma: imx-sdma: disable channel 0 when it timeouts
Message-ID<rzEkN-7L0-17@gated-at.bofh.it>
In reply to#1402084
Previously when channel0 timeouts to finish its task,
sdma_run_channel0() just returns without disable channel0,
this will cause continuous interrupt later when channel0
finishs its task and set channel0 interrupt bit.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 drivers/dma/imx-sdma.c | 43 ++++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index bc867e5..8b20bf4 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -572,6 +572,27 @@ static void sdma_enable_channel(struct sdma_engine *sdma, int channel)
 	spin_unlock_irqrestore(&sdmac->lock, flags);
 }
 
+static struct sdma_channel *to_sdma_chan(struct dma_chan *chan)
+{
+	return container_of(chan, struct sdma_channel, chan);
+}
+
+static int sdma_disable_channel(struct dma_chan *chan)
+{
+	struct sdma_channel *sdmac = to_sdma_chan(chan);
+	struct sdma_engine *sdma = sdmac->sdma;
+	int channel = sdmac->channel;
+	unsigned long flags;
+
+	spin_lock_irqsave(&sdmac->lock, flags);
+	sdmac->enabled = false;
+	writel_relaxed(BIT(channel), sdma->regs + SDMA_H_STATSTOP);
+	sdmac->status = DMA_ERROR;
+	spin_unlock_irqrestore(&sdmac->lock, flags);
+
+	return 0;
+}
+
 /*
  * sdma_run_channel0 - run a channel and wait till it's done
  */
@@ -592,6 +613,7 @@ static int sdma_run_channel0(struct sdma_engine *sdma)
 		/* Clear the interrupt status */
 		writel_relaxed(ret, sdma->regs + SDMA_H_INTR);
 	} else {
+		sdma_disable_channel(&sdma->channel[0].chan);
 		dev_err(sdma->dev, "Timeout waiting for CH0 ready\n");
 	}
 
@@ -916,27 +938,6 @@ static int sdma_load_context(struct sdma_channel *sdmac)
 	return ret;
 }
 
-static struct sdma_channel *to_sdma_chan(struct dma_chan *chan)
-{
-	return container_of(chan, struct sdma_channel, chan);
-}
-
-static int sdma_disable_channel(struct dma_chan *chan)
-{
-	struct sdma_channel *sdmac = to_sdma_chan(chan);
-	struct sdma_engine *sdma = sdmac->sdma;
-	int channel = sdmac->channel;
-	unsigned long flags;
-
-	spin_lock_irqsave(&sdmac->lock, flags);
-	sdmac->enabled = false;
-	writel_relaxed(BIT(channel), sdma->regs + SDMA_H_STATSTOP);
-	sdmac->status = DMA_ERROR;
-	spin_unlock_irqrestore(&sdmac->lock, flags);
-
-	return 0;
-}
-
 static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac)
 {
 	struct sdma_engine *sdma = sdmac->sdma;
-- 
2.4.5

[toc] | [prev] | [next] | [standalone]


#1402087 — [PATCH 02/10] dma: imx-sdma: don't update BD in isr routine

FromJiada Wang <jiada_wang@mentor.com>
Date2016-05-17 06:00 +0200
Subject[PATCH 02/10] dma: imx-sdma: don't update BD in isr routine
Message-ID<rzEkO-7L0-21@gated-at.bofh.it>
In reply to#1402084
commit d1a792f3b407 ("Update imx-sdma cyclic handling to report residue")
moves updating of BD to isr routine, to avoid stop
of cyclic dma, but there is chance 'new' isr comes before the 'old'
tasklet can be fired, thus cause data loss due to missing of one
tasklet. So move updating of BD back to tasklet.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 drivers/dma/imx-sdma.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 1f1b64b..887e4e5 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -656,12 +656,6 @@ static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event)
 
 static void sdma_handle_channel_loop(struct sdma_channel *sdmac)
 {
-	if (sdmac->desc.callback)
-		sdmac->desc.callback(sdmac->desc.callback_param);
-}
-
-static void sdma_update_channel_loop(struct sdma_channel *sdmac)
-{
 	struct sdma_buffer_descriptor *bd;
 
 	/*
@@ -685,6 +679,9 @@ static void sdma_update_channel_loop(struct sdma_channel *sdmac)
 			sdmac->chn_real_count = bd->mode.count;
 			bd->mode.count = sdmac->chn_count;
 		}
+
+		if (sdmac->desc.callback)
+			sdmac->desc.callback(sdmac->desc.callback_param);
 	}
 }
 
@@ -740,9 +737,6 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id)
 		int channel = fls(stat) - 1;
 		struct sdma_channel *sdmac = &sdma->channel[channel];
 
-		if (sdmac->flags & IMX_DMA_SG_LOOP)
-			sdma_update_channel_loop(sdmac);
-
 		tasklet_schedule(&sdmac->tasklet);
 
 		__clear_bit(channel, &stat);
-- 
2.4.5

[toc] | [prev] | [next] | [standalone]


#1402089 — [PATCH 04/10] dma: imx-sdma: update sdma channel status for cyclic dma

FromJiada Wang <jiada_wang@mentor.com>
Date2016-05-17 06:00 +0200
Subject[PATCH 04/10] dma: imx-sdma: update sdma channel status for cyclic dma
Message-ID<rzEkO-7L0-27@gated-at.bofh.it>
In reply to#1402084
Previously for cyclic dma mode, once sdma fails sdma channel status will
be set to DMA_ERROR, unless the transfer is prepared again, sdmac status
will always be kept to DMA_ERROR, even the transfer for following buffers
is successful.

This patch updates sdmac status to the status of current buffer descriptor.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 drivers/dma/imx-sdma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 1489de0..36f5e39 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -670,6 +670,8 @@ static void sdma_handle_channel_loop(struct sdma_channel *sdmac)
 
 		if (bd->mode.status & BD_RROR)
 			sdmac->status = DMA_ERROR;
+		else
+			sdmac->status = DMA_IN_PROGRESS;
 
 		bd->mode.status &= ~BD_RROR;
 		bd->mode.status |= BD_DONE;
-- 
2.4.5

[toc] | [prev] | [next] | [standalone]


#1402241

FromVinod Koul <vinod.koul@intel.com>
Date2016-05-17 12:00 +0200
Message-ID<rzJXh-2UD-15@gated-at.bofh.it>
In reply to#1402084
On Tue, May 17, 2016 at 12:47:46PM +0900, Jiada Wang wrote:
> this patch set contains the following changes
> 1. fix issues in cyclic dma
> 2. add support to SYNC DMA termination
> 3. avoid system hang, when SDMA channel 0 timeouts
> 4. add lock to prevent race condition

I have three series in my inbox with same title and version. whats going on?

> 
> Jiada Wang (10):
>   dma: imx-sdma: use chn_real_count to report residue for UART
>   dma: imx-sdma: don't update BD in isr routine
>   dma: imx-sdma: clear BD_RROR flag before pass it to sdma script
>   dma: imx-sdma: update sdma channel status for cyclic dma
>   dma: imx-sdma: add flag to indicate SDMA channel state
>   dma: imx-sdma: add terminate_all support
>   dma: imx-sdma: Add synchronization support
>   dma: imx-sdma: abort updating channel when it has been terminated
>   dma: imx-sdma: disable channel 0 when it timeouts
>   dma: imx-sdma: clear channel0 interrupt bit in irq routine
> 
>  drivers/dma/imx-sdma.c | 113 +++++++++++++++++++++++++++++++++++--------------
>  1 file changed, 82 insertions(+), 31 deletions(-)
> 
> -- 
> 2.4.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe dmaengine" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
~Vinod

[toc] | [prev] | [next] | [standalone]


#1406713

FromJiada Wang <jiada_wang@mentor.com>
Date2016-05-25 10:00 +0200
Message-ID<rCBTx-6Kw-29@gated-at.bofh.it>
In reply to#1402241
Hello

On 05/17/2016 07:04 PM, Vinod Koul wrote:
> On Tue, May 17, 2016 at 12:47:46PM +0900, Jiada Wang wrote:
>> this patch set contains the following changes
>> 1. fix issues in cyclic dma
>> 2. add support to SYNC DMA termination
>> 3. avoid system hang, when SDMA channel 0 timeouts
>> 4. add lock to prevent race condition
>
> I have three series in my inbox with same title and version. whats going on?
>
Sorry for the confusion,
attempted to loop Shawn, but used wrong email address.

Thanks,
Jiada

>>
>> Jiada Wang (10):
>>    dma: imx-sdma: use chn_real_count to report residue for UART
>>    dma: imx-sdma: don't update BD in isr routine
>>    dma: imx-sdma: clear BD_RROR flag before pass it to sdma script
>>    dma: imx-sdma: update sdma channel status for cyclic dma
>>    dma: imx-sdma: add flag to indicate SDMA channel state
>>    dma: imx-sdma: add terminate_all support
>>    dma: imx-sdma: Add synchronization support
>>    dma: imx-sdma: abort updating channel when it has been terminated
>>    dma: imx-sdma: disable channel 0 when it timeouts
>>    dma: imx-sdma: clear channel0 interrupt bit in irq routine
>>
>>   drivers/dma/imx-sdma.c | 113 +++++++++++++++++++++++++++++++++++--------------
>>   1 file changed, 82 insertions(+), 31 deletions(-)
>>
>> --
>> 2.4.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe dmaengine" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web