By setting cs_change=1 multiple messages are kept within the same transaction, i.e. the CS line is not released after the first message. This is fine during normal transactions, when the last message sets cs_change=0, so that the CS line is released at the end. But when transactions cannot be completed, e.g. when the wait state handling times out, the CS line is not released before leaving the function, because no message is sent with cs_change=0. This breaks future SPI transactions, so ensure that the CS line is correcly released in this error case by sending an empty message. Signed-off-by: Alexander Steffen <Alexander.Steffen@xxxxxxxxxxxx> --- Note: I expect it to work that way, but have not tested it yet. drivers/char/tpm/tpm_tis_spi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c index 2758b41..2cc6aa9 100644 --- a/drivers/char/tpm/tpm_tis_spi.c +++ b/drivers/char/tpm/tpm_tis_spi.c @@ -101,6 +101,17 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, } if (i == TPM_RETRY) { + spi_xfer.tx_buf = NULL; + spi_xfer.rx_buf = NULL; + spi_xfer.len = 0; + spi_xfer.cs_change = 0; + + spi_message_init(&m); + spi_message_add_tail(&spi_xfer, &m); + ret = spi_sync_locked(phy->spi_device, &m); + if (ret < 0) + goto exit; + ret = -ETIMEDOUT; goto exit; } -- 2.7.4