diff options
author | Ingo Molnar <mingo@kernel.org> | 2018-01-06 12:07:10 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-01-06 12:07:10 +0100 |
commit | b6815f354518591400ce4c3a5fd63337643710ff (patch) | |
tree | 14f8a117b4556f7dba5a5a9ccebc5e3b204cbd56 /drivers/spi/spi-xilinx.c | |
parent | a0a8f2ada3f50f0190ebcbb60e77e697444c470e (diff) | |
parent | 89876f275e8d562912d9c238cd888b52065cf25c (diff) | |
download | linux-b6815f354518591400ce4c3a5fd63337643710ff.tar.bz2 |
Merge branch 'linus' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/spi/spi-xilinx.c')
-rw-r--r-- | drivers/spi/spi-xilinx.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index bc7100b93dfc..e0b9fe1d0e37 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c @@ -271,6 +271,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) while (remaining_words) { int n_words, tx_words, rx_words; u32 sr; + int stalled; n_words = min(remaining_words, xspi->buffer_size); @@ -299,7 +300,17 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) /* Read out all the data from the Rx FIFO */ rx_words = n_words; + stalled = 10; while (rx_words) { + if (rx_words == n_words && !(stalled--) && + !(sr & XSPI_SR_TX_EMPTY_MASK) && + (sr & XSPI_SR_RX_EMPTY_MASK)) { + dev_err(&spi->dev, + "Detected stall. Check C_SPI_MODE and C_SPI_MEMORY\n"); + xspi_init_hw(xspi); + return -EIO; + } + if ((sr & XSPI_SR_TX_EMPTY_MASK) && (rx_words > 1)) { xilinx_spi_rx(xspi); rx_words--; |