All of lore.kernel.org
 help / color / mirror / Atom feed
From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: edma: special case slot limit workaround
Date: Fri, 16 Oct 2015 14:21:23 +0300	[thread overview]
Message-ID: <5620DDB3.9050300@ti.com> (raw)
In-Reply-To: <87a8rjt7p9.fsf_-_@linutronix.de>

On 10/16/2015 01:43 PM, John Ogness wrote:
> Currently drivers are limited to 19 slots for cyclic transfers.
> However, if the DMA burst size is the same as the period size,
> the period size can be changed to the full buffer size and
> intermediate interrupts activated. Since intermediate interrupts
> will trigger for each burst and the burst size is the same as
> the period size, the driver will get interrupts each period as
> expected. This has the benefit of allowing the functionality of
> many more slots, but only uses 2 slots.
> 
> This workaround is only active if more than 19 slots are needed
> and the burst size matches the period size.

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> ---
>  v1-v2 changes
>  . rebased for next-20151016
> 
>  drivers/dma/edma.c |   25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 7eefbf1..f846935 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -1364,6 +1364,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
>  	struct edma_desc *edesc;
>  	dma_addr_t src_addr, dst_addr;
>  	enum dma_slave_buswidth dev_width;
> +	bool use_intermediate = false;
>  	u32 burst;
>  	int i, ret, nslots;
>  
> @@ -1405,8 +1406,21 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
>  	 * but the synchronization is difficult to achieve with Cyclic and
>  	 * cannot be guaranteed, so we error out early.
>  	 */
> -	if (nslots > MAX_NR_SG)
> -		return NULL;
> +	if (nslots > MAX_NR_SG) {
> +		/*
> +		 * If the burst and period sizes are the same, we can put
> +		 * the full buffer into a single period and activate
> +		 * intermediate interrupts. This will produce interrupts
> +		 * after each burst, which is also after each desired period.
> +		 */
> +		if (burst == period_len) {
> +			period_len = buf_len;
> +			nslots = 2;
> +			use_intermediate = true;
> +		} else {
> +			return NULL;
> +		}
> +	}
>  
>  	edesc = kzalloc(sizeof(*edesc) + nslots * sizeof(edesc->pset[0]),
>  			GFP_ATOMIC);
> @@ -1484,8 +1498,13 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
>  		/*
>  		 * Enable period interrupt only if it is requested
>  		 */
> -		if (tx_flags & DMA_PREP_INTERRUPT)
> +		if (tx_flags & DMA_PREP_INTERRUPT) {
>  			edesc->pset[i].param.opt |= TCINTEN;
> +
> +			/* Also enable intermediate interrupts if necessary */
> +			if (use_intermediate)
> +				edesc->pset[i].param.opt |= ITCINTEN;
> +		}
>  	}
>  
>  	/* Place the cyclic channel to highest priority queue */
> 


-- 
P?ter

WARNING: multiple messages have this Message-ID (diff)
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: John Ogness <john.ogness@linutronix.de>, <vinod.koul@intel.com>
Cc: <linux-kernel@vger.kernel.org>, <dmaengine@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <nsekhar@ti.com>
Subject: Re: [PATCH v2] ARM: edma: special case slot limit workaround
Date: Fri, 16 Oct 2015 14:21:23 +0300	[thread overview]
Message-ID: <5620DDB3.9050300@ti.com> (raw)
In-Reply-To: <87a8rjt7p9.fsf_-_@linutronix.de>

On 10/16/2015 01:43 PM, John Ogness wrote:
> Currently drivers are limited to 19 slots for cyclic transfers.
> However, if the DMA burst size is the same as the period size,
> the period size can be changed to the full buffer size and
> intermediate interrupts activated. Since intermediate interrupts
> will trigger for each burst and the burst size is the same as
> the period size, the driver will get interrupts each period as
> expected. This has the benefit of allowing the functionality of
> many more slots, but only uses 2 slots.
> 
> This workaround is only active if more than 19 slots are needed
> and the burst size matches the period size.

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> ---
>  v1-v2 changes
>  . rebased for next-20151016
> 
>  drivers/dma/edma.c |   25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 7eefbf1..f846935 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -1364,6 +1364,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
>  	struct edma_desc *edesc;
>  	dma_addr_t src_addr, dst_addr;
>  	enum dma_slave_buswidth dev_width;
> +	bool use_intermediate = false;
>  	u32 burst;
>  	int i, ret, nslots;
>  
> @@ -1405,8 +1406,21 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
>  	 * but the synchronization is difficult to achieve with Cyclic and
>  	 * cannot be guaranteed, so we error out early.
>  	 */
> -	if (nslots > MAX_NR_SG)
> -		return NULL;
> +	if (nslots > MAX_NR_SG) {
> +		/*
> +		 * If the burst and period sizes are the same, we can put
> +		 * the full buffer into a single period and activate
> +		 * intermediate interrupts. This will produce interrupts
> +		 * after each burst, which is also after each desired period.
> +		 */
> +		if (burst == period_len) {
> +			period_len = buf_len;
> +			nslots = 2;
> +			use_intermediate = true;
> +		} else {
> +			return NULL;
> +		}
> +	}
>  
>  	edesc = kzalloc(sizeof(*edesc) + nslots * sizeof(edesc->pset[0]),
>  			GFP_ATOMIC);
> @@ -1484,8 +1498,13 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
>  		/*
>  		 * Enable period interrupt only if it is requested
>  		 */
> -		if (tx_flags & DMA_PREP_INTERRUPT)
> +		if (tx_flags & DMA_PREP_INTERRUPT) {
>  			edesc->pset[i].param.opt |= TCINTEN;
> +
> +			/* Also enable intermediate interrupts if necessary */
> +			if (use_intermediate)
> +				edesc->pset[i].param.opt |= ITCINTEN;
> +		}
>  	}
>  
>  	/* Place the cyclic channel to highest priority queue */
> 


-- 
Péter

  reply	other threads:[~2015-10-16 11:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 10:48 [PATCH] ARM: edma: special case slot limit workaround John Ogness
2015-10-15 10:48 ` John Ogness
2015-10-15 11:05 ` Peter Ujfalusi
2015-10-15 11:05   ` Peter Ujfalusi
2015-10-16 10:43   ` [PATCH v2] " John Ogness
2015-10-16 10:43     ` John Ogness
2015-10-16 11:21     ` Peter Ujfalusi [this message]
2015-10-16 11:21       ` Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5620DDB3.9050300@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.