linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: vinod.koul@intel.com (Vinod Koul)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 2/3] dmaengine: sun6i: Set default maxburst size and bus width
Date: Tue, 26 Apr 2016 09:15:54 +0530	[thread overview]
Message-ID: <20160426034554.GF2274@localhost> (raw)
In-Reply-To: <b862c3ac7d268e08c3052e245df4c3024f12d7f5.1461307982.git.moinejf@free.fr>

On Fri, Apr 22, 2016 at 08:48:40AM +0200, Jean-Francois Moine wrote:
> Some DMA clients, as audio, don't set the maxburst size and bus width
> on the memory side when starting DMA transfers.
> This patch prevents such transfers to be aborted by providing system
> default values to the lacking ones.
> 
> Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
> ---
>  drivers/dma/sun6i-dma.c | 23 +++++++++++++++++++----
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> index b08245e..821fc4f 100644
> --- a/drivers/dma/sun6i-dma.c
> +++ b/drivers/dma/sun6i-dma.c
> @@ -470,10 +470,25 @@ static int set_config(struct sun6i_dma_dev *sdev,
>  {
>  	s8 src_width, dst_width, src_burst, dst_burst;
>  
> -	src_burst = convert_burst(sconfig->src_maxburst);
> -	src_width = convert_buswidth(sconfig->src_addr_width);
> -	dst_burst = convert_burst(sconfig->dst_maxburst);
> -	dst_width = convert_buswidth(sconfig->dst_addr_width);
> +	if (direction == DMA_MEM_TO_DEV) {
> +		src_burst = convert_burst(sconfig->src_maxburst ?
> +					sconfig->src_maxburst : 8);
> +		src_width = convert_buswidth(sconfig->src_addr_width !=
> +						DMA_SLAVE_BUSWIDTH_UNDEFINED ?
> +				sconfig->src_addr_width :
> +				DMA_SLAVE_BUSWIDTH_4_BYTES);
> +		dst_burst = convert_burst(sconfig->dst_maxburst);
> +		dst_width = convert_buswidth(sconfig->dst_addr_width);
> +	} else {	/* DMA_DEV_TO_MEM */

Else can be any other direction, I would prefer we check that. Also swicth
would be better

> +		src_burst = convert_burst(sconfig->src_maxburst);
> +		src_width = convert_buswidth(sconfig->src_addr_width);
> +		dst_burst = convert_burst(sconfig->dst_maxburst ?
> +					sconfig->dst_maxburst : 8);
> +		dst_width = convert_buswidth(sconfig->dst_addr_width !=
> +						DMA_SLAVE_BUSWIDTH_UNDEFINED ?
> +				sconfig->dst_addr_width :
> +				DMA_SLAVE_BUSWIDTH_4_BYTES);
> +	}
>  
>  	if (src_burst < 0)
>  		return src_burst;

-- 
~Vinod

  reply	other threads:[~2016-04-26  3:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22  6:53 [PATCH v5 0/3] dmaengine: sun6i: Upgrade for audio transfers Jean-Francois Moine
2016-04-22  6:47 ` [PATCH v5 1/3] dmaengine: sun6i: Simplify lli setting Jean-Francois Moine
2016-04-26  3:49   ` Vinod Koul
2016-04-22  6:48 ` [PATCH v5 2/3] dmaengine: sun6i: Set default maxburst size and bus width Jean-Francois Moine
2016-04-26  3:45   ` Vinod Koul [this message]
2016-04-22  6:49 ` [PATCH v5 3/3] dmaengine: sun6i: Add cyclic capability Jean-Francois Moine
2016-04-26  3:48   ` Vinod Koul

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=20160426034554.GF2274@localhost \
    --to=vinod.koul@intel.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 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).