diff options
author | Duncan Laurie <dlaurie@chromium.org> | 2016-11-01 15:03:13 -0700 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-11-07 20:38:45 +0100 |
commit | ed4fa099d9583f33130eae97827e63d41d203ff9 (patch) | |
tree | f7f0c609001e4e6ee44d2730af48d92d5c82f45a /src/drivers/i2c/tpm/cr50.c | |
parent | a84fa908e2f8c25b21cb0017ff6bc80ee2d22ff3 (diff) |
drivers/i2c/tpm/cr50: Increase IRQ timeout
Increase the IRQ timeout to prevent issues if there is a delay
in the TPM responding to a command. Split the no-IRQ case out
so it doesn't suffer unnecessarily.
BUG=chrome-os-partner:59191
TEST=suspend/resume testing on eve board
Change-Id: I1ea7859bc7a056a450b2b0ee32153ae43ee8699f
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://review.coreboot.org/17204
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/drivers/i2c/tpm/cr50.c')
-rw-r--r-- | src/drivers/i2c/tpm/cr50.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/drivers/i2c/tpm/cr50.c b/src/drivers/i2c/tpm/cr50.c index f7e667b1d9..0877de01ea 100644 --- a/src/drivers/i2c/tpm/cr50.c +++ b/src/drivers/i2c/tpm/cr50.c @@ -48,6 +48,8 @@ #define CR50_MAX_BUFSIZE 63 #define CR50_TIMEOUT_LONG_MS 2000 /* Long timeout while waiting for TPM */ #define CR50_TIMEOUT_SHORT_MS 2 /* Short timeout during transactions */ +#define CR50_TIMEOUT_NOIRQ_MS 20 /* Timeout for TPM ready without IRQ */ +#define CR50_TIMEOUT_IRQ_MS 100 /* Timeout for TPM ready with IRQ */ #define CR50_DID_VID 0x00281ae0L struct tpm_inf_dev { @@ -65,11 +67,11 @@ static int cr50_i2c_wait_tpm_ready(struct tpm_chip *chip) if (!chip->vendor.irq_status) { /* Fixed delay if interrupt not supported */ - mdelay(CR50_TIMEOUT_SHORT_MS); + mdelay(CR50_TIMEOUT_NOIRQ_MS); return 0; } - stopwatch_init_msecs_expire(&sw, 5 * CR50_TIMEOUT_SHORT_MS); + stopwatch_init_msecs_expire(&sw, CR50_TIMEOUT_IRQ_MS); while (!chip->vendor.irq_status(chip->vendor.irq)) if (stopwatch_expired(&sw)) @@ -429,6 +431,11 @@ static void cr50_vendor_init(struct tpm_chip *chip) chip->vendor.irq = -1; #endif } + + if (chip->vendor.irq <= 0) + printk(BIOS_WARNING, + "%s: No IRQ, will use %ums delay for TPM ready\n", + __func__, CR50_TIMEOUT_NOIRQ_MS); } int tpm_vendor_probe(unsigned bus, uint32_t addr) |