Masanori Ogino has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45442 )
Change subject: [DONOTSUBMIT] drivers/pc80/tpm: Poll VID and DID. ......................................................................
[DONOTSUBMIT] drivers/pc80/tpm: Poll VID and DID.
Signed-off-by: Masanori Ogino mogino@acm.org Change-Id: I49000b9dd5560e8a36c925b3ad1dbfc78d6c14af --- M src/drivers/pc80/tpm/tis.c 1 file changed, 14 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/42/45442/1
diff --git a/src/drivers/pc80/tpm/tis.c b/src/drivers/pc80/tpm/tis.c index 27d238c..c03bc90 100644 --- a/src/drivers/pc80/tpm/tis.c +++ b/src/drivers/pc80/tpm/tis.c @@ -80,7 +80,7 @@ * so this value is a safe error indication to be mixed with possible status * register values. */ -#define TPM_TIMEOUT_ERR (~0) +#define TPM_TIMEOUT_ERR (~0)
/* Error value returned on various TPM driver errors */ #define TPM_DRIVER_ERR (~0) @@ -386,6 +386,7 @@ const char *device_name = "unknown"; const char *vendor_name = device_name; const struct device_name *dev; + u32 time_us = MAX_DELAY_US; u32 didvid; u16 vid, did; int i; @@ -393,8 +394,18 @@ if (vendor_dev_id) return 0; /* Already probed. */
- didvid = tpm_read_did_vid(0); - if (!didvid || (didvid == 0xffffffff)) { + do { + const u32 delay = 100; /* microseconds */ + didvid = tpm_read_did_vid(0); + + if (didvid != 0x00000000 && didvid != 0xffffffff) + break; + + udelay(delay); + time_us -= delay; + } while (time_us > 0); + + if (didvid == 0x00000000 || didvid == 0xffffffff) { printf("%s: No TPM device found\n", __func__); return TPM_DRIVER_ERR; }