dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction
@ 2022-03-07 19:12 Biju Das
  2022-03-07 19:12 ` [PATCH 2/2] dmaengine: sh: rz-dmac: Fix dma_set_max_seg_size Biju Das
  2022-03-16 14:27 ` [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction Biju Das
  0 siblings, 2 replies; 6+ messages in thread
From: Biju Das @ 2022-03-07 19:12 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Biju Das, Lad Prabhakar, Colin Ian King, Dan Carpenter,
	dmaengine, Geert Uytterhoeven, Chris Paterson, Biju Das,
	linux-renesas-soc

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] dmaengine: sh: rz-dmac: Fix dma_set_max_seg_size
  2022-03-07 19:12 [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction Biju Das
@ 2022-03-07 19:12 ` Biju Das
  2022-03-08  4:49   ` Biju Das
  2022-03-16 14:27 ` [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction Biju Das
  1 sibling, 1 reply; 6+ messages in thread
From: Biju Das @ 2022-03-07 19:12 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Biju Das, Lad Prabhakar, Colin Ian King, Geert Uytterhoeven,
	Dan Carpenter, dmaengine, Chris Paterson, Biju Das,
	linux-renesas-soc

As per Hardware manual, maximum transfer count is  2^32 − 1 bytes.
This patch fixes this issue by replacing 'U32_MAX'->'U32_MAX - 1'.

Fixes: 5000d37042a61ca55 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC")
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index 52d82f67d3dd..b35bea56e475 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -913,7 +913,7 @@ static int rz_dmac_probe(struct platform_device *pdev)
 	engine->device_issue_pending = rz_dmac_issue_pending;
 
 	engine->copy_align = DMAENGINE_ALIGN_1_BYTE;
-	dma_set_max_seg_size(engine->dev, U32_MAX);
+	dma_set_max_seg_size(engine->dev, U32_MAX - 1);
 
 	ret = dma_async_device_register(engine);
 	if (ret < 0) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/2] dmaengine: sh: rz-dmac: Fix dma_set_max_seg_size
  2022-03-07 19:12 ` [PATCH 2/2] dmaengine: sh: rz-dmac: Fix dma_set_max_seg_size Biju Das
@ 2022-03-08  4:49   ` Biju Das
  0 siblings, 0 replies; 6+ messages in thread
From: Biju Das @ 2022-03-08  4:49 UTC (permalink / raw)
  To: Biju Das, Vinod Koul
  Cc: Prabhakar Mahadev Lad, Colin Ian King, Geert Uytterhoeven,
	Dan Carpenter, dmaengine, Chris Paterson, Biju Das,
	linux-renesas-soc


Hi All,

Oops. I would like to drop this patch as 2^32 − 1 = 'U32_MAX'.

Sorry for the noise.

Regards,
Biju

> Subject: [PATCH 2/2] dmaengine: sh: rz-dmac: Fix dma_set_max_seg_size
> 
> As per Hardware manual, maximum transfer count is  2^32 − 1 bytes.
> This patch fixes this issue by replacing 'U32_MAX'->'U32_MAX - 1'.
> 
> Fixes: 5000d37042a61ca55 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC")
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index
> 52d82f67d3dd..b35bea56e475 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -913,7 +913,7 @@ static int rz_dmac_probe(struct platform_device *pdev)
>  	engine->device_issue_pending = rz_dmac_issue_pending;
> 
>  	engine->copy_align = DMAENGINE_ALIGN_1_BYTE;
> -	dma_set_max_seg_size(engine->dev, U32_MAX);
> +	dma_set_max_seg_size(engine->dev, U32_MAX - 1);
> 
>  	ret = dma_async_device_register(engine);
>  	if (ret < 0) {
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction
  2022-03-07 19:12 [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction Biju Das
  2022-03-07 19:12 ` [PATCH 2/2] dmaengine: sh: rz-dmac: Fix dma_set_max_seg_size Biju Das
@ 2022-03-16 14:27 ` Biju Das
  2022-03-16 14:35   ` Dan Carpenter
  1 sibling, 1 reply; 6+ messages in thread
From: Biju Das @ 2022-03-16 14:27 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Prabhakar Mahadev Lad, Colin Ian King, Dan Carpenter, dmaengine,
	Geert Uytterhoeven, Chris Paterson, Biju Das, linux-renesas-soc

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction
  2022-03-16 14:27 ` [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction Biju Das
@ 2022-03-16 14:35   ` Dan Carpenter
  2022-03-16 14:40     ` Biju Das
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2022-03-16 14:35 UTC (permalink / raw)
  To: Biju Das
  Cc: Vinod Koul, Prabhakar Mahadev Lad, Colin Ian King, dmaengine,
	Geert Uytterhoeven, Chris Paterson, Biju Das, linux-renesas-soc

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction
  2022-03-16 14:35   ` Dan Carpenter
@ 2022-03-16 14:40     ` Biju Das
  0 siblings, 0 replies; 6+ messages in thread
From: Biju Das @ 2022-03-16 14:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Vinod Koul, Prabhakar Mahadev Lad, Colin Ian King, dmaengine,
	Geert Uytterhoeven, Chris Paterson, Biju Das, linux-renesas-soc

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-16 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 19:12 [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction Biju Das
2022-03-07 19:12 ` [PATCH 2/2] dmaengine: sh: rz-dmac: Fix dma_set_max_seg_size Biju Das
2022-03-08  4:49   ` Biju Das
2022-03-16 14:27 ` [PATCH 1/2] dmaengine: sh: rz-dmac: Set DMA transfer size for src/dst based on the transfer direction Biju Das
2022-03-16 14:35   ` Dan Carpenter
2022-03-16 14:40     ` Biju Das

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).