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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user