* [PATCH v2] dmaengine: sh: rz-dmac: Set DMA transfer parameters based on the direction
@ 2022-04-09 16:53 Biju Das
2022-04-11 10:55 ` Vinod Koul
0 siblings, 1 reply; 4+ messages in thread
From: Biju Das @ 2022-04-09 16:53 UTC (permalink / raw)
To: Vinod Koul
Cc: Biju Das, Colin Ian King, Lad Prabhakar, Geert Uytterhoeven,
Dan Carpenter, dmaengine, Chris Paterson, Biju Das,
linux-renesas-soc
Client drivers configure DMA transfer parameters based on the DMA
transfer direction.
This patch sets corresponding parameters in rz_dmac_config() based
on the 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>
---
v1->v2:
* Updated commit description
---
drivers/dma/sh/rz-dmac.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index ee2872e7d64c..de57ae006879 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -597,24 +597,24 @@ static int rz_dmac_config(struct dma_chan *chan,
struct dma_slave_config *config)
{
struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
- u32 val;
+ u32 val, data_sz;
- channel->src_per_address = config->src_addr;
- channel->src_word_size = config->src_addr_width;
- 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) {
+ channel->src_per_address = config->src_addr;
+ channel->src_word_size = config->src_addr_width;
+ val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
+ data_sz = CHCFG_FILL_SDS(val);
+ } else {
+ 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);
+ data_sz = CHCFG_FILL_DDS(val);
+ }
- val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
if (val == CHCFG_DS_INVALID)
return -EINVAL;
- channel->chcfg |= CHCFG_FILL_SDS(val);
+ channel->chcfg |= data_sz;
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] dmaengine: sh: rz-dmac: Set DMA transfer parameters based on the direction
2022-04-09 16:53 [PATCH v2] dmaengine: sh: rz-dmac: Set DMA transfer parameters based on the direction Biju Das
@ 2022-04-11 10:55 ` Vinod Koul
2022-04-11 11:06 ` Biju Das
0 siblings, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2022-04-11 10:55 UTC (permalink / raw)
To: Biju Das
Cc: Colin Ian King, Lad Prabhakar, Geert Uytterhoeven, Dan Carpenter,
dmaengine, Chris Paterson, Biju Das, linux-renesas-soc
On 09-04-22, 17:53, Biju Das wrote:
> Client drivers configure DMA transfer parameters based on the DMA
> transfer direction.
>
> This patch sets corresponding parameters in rz_dmac_config() based
> on the 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>
> ---
> v1->v2:
> * Updated commit description
> ---
> drivers/dma/sh/rz-dmac.c | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
> index ee2872e7d64c..de57ae006879 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -597,24 +597,24 @@ static int rz_dmac_config(struct dma_chan *chan,
> struct dma_slave_config *config)
> {
> struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> - u32 val;
> + u32 val, data_sz;
>
> - channel->src_per_address = config->src_addr;
> - channel->src_word_size = config->src_addr_width;
> - 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) {
This is a deprecated field, pls do not use this...
Above code is correct and then based on direction of the descriptor you
would use either src or dstn parameters
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [PATCH v2] dmaengine: sh: rz-dmac: Set DMA transfer parameters based on the direction
2022-04-11 10:55 ` Vinod Koul
@ 2022-04-11 11:06 ` Biju Das
2022-04-11 11:26 ` Vinod Koul
0 siblings, 1 reply; 4+ messages in thread
From: Biju Das @ 2022-04-11 11:06 UTC (permalink / raw)
To: Vinod Koul
Cc: Colin Ian King, Prabhakar Mahadev Lad, Geert Uytterhoeven,
Dan Carpenter, dmaengine@vger.kernel.org, Chris Paterson,
Biju Das, linux-renesas-soc@vger.kernel.org
Hi Vinod,
Thanks for the feedback.
> Subject: Re: [PATCH v2] dmaengine: sh: rz-dmac: Set DMA transfer
> parameters based on the direction
>
> On 09-04-22, 17:53, Biju Das wrote:
> > Client drivers configure DMA transfer parameters based on the DMA
> > transfer direction.
> >
> > This patch sets corresponding parameters in rz_dmac_config() based on
> > the 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>
> > ---
> > v1->v2:
> > * Updated commit description
> > ---
> > drivers/dma/sh/rz-dmac.c | 26 +++++++++++++-------------
> > 1 file changed, 13 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index
> > ee2872e7d64c..de57ae006879 100644
> > --- a/drivers/dma/sh/rz-dmac.c
> > +++ b/drivers/dma/sh/rz-dmac.c
> > @@ -597,24 +597,24 @@ static int rz_dmac_config(struct dma_chan *chan,
> > struct dma_slave_config *config) {
> > struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> > - u32 val;
> > + u32 val, data_sz;
> >
> > - channel->src_per_address = config->src_addr;
> > - channel->src_word_size = config->src_addr_width;
> > - 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) {
>
> This is a deprecated field, pls do not use this...
>
> Above code is correct and then based on direction of the descriptor you
> would use either src or dstn parameters
OK, I get -EINVAL because of [1] as client driver is filling
{src,dst}_addr_width based on direction.
Maybe I should remove the check from this function or
Fix [1], as it is deprecated?? Please share your views on this.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/spi/spi-rspi.c?h=v5.18-rc2#n1112
Regards,
Biju
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] dmaengine: sh: rz-dmac: Set DMA transfer parameters based on the direction
2022-04-11 11:06 ` Biju Das
@ 2022-04-11 11:26 ` Vinod Koul
0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2022-04-11 11:26 UTC (permalink / raw)
To: Biju Das
Cc: Colin Ian King, Prabhakar Mahadev Lad, Geert Uytterhoeven,
Dan Carpenter, dmaengine@vger.kernel.org, Chris Paterson,
Biju Das, linux-renesas-soc@vger.kernel.org
On 11-04-22, 11:06, Biju Das wrote:
> > This is a deprecated field, pls do not use this...
> >
> > Above code is correct and then based on direction of the descriptor you
> > would use either src or dstn parameters
>
> OK, I get -EINVAL because of [1] as client driver is filling
> {src,dst}_addr_width based on direction.
>
> Maybe I should remove the check from this function or
> Fix [1], as it is deprecated?? Please share your views on this.
Yes please fix it, we need to remove users of direction
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-11 11:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-09 16:53 [PATCH v2] dmaengine: sh: rz-dmac: Set DMA transfer parameters based on the direction Biju Das
2022-04-11 10:55 ` Vinod Koul
2022-04-11 11:06 ` Biju Das
2022-04-11 11:26 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox