From: Florian Eckert <fe@dev.tdt.de>
To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca,
Eckert.Florian@googlemail.com
Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] tpm/tpm_i2c_infineon: Fix init endian vendor check
Date: Wed, 8 Sep 2021 15:34:16 +0200 [thread overview]
Message-ID: <20210908133416.12408-1-fe@dev.tdt.de> (raw)
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.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
---
drivers/char/tpm/tpm_i2c_infineon.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index a19d32cb4e94..111a8c34329a 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -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) {
--
2.20.1
next reply other threads:[~2021-09-08 13:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-08 13:34 Florian Eckert [this message]
2021-09-08 13:40 ` [PATCH] tpm/tpm_i2c_infineon: Fix init endian vendor check Jason Gunthorpe
2021-09-13 12:05 ` Florian Eckert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210908133416.12408-1-fe@dev.tdt.de \
--to=fe@dev.tdt.de \
--cc=Eckert.Florian@googlemail.com \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox