RE: [PATCH 3/6] spi: Add driver for the RZ/V2H(P) RSPI IP

From: Fabrizio Castro
Date: Fri Jul 04 2025 - 10:18:01 EST


Hi Mark,

Thanks for your feedback.

> From: Mark Brown <broonie@xxxxxxxxxx>
> Sent: 25 June 2025 20:09
> To: Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>
> Cc: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>; Geert Uytterhoeven <geert+renesas@xxxxxxxxx>; Magnus Damm
> <magnus.damm@xxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; linux-spi@xxxxxxxxxxxxxxx; linux-renesas-
> soc@xxxxxxxxxxxxxxx; Biju Das <biju.das.jz@xxxxxxxxxxxxxx>; Prabhakar Mahadev Lad <prabhakar.mahadev-
> lad.rj@xxxxxxxxxxxxxx>
> Subject: Re: [PATCH 3/6] spi: Add driver for the RZ/V2H(P) RSPI IP
>
> On Tue, Jun 24, 2025 at 08:23:01PM +0100, Fabrizio Castro wrote:
>
> > +static int rzv2h_rspi_unprepare_message(struct spi_controller *ctlr,
> > + struct spi_message *message)
> > +{
> > + struct rzv2h_rspi_priv *rspi = spi_controller_get_devdata(ctlr);
> > +
> > + rzv2h_rspi_spe_disable(rspi);
> > + rzv2h_rspi_clear_fifos(rspi);
>
> A bit interesting that we need to clear the FIFOs, but it's just one
> register write so probably not worth worrying about.

I can surely take out rzv2h_rspi_clear_fifos() from
rzv2h_rspi_unprepare_message(), as rzv2h_rspi_prepare_message()
makes sure they are clear before we start transferring.

>
> > + ret = devm_clk_bulk_get(dev, RSPI_CLK_NUM, rspi->clks);
> > + if (ret)
> > + return dev_err_probe(dev, ret, "cannot get clocks\n");
>
> > + ret = devm_request_irq(dev, irq_rx, rzv2h_rx_irq_handler, 0,
> > + dev_name(dev), rspi);
> > + if (ret)
> > + return dev_err_probe(dev, ret, "cannot request `rx` IRQ\n");
> > +
> > + ret = clk_bulk_prepare_enable(RSPI_CLK_NUM, rspi->clks);
>
> Are you sure that the interrupt handler is safe with the IP in reset and
> clocks disabled...
>
> > + init_waitqueue_head(&rspi->wait);
>
> ...and the wakequeue head it wakes up not yet initialised? This is also
> a concern during unregistration where devm things will be unwound after
> the remove() function has run.


Good points, I'll move devm_request_irq() to after the clocks are ON,
the resets are deasserted, and the waitqueue has been initialized.

Thanks,
Fab