spi: cadence-quadspi: Fix indirect write timeout when DMA read mode is enabled
Subsystems (2)
PATCH 1/1 spi: cadence-quadspi: Fix indirect write timeout when DMA read mode is enabled
When use_dma_read is enabled, the IRQ handler unconditionally overwrites irq_status with the return value of get_dma_status(). For write operations, DMA status returns 0 since no DMA read is in progress, causing irq_status to become 0. The subsequent completion signal is never triggered and the write operation times out with -ETIMEDOUT:
cadence-qspi f1010000.spi: Indirect write timeout spi-nor spi0.1: operation failed with -110
Fix this by separating the DMA completion path from the write interrupt path. If get_dma_status() indicates DMA read completion, signal completion and return immediately. Otherwise, preserve the original irq_status so that write completion interrupts are correctly recognized and signalled.
--- drivers/spi/spi-cadence-quadspi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/spi/spi-cadence-quadspi.c +8 -4
@@ -382,12 +382,16 @@ static irqreturn_t cqspi_irq_handler(int this_irq, void *dev)/* Clear interrupt */ writel (irq_status, cqspi->iobase +CQSPI_REG_IRQSTATUS ); -if (cqspi->use_dma_read && ddata && ddata->get_dma_status) - irq_status = ddata->get_dma_status (cqspi); -else if (cqspi->slow_sram) +if (cqspi->use_dma_read && ddata && ddata->get_dma_status) { +if (ddata->get_dma_status (cqspi)) { +complete (&cqspi->transfer_complete); +return IRQ_HANDLED ; + } + }else if (cqspi->slow_sram) { irq_status &=CQSPI_IRQ_MASK_RD_SLOW_SRAM |CQSPI_IRQ_MASK_WR ; -else + }else { irq_status &=CQSPI_IRQ_MASK_RD |CQSPI_IRQ_MASK_WR ; + }if (irq_status)complete (&cqspi->transfer_complete);
Signature · 1 line
2.34.1
Quoted 9 lines
When
use_dma_readis enabled, the IRQ handler unconditionally overwritesirq_statuswith the return value ofget_dma_status(). For write operations, DMA status returns 0 since no DMA read is in progress, causingirq_statusto become 0. The subsequent completion signal is never triggered and the write operation times out with-ETIMEDOUT:cadence-qspi f1010000.spi: Indirect write timeout spi-nor spi0.1: operation failed with -110
Quoted 7 lines
Fix this by separating the DMA completion path from the write interrupt path. If
get_dma_status()indicates DMA read completion, signal completion and return immediately. Otherwise, preserve the originalirq_statusso that write completion interrupts are correctly recognized and signalled.Fixes aac733a96636 ("spi: cadence-qspi: Fix style and improve readability")Signed-off-by Srikanth Boyapally <[email protected]>
Thanks!
Quoted 29 lines
--- drivers/spi/spi-cadence-quadspi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/spi/spi-cadence-quadspi.c +8
-4@@ -382,12 +382,16 @@ static irqreturn_t cqspi_irq_handler(int this_irq, void *dev)/* Clear interrupt */ writel (irq_status, cqspi->iobase +CQSPI_REG_IRQSTATUS ); -if (cqspi->use_dma_read && ddata && ddata->get_dma_status) - irq_status = ddata->get_dma_status (cqspi); -else if (cqspi->slow_sram) +if (cqspi->use_dma_read && ddata && ddata->get_dma_status) { +if (ddata->get_dma_status (cqspi)) { +complete (&cqspi->transfer_complete); +return IRQ_HANDLED ; + } + }else if (cqspi->slow_sram) { irq_status &=CQSPI_IRQ_MASK_RD_SLOW_SRAM |CQSPI_IRQ_MASK_WR ; -else + }else { irq_status &=CQSPI_IRQ_MASK_RD |CQSPI_IRQ_MASK_WR ; + }if (irq_status)complete (&cqspi->transfer_complete);
Mark Brown
maintainerQuoted 1 line · Srikanth Boyapally
spi: cadence-quadspi: Fix indirect write timeout when DMA read mode is enabled
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.2
Thanks!
[1/1] spi: cadence-quadspi: Fix indirect write timeout when DMA read mode is enabled
https://git.kernel.org/broonie/spi/c/e919ca35a6e8
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark