i2c: tpm: Write 0 to the TPM access register when probing the TPM.
Otherwise the TPM gets confused and doesn't work right at high frequencies.
This fix was found by Jimmy Zhang.
BUG=chrome-os-partner:27220
TEST=Built and booted on nyan with the TPM frequency turned up to 400KHz. Saw
that there weren't any TPM errors.
BRANCH=None
Change-Id: I16665c95940a1c3e36aabea64094f9079e415be5
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://chromium-review.googlesource.com/191793
Reviewed-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Jimmy Zhang <jimmzhang@nvidia.com>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
diff --git a/src/drivers/tpm/i2c.c b/src/drivers/tpm/i2c.c
index 1e9b53d..6f8bdf2 100644
--- a/src/drivers/tpm/i2c.c
+++ b/src/drivers/tpm/i2c.c
@@ -53,10 +53,8 @@
* Probe TPM twice; the first probing might fail because TPM is asleep,
* and the probing can wake up TPM.
*/
- uint8_t tmp;
-
- if (i2c_read_raw(tpm->bus, tpm->addr, &tmp, 1) &&
- i2c_read_raw(tpm->bus, tpm->addr, &tmp, 1))
+ if (i2c_writeb(tpm->bus, tpm->addr, 0, 0) &&
+ i2c_writeb(tpm->bus, tpm->addr, 0, 0))
return -1;
if (tpm->chip_ops.init(&tpm->chip_ops))