Skip to contentSkip to conversation

tpm/tpm_i2c_infineon: Fix init endian vendor check

PATCH Superseded Florian Eckert 2 participants 3 messages Sep 8, 2021 – Sep 13, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm/tpm_i2c_infineon: Fix init endian vendor check

On my embedded system I use this tpm infineon chip via I2C. My system is a MIPS architecture and therefore works in big endian mode.

The problem is that the chip type is not recognised, because the vendor ID is incorrectly stored in memory.

By converting the vendor ID with ie32_to_cpus() to the correct format, the TPM chip is recognised by the driver and works as expected.

---
 drivers/char/tpm/tpm_i2c_infineon.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/char/tpm/tpm_i2c_infineon.c +2 -0
index a19d32cb4e94..111a8c34329a 100644
@@ -638,6 +638,8 @@ static int tpm_tis_i2c_init(struct device *dev)
 		goto out_release;
 	}
 
+	le32_to_cpus(&vendor);
+
 	if (vendor == TPM_TIS_I2C_DID_VID_9645) {
 		tpm_dev.chip_type = SLB9645;
 	} else if (vendor == TPM_TIS_I2C_DID_VID_9635) {
Signature · 1 line
2.20.1
#1 lore raw
Quoted 6 lines · Florian Eckert

On my embedded system I use this tpm infineon chip via I2C. My system is a MIPS architecture and therefore works in big endian mode.

The problem is that the chip type is not recognised, because the vendor ID is incorrectly stored in memory.

Quoted 7 lines

By converting the vendor ID with ie32_to_cpus() to the correct format, the TPM chip is recognised by the driver and works as expected.

---
 drivers/char/tpm/tpm_i2c_infineon.c | 2 ++
 1 file changed, 2 insertions(+)

vendor should be marked as a __le32 and so forth

Jason

#2 lore raw
Quoted 9 lines
Quoted 7 lines

By converting the vendor ID with ie32_to_cpus() to the correct format, the TPM chip is recognised by the driver and works as expected.

---
 drivers/char/tpm/tpm_i2c_infineon.c | 2 ++
 1 file changed, 2 insertions(+)

vendor should be marked as a __le32 and so forth

Thanks for your feedback. I will push a v2.

Quoted 2 lines

Jason