spi: xilinx: let transfers timeout in case of no IRQ
Subsystems (2)
PATCH 1/1 spi: xilinx: let transfers timeout in case of no IRQ
In case of failed HW the driver may not see an interrupt and will stuck in waiting forever. We can avoid such situation by timing out of transfers if the interrupt is not seen in a reasonable time.
This problem can be found on unload of ptp_ocp driver for TimeCard which uses Xilinx SPI AXI and SPI-NOR flash memory. During tear-down process spi-nor drivers send soft reset command which is not triggering an interrupt stalling the unload process completely.
--- drivers/spi/spi-xilinx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-xilinx.c +5 -1
@@ -285,7 +285,11 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)if (use_irq) { xspi->write_fn (cr, xspi->regs +XSPI_CR_OFFSET ); -wait_for_completion (&xspi->done); +if (!wait_for_completion_timeout (&xspi->done,secs_to_jiffies (1 ))) { +dev_err (&spi->dev,"SPI transfer timed out\n" ); +xspi_init_hw (xspi); +return -ETIMEDOUT ; + }/* A transmit has just completed. Process received data * and check for more data to transmit. Always inhibit * the transmitter while the Isr refills the transmit
Signature · 1 line
2.47.3
Quoted 1 line · Vadim Fedorenko
In case of failed HW the driver may not see an interrupt and will stuck
will be stuck/will get stuck
Quoted 1 line
in waiting forever. We can avoid such situation by timing out of
Imperative mood please.
Quoted 19 lines
transfers if the interrupt is not seen in a reasonable time.
This problem can be found on unload of
ptp_ocpdriver for TimeCard which uses Xilinx SPI AXI and SPI-NOR flash memory. During tear-down process spi-nor drivers send soft reset command which is not triggering an interrupt stalling the unload process completely.Signed-off-by Vadim Fedorenko <[email protected]>--- drivers/spi/spi-xilinx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/spi/spi-xilinx.c +0
-0@@ -285,7 +285,11 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)if (use_irq) {
drivers/spi/spi-xilinx.c static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) · line 295
Quoted 10 lines
drivers/spi/spi-xilinx.c +5
-1xspi->write_fn (cr, xspi->regs +XSPI_CR_OFFSET ); -wait_for_completion (&xspi->done); +if (!wait_for_completion_timeout (&xspi->done,secs_to_jiffies (1 ))) { +dev_err (&spi->dev,"SPI transfer timed out\n" ); +xspi_init_hw (xspi); +return -ETIMEDOUT ; + }/* A transmit has just completed. Process received data * and check for more data to transmit. Always inhibit * the transmitter while the Isr refills the transmit
With changes in commit message feel free to add my
Thanks,
Michal
Mark Brown
maintainerQuoted 1 line · Vadim Fedorenko
spi: xilinx: let transfers timeout in case of no IRQ
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.2
Thanks!
[1/1] spi: xilinx: let transfers timeout in case of no IRQ
https://git.kernel.org/broonie/spi/c/0f95264f49ac
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