diff mbox

[4/5] dmaengine: sun6i: Set default values to burst and bus width

Message ID 7f5fc4733c8145fe146bd2a7e0d8febfddf2fe6b.1457606136.git.moinejf@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Jean-Francois Moine March 10, 2016, 10:07 a.m. UTC
When defining the DMA transfer, the sound PCM DMA engine sets only
the burst and bus width values on the DMA side.
This was making the audio transfers to be rejected because of invalid
values on the memory side.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
 drivers/dma/sun6i-dma.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

Comments

Vinod Koul March 11, 2016, 6:47 a.m. UTC | #1
On Thu, Mar 10, 2016 at 11:07:53AM +0100, Jean-Francois Moine wrote:
> When defining the DMA transfer, the sound PCM DMA engine sets only
> the burst and bus width values on the DMA side.
> This was making the audio transfers to be rejected because of invalid
> values on the memory side.

I think there is a misunderstanding of the API. The slave configuration set
thru dma_slave_config is only intended for peripheral and not for memory.

In memory case you need to assume values based on system. DMA to memory is
usually done for max throughput and these parameters do not make sense
there.


> 
> Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
> ---
>  drivers/dma/sun6i-dma.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> index 7c98c0d..c27d572 100644
> --- a/drivers/dma/sun6i-dma.c
> +++ b/drivers/dma/sun6i-dma.c
> @@ -288,19 +288,31 @@ static inline int sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli,
>  	if (!config)
>  		return -EINVAL;
>  
> -	src_burst = convert_burst(config->src_maxburst);
> +	if (config->src_maxburst == 0)
> +		src_burst = convert_burst(config->dst_maxburst);
> +	else
> +		src_burst = convert_burst(config->src_maxburst);

No 0 is error for the transfer direction and don't assume default for
peripheral, that is just wrong
diff mbox

Patch

diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index 7c98c0d..c27d572 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -288,19 +288,31 @@  static inline int sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli,
 	if (!config)
 		return -EINVAL;
 
-	src_burst = convert_burst(config->src_maxburst);
+	if (config->src_maxburst == 0)
+		src_burst = convert_burst(config->dst_maxburst);
+	else
+		src_burst = convert_burst(config->src_maxburst);
 	if (src_burst < 0)
 		return src_burst;
 
-	dst_burst = convert_burst(config->dst_maxburst);
+	if (config->dst_maxburst == 0)
+		dst_burst = convert_burst(config->src_maxburst);
+	else
+		dst_burst = convert_burst(config->dst_maxburst);
 	if (dst_burst < 0)
 		return dst_burst;
 
-	src_width = convert_buswidth(config->src_addr_width);
+	if (config->src_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
+		src_width = convert_buswidth(config->dst_addr_width);
+	else
+		src_width = convert_buswidth(config->src_addr_width);
 	if (src_width < 0)
 		return src_width;
 
-	dst_width = convert_buswidth(config->dst_addr_width);
+	if (config->dst_addr_width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
+		dst_width = convert_buswidth(config->src_addr_width);
+	else
+		dst_width = convert_buswidth(config->dst_addr_width);
 	if (dst_width < 0)
 		return dst_width;