Skip to contentSkip to conversation

tpm: wait for valid status

PATCH New Roman Kapl 2 participants 2 messages May 16, 2019 – Jul 11, 2019

lore
Share & tools
lore

Roman Kapl

author
#0 lore raw

PATCH 1/1 tpm: wait for valid status

The TPM specification says that the EXPECT_DATA bit is not valid until the VALID bit is set. Wait for that bit to be set. Fixes problems with Ifineon SPI TPM.

---
 drivers/tpm/tpm2_tis_spi.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/tpm/tpm2_tis_spi.c +10 -2
index 8878130bd7..7186c179d1 100644
@@ -295,6 +295,14 @@ static int tpm_tis_spi_wait_for_stat(struct udevice *dev, u8 mask,
 	return -ETIMEDOUT;
 }
 
+static u8 tpm_tis_spi_valid_status(struct udevice *dev, u8 *status)
+{
+	struct tpm_chip *chip = dev_get_priv(dev);
+
+	return tpm_tis_spi_wait_for_stat(dev, TPM_STS_VALID,
+		chip->timeout_c, status);
+}
+
 static int tpm_tis_spi_get_burstcount(struct udevice *dev)
 {
 	struct tpm_chip *chip = dev_get_priv(dev);
@@ -455,7 +463,7 @@ static int tpm_tis_spi_send(struct udevice *dev, const u8 *buf, size_t len)
 		i += size;
 	}
 
-	ret = tpm_tis_spi_status(dev, &status);
+	ret = tpm_tis_spi_valid_status(dev, &status);
 	if (ret)
 		goto out_err;
 
@@ -469,7 +477,7 @@ static int tpm_tis_spi_send(struct udevice *dev, const u8 *buf, size_t len)
 	if (ret)
 		goto out_err;
 
-	ret = tpm_tis_spi_status(dev, &status);
+	ret = tpm_tis_spi_valid_status(dev, &status);
 	if (ret)
 		goto out_err;
 
Signature · 1 line
2.20.1.390.gb5101f9297
#1 lore raw

PATCH 1/1 tpm: wait for valid status

Quoted 5 lines · Roman Kapl

The TPM specification says that the EXPECT_DATA bit is not valid until the VALID bit is set. Wait for that bit to be set. Fixes problems with Ifineon SPI TPM.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/0171978d/attachment.sig>