Skip to content

Commit 5cc0101

Browse files
PeterHueweJarkko Sakkinen
authored and
Jarkko Sakkinen
committed
tpm_tis_spi: Add small delay after last transfer
Testing the implementation with a Raspberry Pi 2 showed that under some circumstances its SPI master erroneously releases the CS line before the transfer is complete, i.e. before the end of the last clock. In this case the TPM ignores the transfer and misses for example the GO command. The driver is unable to detect this communication problem and will wait for a command response that is never going to arrive, timing out eventually. As a workaround, the small delay ensures that the CS line is held long enough, even with a faulty SPI master. Other SPI masters are not affected, except for a negligible performance penalty. Cc: <[email protected]> Fixes: 0edbfea ("tpm/tpm_tis_spi: Add support for spi phy") Signed-off-by: Alexander Steffen <[email protected]> Signed-off-by: Peter Huewe <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Tested-by: Benoit Houyere <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 591e48c commit 5cc0101

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/char/tpm/tpm_tis_spi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
111111

112112
spi_xfer.cs_change = 0;
113113
spi_xfer.len = transfer_len;
114+
spi_xfer.delay_usecs = 5;
114115

115116
if (direction) {
116117
spi_xfer.tx_buf = NULL;

0 commit comments

Comments
 (0)