From f08e3bb5165cfdedb317c7f71766dba46fd58cb8 Mon Sep 17 00:00:00 2001 From: Reka Norman Date: Tue, 29 Mar 2022 09:55:57 +1100 Subject: [PATCH] drivers/tpm: Force enable long IRQ pulses for Ti50 versions under 0.15. Only Cr50 versions starting at 0.5.5 support long IRQ pulses, so this feature is enabled based on the value of the board_cfg register (see CB:61722). However, Ti50 versions below 0.0.15 don't support the board_cfg register, and trying to access it will cause I2C errors (see CB:63011). Also, all Ti50 versions only support long IRQ pulses. Therefore, add a workaround to force enable long IRQ pulses for boards using Ti50 versions under 0.0.15, instead of enabling it based on board_cfg. This workaround will be removed once all Ti50 stocks are updated to 0.0.15 or higher. BUG=b:225941781 TEST=Boot nivviks and nereid to OS with Ti50 0.0.14 and check there are none of these I2C errors: [ERROR] I2C stop bit not received [ERROR] cr50_i2c_read: Address write failed [ERROR] cr50_i2c_tis_status: Failed to read status Change-Id: Iaba71461d8ec79e8d6efddbd505339cdf1176485 Signed-off-by: Reka Norman Reviewed-on: https://review.coreboot.org/c/coreboot/+/63160 Reviewed-by: Eric Lai Reviewed-by: Kangheui Won Tested-by: build bot (Jenkins) --- src/drivers/tpm/cr50.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/drivers/tpm/cr50.c b/src/drivers/tpm/cr50.c index 1d6c69196f..4ab01fbf92 100644 --- a/src/drivers/tpm/cr50.c +++ b/src/drivers/tpm/cr50.c @@ -142,6 +142,14 @@ enum cb_err cr50_set_board_cfg(void) bool cr50_is_long_interrupt_pulse_enabled(void) { + /* + * Ti50 FW versions under 0.15 don't support the board cfg register, + * and all Ti50 versions only support long IRQ pulses. + * TODO: Remove this after all Ti50 stocks uprev to 0.15 or above. + */ + if (CONFIG(MAINBOARD_NEEDS_I2C_TI50_WORKAROUND)) + return true; + return !!(cr50_get_board_cfg() & CR50_BOARD_CFG_100US_READY_PULSE); }