DMA Engine development
 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

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