Re: [PATCH v2 2/6] dmaengine: sh: rz_dmac: make register_dma_req() chip-specific

From: Geert Uytterhoeven

Date: Tue Dec 23 2025 - 08:45:33 EST


Hi Cosmin,

On Mon, 1 Dec 2025 at 13:52, Cosmin Tanislav
<cosmin-gabriel.tanislav.xa@xxxxxxxxxxx> wrote:
> The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs use a
> completely different ICU unit compared to RZ/V2H, which requires a
> separate implementation.
>
> To prepare for adding support for these SoCs, add a chip-specific
> structure and put a pointer to the rzv2h_icu_register_dma_req() function
> in the .register_dma_req field of the chip-specific structure to allow
> for other implementations. Do the same for the default request value,
> RZV2H_ICU_DMAC_REQ_NO_DEFAULT.
>
> While at it, factor out the logic that calls .register_dma_req() or
> rz_dmac_set_dmars_register() into a separate function to remove some
> code duplication. Since the default values are different between the
> two, use -1 for designating that the default value should be used.
>
> Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@xxxxxxxxxxx>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

You can find a few non-functional nits below...

> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -95,9 +95,16 @@ struct rz_dmac_icu {
> u8 dmac_index;
> };
>
> +struct rz_dmac_info {
> + void (*register_dma_req)(struct platform_device *icu_dev, u8 dmac_index,
> + u8 dmac_channel, u16 req_no);

icu_register_dma_req, to make clear this is ICU-specific?

> + u16 dma_req_no_default;

default_dma_req_no, to avoid confusion between literal "no" and an
abbreviation of "number"?

> +};
> +

> @@ -1067,9 +1068,18 @@ static void rz_dmac_remove(struct platform_device *pdev)
> pm_runtime_disable(&pdev->dev);
> }
>
> +static const struct rz_dmac_info rz_dmac_v2h_info = {
> + .register_dma_req = rzv2h_icu_register_dma_req,
> + .dma_req_no_default = RZV2H_ICU_DMAC_REQ_NO_DEFAULT,

Since this is the only remaining user of RZV2H_ICU_DMAC_REQ_NO_DEFAULT,
and this structure does specify hardware, perhaps just hardcode 0x3ff?

> +};
> +
> +static const struct rz_dmac_info rz_dmac_common_info = {

rz_dmac_classic_info, as this is not really common to all variants?
I am open for a different name ;-)

> + .dma_req_no_default = 0,
> +};
> +
> static const struct of_device_id of_rz_dmac_match[] = {
> - { .compatible = "renesas,r9a09g057-dmac", },
> - { .compatible = "renesas,rz-dmac", },
> + { .compatible = "renesas,r9a09g057-dmac", .data = &rz_dmac_v2h_info },
> + { .compatible = "renesas,rz-dmac", .data = &rz_dmac_common_info },
> { /* Sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, of_rz_dmac_match);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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