Skip to content

Commit 22c8ce0

Browse files
Sai Krishna Potthuribroonie
authored andcommitted
spi: cadence-quadspi: Update the read timeout based on the length
When performing indirect read via external DMA the timeout for completion is set equal to the read length instead of fixed timeout value. For reads larger than 500 bytes, the timeout will continue to be equal to the read length whereas for a small read like the Read Status Register command, the timeout would be 1 or 2 milliseconds. This is not enough to cover the overhead needed in setting up DMA, in that case make sure the timeout is at least 500ms to allow DMA to finish. This solution is inline with the timeout used for Direct read via DMA. Signed-off-by: Sai Krishna Potthuri <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6d87552 commit 22c8ce0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-cadence-quadspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ static int cqspi_versal_indirect_read_dma(struct cqspi_flash_pdata *f_pdata,
863863
reinit_completion(&cqspi->transfer_complete);
864864

865865
if (!wait_for_completion_timeout(&cqspi->transfer_complete,
866-
msecs_to_jiffies(CQSPI_READ_TIMEOUT_MS))) {
866+
msecs_to_jiffies(max_t(size_t, bytes_to_dma, 500)))) {
867867
ret = -ETIMEDOUT;
868868
goto failrd;
869869
}

0 commit comments

Comments
 (0)