Patch "spi: xilinx: Detect stall with Unknown commands" has been added to the 4.4-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
spi: xilinx: Detect stall with Unknown commands
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
spi-xilinx-detect-stall-with-unknown-commands.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
5a1314fa697fc65cefaba64cd4699bfc3e6882a6Mon Sep 17 00:00:00 2001
From: Ricardo Ribalda <[email protected]>
Date: Tue, 21 Nov 2017 10:09:02 +0100
Subject: spi: xilinx: Detect stall with Unknown commands
From: Ricardo Ribalda Delgado <[email protected]>
commit 5a1314fa697fc65cefaba64cd4699bfc3e6882a6 upstream.
When the core is configured in C_SPI_MODE > 0, it integrates a lookup table that automatically configures the core in dual or quad mode based on the command (first byte on the tx fifo).
Unfortunately, that list mode_?_memoy_*.mif does not contain all the supported commands by the flash.
Since 4.14 spi-nor automatically tries to probe the flash using SFDP (command 0x5a), and that command is not part of the list_mode table.
Whit the right combination of C_SPI_MODE and C_SPI_MEMORY this leads into a stall that can only be recovered with a soft rest.
This patch detects this kind of stall and returns -EIO to the caller on those commands. spi-nor can handle this error properly:
m25p80 spi0.0: Detected stall. Check C_SPI_MODE and C_SPI_MEMORY. 0x21 0x2404 m25p80 spi0.0: SPI transfer failed: -5spi_master spi0: failed to transfer one message from queue
m25p80 spi0.0: s25sl064p (8192 Kbytes)
--- drivers/spi/spi-xilinx.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/spi/spi-xilinx.c +11 -0
@@ -271,6 +271,7 @@ static int xilinx_spi_txrx_bufs(struct swhile (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 s/* 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--;
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/spi-xilinx-detect-stall-with-unknown-commands.patch