diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2022-02-16 13:48:07 -0700 |
---|---|---|
committer | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2022-03-07 18:07:17 +0000 |
commit | 1e50dfbcded1c2e90262a390511a145b38c47b7c (patch) | |
tree | 146a90aa5db6bc4f2446f20f0fe4cb45eeae17ee /src/drivers/tpm | |
parent | 6b8599f29a888c0946ff44e97c32ecd4cec2a151 (diff) |
drivers/tpm/cr50: Add I2C bus support to cr50 driver
This allows mainboards using an I2C bus to communicate with the cr50
to reuse the functionality related to firmware version and BOARD_CFG.
BUG=b:202246591
TEST=boot on brya0, see cr50 FW version in logs
Change-Id: Ide1a7299936193da3cd3d15fdfd1a80994d70da0
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62059
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/drivers/tpm')
-rw-r--r-- | src/drivers/tpm/cr50.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/drivers/tpm/cr50.c b/src/drivers/tpm/cr50.c index c8ab5e4a55..4b5e8134f2 100644 --- a/src/drivers/tpm/cr50.c +++ b/src/drivers/tpm/cr50.c @@ -23,6 +23,9 @@ enum cr50_register { #define CR50_FW_VER_REG_SPI (TPM_LOCALITY_0_SPI_BASE + 0xf90) #define CR50_BOARD_CFG_REG_SPI (TPM_LOCALITY_0_SPI_BASE + 0xfe0) +#define CR50_FW_VER_REG_I2C 0x0f +#define CR50_BOARD_CFG_REG_I2C 0x1c + /* Return register address, which depends on the bus type, or -1 for error. */ static int get_reg_addr(enum cr50_register reg) { @@ -37,6 +40,16 @@ static int get_reg_addr(enum cr50_register reg) } } + if (CONFIG(I2C_TPM)) { + switch (reg) { + case CR50_FW_VER_REG: + return CR50_FW_VER_REG_I2C; + case CR50_BOARD_CFG_REG: + return CR50_BOARD_CFG_REG_I2C; + default: + return -1; + } + } return -1; } |