tpm_tis_core_init() releases locality 0 then immediately reclaims it via
tpm_chip_start(); some TPMs (e.g. Nuvoton NPCT, TPM 2.0) need a few ms
before granting it again, so probe fails with -1. This back-to-back
release/request was added with the locality claim around TPM_INT_ENABLE.
Wait for the chip to settle after releasing the locality. A delay of
TPM_TIMEOUT (5 ms) in __tpm_tis_relinquish_locality() is reliable; values
below 3 ms are not.
Fixes: 0ef333f5ba7f ("tpm: add request_locality before write TPM_INT_ENABLE")
Cc: [email protected]
Signed-off-by: Daniel Golle <[email protected]>
---
drivers/char/tpm/tpm_tis_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 21d79ad3b164..6b90ff50c78d 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -171,6 +171,8 @@ static int __tpm_tis_relinquish_locality(struct
tpm_tis_data *priv, int l)
{
tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
+ tpm_msleep(TPM_TIMEOUT);
+
return 0;
}
--
2.54.0