Skip to contentSkip to conversation

tpm: tpm_tis_spi: set cs_change = 0 when timesout

PATCH New wanghongzhe 1 participant 1 message Jan 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: tpm_tis_spi: set cs_change = 0 when timesout

when i reach TPM_RETRY, the cs cannot change back to 'high'.So the TPM chips thinks this communication is not over. And next times communication cannot be effective because the communications mixed up with the last time.

---
 drivers/char/tpm/tpm_tis_spi.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/char/tpm/tpm_tis_spi.c +7 -0
@@ -67,7 +67,14 @@ static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
 		}
 
 		if (i == TPM_RETRY)
+ 		{
+ 			spi_xfer.cs_change = 0;
+ 			spi_xfer->len = 1;
+ 			spi_message_init(&m);
+ 			spi_message_add_tail(spi_xfer, &m);
+ 			ret = spi_sync_locked(phy->spi_device, &m);
 			return -ETIMEDOUT;
+ 		}
 	}
 
 	return 0;

--
1.7.12.4