diff mbox series

[1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction

Message ID 20220307191211.12087-1-biju.das.jz@bp.renesas.com (mailing list archive)
State Changes Requested
Headers show
Series [1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction | expand

Commit Message

Biju Das March 7, 2022, 7:12 p.m. UTC
This patch sets DMA transfer size for source/destination based on the
DMA transfer direction in rz_dmac_config() as the client drivers sets
this parameters based on DMA transfer direction.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/dma/sh/rz-dmac.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

Comments

Biju Das March 16, 2022, 2:27 p.m. UTC | #1
Hi Vinod,

Gentle ping. Are you happy with this patch?

Cheers,
Biju

> Subject: [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for
> src/dst based on the transfer direction
> 
> This patch sets DMA transfer size for source/destination based on the DMA
> transfer direction in rz_dmac_config() as the client drivers sets this
> parameters based on DMA transfer direction.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/dma/sh/rz-dmac.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index
> ee2872e7d64c..52d82f67d3dd 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -604,17 +604,19 @@ static int rz_dmac_config(struct dma_chan *chan,
>  	channel->dst_per_address = config->dst_addr;
>  	channel->dst_word_size = config->dst_addr_width;
> 
> -	val = rz_dmac_ds_to_val_mapping(config->dst_addr_width);
> -	if (val == CHCFG_DS_INVALID)
> -		return -EINVAL;
> -
> -	channel->chcfg |= CHCFG_FILL_DDS(val);
> +	if (config->direction == DMA_DEV_TO_MEM) {
> +		val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
> +		if (val == CHCFG_DS_INVALID)
> +			return -EINVAL;
> 
> -	val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
> -	if (val == CHCFG_DS_INVALID)
> -		return -EINVAL;
> +		channel->chcfg |= CHCFG_FILL_SDS(val);
> +	} else {
> +		val = rz_dmac_ds_to_val_mapping(config->dst_addr_width);
> +		if (val == CHCFG_DS_INVALID)
> +			return -EINVAL;
> 
> -	channel->chcfg |= CHCFG_FILL_SDS(val);
> +		channel->chcfg |= CHCFG_FILL_DDS(val);
> +	}
> 
>  	return 0;
>  }
> --
> 2.17.1
Dan Carpenter March 16, 2022, 2:35 p.m. UTC | #2
On Wed, Mar 16, 2022 at 02:27:01PM +0000, Biju Das wrote:
> Hi Vinod,
> 
> Gentle ping. Are you happy with this patch?

It's only been a week.  Please wait at least two weeks before asking
about a patch.

regards,
dan carpenter
Biju Das March 16, 2022, 2:40 p.m. UTC | #3
Hi Dan Carpenter,

> Subject: Re: [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for
> src/dst based on the transfer direction
> 
> On Wed, Mar 16, 2022 at 02:27:01PM +0000, Biju Das wrote:
> > Hi Vinod,
> >
> > Gentle ping. Are you happy with this patch?
> 
> It's only been a week.  Please wait at least two weeks before asking about
> a patch.

Thanks. Will take care next time.

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index ee2872e7d64c..52d82f67d3dd 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -604,17 +604,19 @@  static int rz_dmac_config(struct dma_chan *chan,
 	channel->dst_per_address = config->dst_addr;
 	channel->dst_word_size = config->dst_addr_width;
 
-	val = rz_dmac_ds_to_val_mapping(config->dst_addr_width);
-	if (val == CHCFG_DS_INVALID)
-		return -EINVAL;
-
-	channel->chcfg |= CHCFG_FILL_DDS(val);
+	if (config->direction == DMA_DEV_TO_MEM) {
+		val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
+		if (val == CHCFG_DS_INVALID)
+			return -EINVAL;
 
-	val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
-	if (val == CHCFG_DS_INVALID)
-		return -EINVAL;
+		channel->chcfg |= CHCFG_FILL_SDS(val);
+	} else {
+		val = rz_dmac_ds_to_val_mapping(config->dst_addr_width);
+		if (val == CHCFG_DS_INVALID)
+			return -EINVAL;
 
-	channel->chcfg |= CHCFG_FILL_SDS(val);
+		channel->chcfg |= CHCFG_FILL_DDS(val);
+	}
 
 	return 0;
 }