summaryrefslogtreecommitdiff
path: root/src/drivers/i2c/tpm/tpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/i2c/tpm/tpm.c')
-rw-r--r--src/drivers/i2c/tpm/tpm.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/drivers/i2c/tpm/tpm.c b/src/drivers/i2c/tpm/tpm.c
index 541eb3aaa0..eb279844e8 100644
--- a/src/drivers/i2c/tpm/tpm.c
+++ b/src/drivers/i2c/tpm/tpm.c
@@ -451,13 +451,29 @@ out_err:
/* Initialization of I2C TPM */
-tpm_result_t tpm_vendor_probe(unsigned int bus, uint32_t addr)
+tpm_result_t tpm_vendor_probe(unsigned int bus, uint32_t addr, enum tpm_family *family)
{
struct stopwatch sw;
uint8_t buf = 0;
int ret;
long sw_run_duration = SLEEP_DURATION_PROBE_MS;
+ /*
+ * Infineon "I2C Protocol Stack Specification v0.20" is supposedly a
+ * simple adoption of the LPC TIS Protocol to the I2C Bus, but looking
+ * at "TCG PC Client Specific TIS" doesn't confirm that and Infineon's
+ * specification isn't publicly available.
+ *
+ * Because it's unknown how to access information about TPM version of
+ * the device in this case, the assumption is that whatever TPM version
+ * is enabled at compile-time defines what the device supports. And
+ * since this driver doesn't appear to be used with TPM 2 devices, the
+ * check is written in a way to give TPM 1 preference even if support
+ * for both versions is compiled in.
+ */
+ if (family != NULL)
+ *family = CONFIG(TPM1) ? TPM_1 : TPM_2;
+
tpm_dev.chip_type = UNKNOWN;
tpm_dev.bus = bus;
tpm_dev.addr = addr;