[PATCH v15 4/7] spi: pxa2xx: lock out runtime autosuspend for Intel LPSS SPI in PIO mode
Shih-Yuan Lee <[email protected]>
| Newsgroups | org.kernel.vger.linux-spi,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
When operating in PIO mode on Intel LPSS SPI controllers, runtime PM autosuspend clock-gates the hardware block when idle. On subsequent transfers, MMIO accesses to trigger resume are performed before the runtime PM state machine can wake the controller, causing PCIe Completion Timeouts. This issue does not affect DMA mode, where the DMA engine holds the required resources, nor does it affect non-LPSS controllers. Lock out runtime PM autosuspend for LPSS SPI controllers specifically when operating in PIO mode. Acquire a runtime PM reference via pm_runtime_get_noresume() in pxa2xx_spi_probe() after registration, and release it via pm_runtime_put_sync() in pxa2xx_spi_remove() to ensure the runtime PM state machine transitions to RPM_SUSPENDED upon driver unbind, preventing active child count leaks on the parent LPSS power domain. Signed-off-by: Shih-Yuan Lee <[email protected]> --- drivers/spi/spi-pxa2xx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 64b5ec744756..88ed28096b07 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1473,6 +1473,9 @@ int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp, goto out_error_irq_alloc; } + if (is_lpss_ssp(drv_data) && !platform_info->enable_dma) + pm_runtime_get_noresume(dev); + return status; out_error_irq_alloc: @@ -1513,6 +1516,8 @@ void pxa2xx_spi_remove(struct device *dev) /* Release DMA */ if (drv_data->controller_info->enable_dma) pxa2xx_spi_dma_release(drv_data); + else if (is_lpss_ssp(drv_data)) + pm_runtime_put_sync(dev); } EXPORT_SYMBOL_NS_GPL(pxa2xx_spi_remove, "SPI_PXA2xx"); -- 2.39.5