diff options
author | Roman Kapl | 2019-05-16 18:32:48 +0200 |
---|---|---|
committer | Tom Rini | 2019-07-11 14:11:18 -0400 |
commit | 27eb177b393e19af9716a2fa4969cd7b26ac3dc2 (patch) | |
tree | 5bd023cb732a9b23bf6d66c37b26995dac9ab218 /drivers/tpm | |
parent | 2e8a7202467acc3b40db864468c862327716b0ae (diff) |
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.
Signed-off-by: Roman Kapl <rka@sysgo.com>
Diffstat (limited to 'drivers/tpm')
-rw-r--r-- | drivers/tpm/tpm2_tis_spi.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c index 8878130bd72..7186c179d11 100644 --- a/drivers/tpm/tpm2_tis_spi.c +++ b/drivers/tpm/tpm2_tis_spi.c @@ -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; |