Hi, On Fri, Nov 13, 2026 at 02:50:17PM +0100, Heiko Stuebner wrote: > From: Heiko Stuebner > > Rockchip SPI controllers are often used to handle SPI connected PMICs that > also handle system power-off events, like the RK806. > > When the kernel signals the power-off, all the interrupts are already > disabled, so regular SPI with its mutexes and DMA transfers does not > work anymore. > > Implement an atomic transfer function that does SPI transfers polling the > controller in a loop without any DMA or IRQ. > > This can successfully handle the power-off command to RK806, but also > read back the 2 chip-id registers just fine before that, as a test. > > Signed-off-by: Heiko Stuebner > --- > [...] > +static int rockchip_spi_transfer_atomic(struct spi_device *spi, struct spi_message *msg) > +{ > + struct spi_controller *ctlr = spi->controller; > + struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); > + struct spi_transfer *xfer; > + int ret = 0; > + > + spi_set_cs(spi, true, false); I think it's sensible to avoid SErrors in case something went wrong with the preparation: if (!pm_runtime_active(rs->dev)) { dev_err(rs->dev, "Failed to do atomic SPI transfer due to runtime suspend\n"); ret = -EIO; goto out; } > + > + /* make sure all interrupts are masked and status cleared */ > + writel_relaxed(0, rs->regs + ROCKCHIP_SPI_IMR); > + writel_relaxed(0xffffffff, rs->regs + ROCKCHIP_SPI_ICR); > > [...] Greetings, -- Sebastian