diff mbox

[1/2] dma: axi-dmac: Only use hardware cyclic mode for single segment transfers

Message ID 20170905081638.5117-1-lars@metafoo.de (mailing list archive)
State Accepted
Headers show

Commit Message

Lars-Peter Clausen Sept. 5, 2017, 8:16 a.m. UTC
In hardware cyclic mode the submitted segment is repeated. This means
hardware cyclic mode can only be used if the transfer has a single segment.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/dma/dma-axi-dmac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Lars-Peter Clausen Sept. 5, 2017, 8:20 a.m. UTC | #1
I screwed up, the subject prefix should of course be "dmaengine" and not
"dma". Vinod can you fix this up, or should I resend?

On 09/05/2017 10:16 AM, Lars-Peter Clausen wrote:
> In hardware cyclic mode the submitted segment is repeated. This means
> hardware cyclic mode can only be used if the transfer has a single segment.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  drivers/dma/dma-axi-dmac.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> index 7f0b9aa15867..eb289aa187dd 100644
> --- a/drivers/dma/dma-axi-dmac.c
> +++ b/drivers/dma/dma-axi-dmac.c
> @@ -220,9 +220,11 @@ static void axi_dmac_start_transfer(struct axi_dmac_chan *chan)
>  
>  	/*
>  	 * If the hardware supports cyclic transfers and there is no callback to
> -	 * call, enable hw cyclic mode to avoid unnecessary interrupts.
> +	 * call and only a single segment, enable hw cyclic mode to avoid
> +	 * unnecessary interrupts.
>  	 */
> -	if (chan->hw_cyclic && desc->cyclic && !desc->vdesc.tx.callback)
> +	if (chan->hw_cyclic && desc->cyclic && !desc->vdesc.tx.callback &&
> +		desc->num_sgs == 1)
>  		flags |= AXI_DMAC_FLAG_CYCLIC;
>  
>  	axi_dmac_write(dmac, AXI_DMAC_REG_X_LENGTH, sg->x_len - 1);
> 

--
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 Koul Sept. 8, 2017, 4:23 a.m. UTC | #2
On Tue, Sep 05, 2017 at 10:20:50AM +0200, Lars-Peter Clausen wrote:
> I screwed up, the subject prefix should of course be "dmaengine" and not
> "dma". Vinod can you fix this up, or should I resend?

Will fix up..

> 
> On 09/05/2017 10:16 AM, Lars-Peter Clausen wrote:
> > In hardware cyclic mode the submitted segment is repeated. This means
> > hardware cyclic mode can only be used if the transfer has a single segment.
> > 
> > Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> > ---
> >  drivers/dma/dma-axi-dmac.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> > index 7f0b9aa15867..eb289aa187dd 100644
> > --- a/drivers/dma/dma-axi-dmac.c
> > +++ b/drivers/dma/dma-axi-dmac.c
> > @@ -220,9 +220,11 @@ static void axi_dmac_start_transfer(struct axi_dmac_chan *chan)
> >  
> >  	/*
> >  	 * If the hardware supports cyclic transfers and there is no callback to
> > -	 * call, enable hw cyclic mode to avoid unnecessary interrupts.
> > +	 * call and only a single segment, enable hw cyclic mode to avoid
> > +	 * unnecessary interrupts.
> >  	 */
> > -	if (chan->hw_cyclic && desc->cyclic && !desc->vdesc.tx.callback)
> > +	if (chan->hw_cyclic && desc->cyclic && !desc->vdesc.tx.callback &&
> > +		desc->num_sgs == 1)
> >  		flags |= AXI_DMAC_FLAG_CYCLIC;
> >  
> >  	axi_dmac_write(dmac, AXI_DMAC_REG_X_LENGTH, sg->x_len - 1);
> > 
>
Vinod Koul Sept. 8, 2017, 12:55 p.m. UTC | #3
On Tue, Sep 05, 2017 at 10:16:37AM +0200, Lars-Peter Clausen wrote:
> In hardware cyclic mode the submitted segment is repeated. This means
> hardware cyclic mode can only be used if the transfer has a single segment.

Applied both, thanks
diff mbox

Patch

diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index 7f0b9aa15867..eb289aa187dd 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -220,9 +220,11 @@  static void axi_dmac_start_transfer(struct axi_dmac_chan *chan)
 
 	/*
 	 * If the hardware supports cyclic transfers and there is no callback to
-	 * call, enable hw cyclic mode to avoid unnecessary interrupts.
+	 * call and only a single segment, enable hw cyclic mode to avoid
+	 * unnecessary interrupts.
 	 */
-	if (chan->hw_cyclic && desc->cyclic && !desc->vdesc.tx.callback)
+	if (chan->hw_cyclic && desc->cyclic && !desc->vdesc.tx.callback &&
+		desc->num_sgs == 1)
 		flags |= AXI_DMAC_FLAG_CYCLIC;
 
 	axi_dmac_write(dmac, AXI_DMAC_REG_X_LENGTH, sg->x_len - 1);