Skip to content

Commit bbc23a0

Browse files
webmeisterjarkkojs
authored andcommitted
tpm: Add tpm_tis_i2c backend for tpm_tis_core
Implement the TCG I2C Interface driver, as specified in the TCG PC Client Platform TPM Profile (PTP) specification for TPM 2.0 v1.04 revision 14, section 8, I2C Interface Definition. This driver supports Guard Times. That is, if required by the TPM, the driver has to wait by a vendor-specific time after each I2C read/write. The specific time is read from the TPM_I2C_INTERFACE_CAPABILITY register. Unfortunately, the TCG specified almost but not quite compatible register addresses. Therefore, the TIS register addresses need to be mapped to I2C ones. The locality is stripped because for now, only locality 0 is supported. Add a sanity check to I2C reads of e.g. TPM_ACCESS and TPM_STS. This is to detect communication errors and issues due to non-standard behaviour (E.g. the clock stretching quirk in the BCM2835, see 4dbfb5f). In case the sanity check fails, attempt a retry. Co-developed-by: Johannes Holland <johannes.holland@infineon.com> Signed-off-by: Johannes Holland <johannes.holland@infineon.com> Co-developed-by: Amir Mizinski <amirmizi6@gmail.com> Signed-off-by: Amir Mizinski <amirmizi6@gmail.com> Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
1 parent f25534a commit bbc23a0

File tree

3 files changed

+404
-0
lines changed

3 files changed

+404
-0
lines changed

drivers/char/tpm/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ config TCG_TIS_SPI_CR50
7474
If you have a H1 secure module running Cr50 firmware on SPI bus,
7575
say Yes and it will be accessible from within Linux.
7676

77+
config TCG_TIS_I2C
78+
tristate "TPM Interface Specification 1.3 Interface / TPM 2.0 FIFO Interface - (I2C - generic)"
79+
depends on I2C
80+
select CRC_CCITT
81+
select TCG_TIS_CORE
82+
help
83+
If you have a TPM security chip, compliant with the TCG TPM PTP
84+
(I2C interface) specification and connected to an I2C bus master,
85+
say Yes and it will be accessible from within Linux.
86+
To compile this driver as a module, choose M here;
87+
the module will be called tpm_tis_i2c.
88+
7789
config TCG_TIS_SYNQUACER
7890
tristate "TPM Interface Specification 1.2 Interface / TPM 2.0 FIFO Interface (MMIO - SynQuacer)"
7991
depends on ARCH_SYNQUACER || COMPILE_TEST

drivers/char/tpm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ tpm_tis_spi-$(CONFIG_TCG_TIS_SPI_CR50) += tpm_tis_spi_cr50.o
2929

3030
obj-$(CONFIG_TCG_TIS_I2C_CR50) += tpm_tis_i2c_cr50.o
3131

32+
obj-$(CONFIG_TCG_TIS_I2C) += tpm_tis_i2c.o
3233
obj-$(CONFIG_TCG_TIS_I2C_ATMEL) += tpm_i2c_atmel.o
3334
obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o
3435
obj-$(CONFIG_TCG_TIS_I2C_NUVOTON) += tpm_i2c_nuvoton.o

0 commit comments

Comments
 (0)