summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Lai <eric_lai@quanta.corp-partner.google.com>2022-03-23 08:48:03 +0800
committerTim Wawrzynczak <twawrzynczak@chromium.org>2022-03-25 15:58:19 +0000
commitc4ca20f67ff37b59acfc7779829ac28cd30effb9 (patch)
treef1d01febed3439abc237cf9f06316a3ef4aff995
parent66f99f7fa7e7644e2549619b375e758492b601e3 (diff)
drivers/i2c/tpm: Work around missing board_cfg in Ti50 FW under 0.15
Ti50 FW under 0.15 is not support board cfg command which causes I2C errors and entering recovery mode. And ODM stocks are 0.12 pre-flashed. Add workaround for the old Ti50 chip. BUG=b:224650720 TEST=no I2C errors in coreboot. [ERROR] cr50_i2c_read: Address write failed [INFO ] .I2C stop bit not received Signed-off-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Change-Id: Ieec7842ca66b4c690df04a400cebcf45138c745d Reviewed-on: https://review.coreboot.org/c/coreboot/+/63011 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Kangheui Won <khwon@chromium.org>
-rw-r--r--src/drivers/i2c/tpm/Kconfig9
-rw-r--r--src/drivers/i2c/tpm/cr50.c4
-rw-r--r--src/mainboard/google/brya/Kconfig1
3 files changed, 13 insertions, 1 deletions
diff --git a/src/drivers/i2c/tpm/Kconfig b/src/drivers/i2c/tpm/Kconfig
index dcf9060952..0d5f06bbdd 100644
--- a/src/drivers/i2c/tpm/Kconfig
+++ b/src/drivers/i2c/tpm/Kconfig
@@ -24,6 +24,15 @@ config MAINBOARD_HAS_I2C_TPM_GENERIC
help
Board has a generic I2C TPM support
+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 ce2278b8c6..7eb066d1c5 100644
--- a/src/drivers/i2c/tpm/cr50.c
+++ b/src/drivers/i2c/tpm/cr50.c
@@ -500,7 +500,9 @@ 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);
- if (tpm_first_access_this_boot()) {
+ /* 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()) {
/* This is called for the side-effect of printing the version string. */
cr50_get_firmware_version(&ver);
cr50_set_board_cfg();
diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig
index 199db117bb..259958774a 100644
--- a/src/mainboard/google/brya/Kconfig
+++ b/src/mainboard/google/brya/Kconfig
@@ -60,6 +60,7 @@ config BOARD_GOOGLE_BASEBOARD_NISSA
def_bool n
select BOARD_GOOGLE_BRYA_COMMON
select CHROMEOS_DRAM_PART_NUMBER_IN_CBI if CHROMEOS
+ select MAINBOARD_NEEDS_I2C_TI50_WORKAROUND
select MEMORY_SOLDERDOWN
select SOC_INTEL_ALDERLAKE_PCH_N
select SOC_INTEL_CSE_LITE_COMPRESS_ME_RW