summaryrefslogtreecommitdiff
path: root/src/drivers/i2c/tpm
diff options
context:
space:
mode:
authorJes Klinke <jbk@google.com>2022-03-28 14:22:24 -0700
committerMartin L Roth <martinroth@google.com>2022-04-24 22:09:42 +0000
commit1430b043f0376f00d4e1064d231745cb3e62edf0 (patch)
tree057384f10a7fefa2de190b203e143d0471f94196 /src/drivers/i2c/tpm
parent9d8df30950710635c9e7c099ef8d0c8d047658ca (diff)
tpm: Allow separate handling of Google Ti50 TPM
A new iteration of Google's TPM implementation will advertize a new DID:VID, but otherwise follow the same protocol as the earlier design. This change makes use of Kconfigs TPM_GOOGLE_CR50 and TPM_GOOGLE_TI50 to be able to take slightly different code paths, when e.g. evaluating whether TPM firmware is new enough to support certain features. Change-Id: I1e1f8eb9b94fc2d5689656335dc1135b47880986 Signed-off-by: Jes B. Klinke <jbk@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63158 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/drivers/i2c/tpm')
-rw-r--r--src/drivers/i2c/tpm/Kconfig9
-rw-r--r--src/drivers/i2c/tpm/cr50.c12
2 files changed, 5 insertions, 16 deletions
diff --git a/src/drivers/i2c/tpm/Kconfig b/src/drivers/i2c/tpm/Kconfig
index 8efcbaf991..0e7856d645 100644
--- a/src/drivers/i2c/tpm/Kconfig
+++ b/src/drivers/i2c/tpm/Kconfig
@@ -3,15 +3,6 @@ config I2C_TPM
help
I2C TPM driver is enabled!
-config MAINBOARD_NEEDS_I2C_TI50_WORKAROUND
- bool
- default n
- help
- Ti50 FW versions below 0.15 don't support the firmware_version or board_cfg registers,
- and trying to access them causes I2C errors. This config will skip accesses to these
- registers, and should be selected for boards using Ti50 chips with FW < 0.15. The config
- will be removed once all Ti50 stocks are updated to 0.15 or higher.
-
config DRIVER_TIS_DEFAULT
bool
depends on I2C_TPM
diff --git a/src/drivers/i2c/tpm/cr50.c b/src/drivers/i2c/tpm/cr50.c
index 7eb066d1c5..0130b93169 100644
--- a/src/drivers/i2c/tpm/cr50.c
+++ b/src/drivers/i2c/tpm/cr50.c
@@ -36,6 +36,7 @@
#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
+#define TI50_DID_VID 0x504a6666L
struct tpm_inf_dev {
int bus;
@@ -455,7 +456,7 @@ static int cr50_i2c_probe(struct tpm_chip *chip, uint32_t *did_vid)
rc = cr50_i2c_read(TPM_DID_VID(0), (uint8_t *)did_vid, 4);
/* Exit once DID and VID verified */
- if (!rc && (*did_vid == CR50_DID_VID)) {
+ if (!rc && (*did_vid == CR50_DID_VID || *did_vid == TI50_DID_VID)) {
printk(BIOS_INFO, "done! DID_VID 0x%08x\n", *did_vid);
return 0;
}
@@ -474,7 +475,6 @@ static int cr50_i2c_probe(struct tpm_chip *chip, uint32_t *did_vid)
int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr)
{
- struct cr50_firmware_version ver;
uint32_t did_vid = 0;
if (dev_addr == 0) {
@@ -500,12 +500,10 @@ int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr)
printk(BIOS_DEBUG, "cr50 TPM 2.0 (i2c %u:0x%02x id 0x%x)\n",
bus, dev_addr, did_vid >> 16);
- /* Ti50 FW version under 0.15 doesn't support board cfg command
- TODO: remove this flag after all stocks Ti50 uprev to 0.15 or above */
- if (!CONFIG(MAINBOARD_NEEDS_I2C_TI50_WORKAROUND) && tpm_first_access_this_boot()) {
+ if (tpm_first_access_this_boot()) {
/* This is called for the side-effect of printing the version string. */
- cr50_get_firmware_version(&ver);
- cr50_set_board_cfg();
+ cr50_get_firmware_version(NULL);
+ cr50_set_board_cfg();
}
chip->is_open = 1;