Re: [PATCH] spi: rspi: Fix DMA mode when the DMA controller is built as a module

From: Geert Uytterhoeven

Date: Tue Sep 22 2026 - 10:55:57 EST


Hi Ovidiu,

On Mon, 21 Sept 2026 at 22:00, Ovidiu Panait
<ovidiu.panait.rb@xxxxxxxxxxx> wrote:
> On the Renesas RZ/G2L platform, the RSPI driver falls back to PIO mode
> instead of using DMA when the DMA controller driver is built as a module
> (CONFIG_RZ_DMAC=m):
>
> renesas_spi 1004b000.spi: dma_request_slave_channel_compat failed
> renesas_spi 1004b000.spi: DMA not available, using PIO
>
> The driver requests DMA channels through dma_request_slave_channel_compat()
> which returns either a valid pointer or NULL and cannot handle
> -EPROBE_DEFER. If the DMA controller has not probed yet, the driver falls
> back to PIO directly.
>
> Fix this by replacing the dma_request_slave_channel_compat() call with a
> regular dma_request_chan() call. dma_request_slave_channel_compat() is
> always passed a NULL fn_param in all code paths, so it actually behaves
> like a plain dma_request_chan() call.
>
> Fixes: e825b8dd2b36 ("spi: rspi: Add DT support to DMA setup")
> Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@xxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/spi/spi-rspi.c
> +++ b/drivers/spi/spi-rspi.c
> @@ -1355,6 +1339,11 @@ static int rspi_probe(struct platform_device *pdev)
> }
>
> ret = rspi_request_dma(&pdev->dev, ctlr, res);
> + if (ret == -EPROBE_DEFER) {
> + dev_err_probe(&pdev->dev, ret,
> + "failed to request DMA channels\n");
> + goto error2;

Doesn't this make the probe fail if the DMA driver is not available
at all?

> + }
> if (ret < 0)
> dev_warn(&pdev->dev, "DMA not available, using PIO\n");

The driver still falls back to PIO in case of a missing "dmas"
property, right?

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