]> git.baikalelectronics.ru Git - kernel.git/commit
tpm: Add tpm_tis_i2c backend for tpm_tis_core
authorAlexander Steffen <Alexander.Steffen@infineon.com>
Wed, 8 Jun 2022 17:31:13 +0000 (19:31 +0200)
committerJarkko Sakkinen <jarkko@kernel.org>
Wed, 3 Aug 2022 20:56:20 +0000 (23:56 +0300)
commit9869836c0a8e1674ea67f8b4931eccb5c46c8ebd
tree21faa692d92b1cd57b297aa6fc01231287d08077
parent74fd220569b6f593c7160ff2f4ad66aeae0db83b
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 20dab16ea2f7). 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>
drivers/char/tpm/Kconfig
drivers/char/tpm/Makefile
drivers/char/tpm/tpm_tis_i2c.c [new file with mode: 0644]