2021-01-28 08:58:50

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH v3 0/4] dmaengine: rcar-dmac: Add support for R-Car V3U

Hi Vinod,

This patch series adds support for the Direct Memory Access Controller
variant in the Renesas R-Car V3U (R8A779A0) SoC, to both DT bindings and
driver.

Changes compared to v2:
- Add Reviewed-by, Tested-by,
- Place iterator after container being iterated,
- Stop passing index to rcar_dmac_chan_probe().

Changes compared to v1:
- Add Reviewed-by,
- Put the full loop control of for_each_rcar_dmac_chan() on a single
line, to improve readability,
- Use two separate named regions instead of array,
- Drop rcar_dmac_of_data.chan_reg_block, check for
!rcar_dmac_of_data.chan_offset_base instead,
- Precalculate chan_base in rcar_dmac_probe().

This has been tested on the Renesas Falcon board, using external SPI
loopback (spi-loopback-test) on MSIOF1 and MSIOF2.

Thanks!

Geert Uytterhoeven (4):
dt-bindings: renesas,rcar-dmac: Add r8a779a0 support
dmaengine: rcar-dmac: Add for_each_rcar_dmac_chan() helper
dmaengine: rcar-dmac: Add helpers for clearing DMA channel status
dmaengine: rcar-dmac: Add support for R-Car V3U

.../bindings/dma/renesas,rcar-dmac.yaml | 76 +++++++-----
drivers/dma/sh/rcar-dmac.c | 112 ++++++++++++------
2 files changed, 126 insertions(+), 62 deletions(-)

--
2.25.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2021-01-28 08:59:16

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH v3 2/4] dmaengine: rcar-dmac: Add for_each_rcar_dmac_chan() helper

Add a helper macro for iterating over all DMAC channels, taking into
account the channel mask. Use it where appropriate, to simplify code.

Restore "reverse Christmas tree" order of local variables while adding a
new variable.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Wolfram Sang <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Tested-by: Wolfram Sang <[email protected]>
---
v3:
- Add Reviewed-by, Tested-by,
- Place iterator after container being iterated,

v2:
- Put the full loop control of for_each_rcar_dmac_chan() on a single
line, to improve readability.
---
drivers/dma/sh/rcar-dmac.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 4524718d4f90920e..83c9a5bd1077db3a 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -209,6 +209,10 @@ struct rcar_dmac {

#define to_rcar_dmac(d) container_of(d, struct rcar_dmac, engine)

+#define for_each_rcar_dmac_chan(i, dmac, chan) \
+ for (i = 0, chan = &(dmac)->channels[0]; i < (dmac)->n_channels; i++, chan++) \
+ if (!((dmac)->channels_mask & BIT(i))) continue; else
+
/*
* struct rcar_dmac_of_data - This driver's OF data
* @chan_offset_base: DMAC channels base offset
@@ -817,15 +821,11 @@ static void rcar_dmac_chan_reinit(struct rcar_dmac_chan *chan)

static void rcar_dmac_stop_all_chan(struct rcar_dmac *dmac)
{
+ struct rcar_dmac_chan *chan;
unsigned int i;

/* Stop all channels. */
- for (i = 0; i < dmac->n_channels; ++i) {
- struct rcar_dmac_chan *chan = &dmac->channels[i];
-
- if (!(dmac->channels_mask & BIT(i)))
- continue;
-
+ for_each_rcar_dmac_chan(i, dmac, chan) {
/* Stop and reinitialize the channel. */
spin_lock_irq(&chan->lock);
rcar_dmac_chan_halt(chan);
@@ -1828,9 +1828,10 @@ static int rcar_dmac_probe(struct platform_device *pdev)
DMA_SLAVE_BUSWIDTH_2_BYTES | DMA_SLAVE_BUSWIDTH_4_BYTES |
DMA_SLAVE_BUSWIDTH_8_BYTES | DMA_SLAVE_BUSWIDTH_16_BYTES |
DMA_SLAVE_BUSWIDTH_32_BYTES | DMA_SLAVE_BUSWIDTH_64_BYTES;
+ const struct rcar_dmac_of_data *data;
+ struct rcar_dmac_chan *chan;
struct dma_device *engine;
struct rcar_dmac *dmac;
- const struct rcar_dmac_of_data *data;
unsigned int i;
int ret;

@@ -1916,11 +1917,8 @@ static int rcar_dmac_probe(struct platform_device *pdev)

INIT_LIST_HEAD(&engine->channels);

- for (i = 0; i < dmac->n_channels; ++i) {
- if (!(dmac->channels_mask & BIT(i)))
- continue;
-
- ret = rcar_dmac_chan_probe(dmac, &dmac->channels[i], data, i);
+ for_each_rcar_dmac_chan(i, dmac, chan) {
+ ret = rcar_dmac_chan_probe(dmac, chan, data, i);
if (ret < 0)
goto error;
}
--
2.25.1

2021-02-01 06:03:35

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] dmaengine: rcar-dmac: Add support for R-Car V3U

On 28-01-21, 09:44, Geert Uytterhoeven wrote:
> Hi Vinod,
>
> This patch series adds support for the Direct Memory Access Controller
> variant in the Renesas R-Car V3U (R8A779A0) SoC, to both DT bindings and
> driver.

Applied all, thanks
--
~Vinod