From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BE15C433F5 for ; Wed, 8 Sep 2021 13:43:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E455E610FF for ; Wed, 8 Sep 2021 13:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232667AbhIHNoY (ORCPT ); Wed, 8 Sep 2021 09:44:24 -0400 Received: from mxout70.expurgate.net ([194.37.255.70]:47707 "EHLO mxout70.expurgate.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235462AbhIHNoX (ORCPT ); Wed, 8 Sep 2021 09:44:23 -0400 X-Greylist: delayed 520 seconds by postgrey-1.27 at vger.kernel.org; Wed, 08 Sep 2021 09:44:23 EDT Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1mNxii-0006AB-Gy; Wed, 08 Sep 2021 15:34:32 +0200 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNxih-000Bkh-Ed; Wed, 08 Sep 2021 15:34:31 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id E9F42240041; Wed, 8 Sep 2021 15:34:30 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 77837240040; Wed, 8 Sep 2021 15:34:30 +0200 (CEST) Received: from localhost.localdomain (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id ABC032029C; Wed, 8 Sep 2021 15:34:29 +0200 (CEST) From: Florian Eckert 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 Message-ID: <20210908133416.12408-1-fe@dev.tdt.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: 151534::1631108072-00000D29-D0C1529F/0/0 X-purgate: clean X-purgate-type: clean Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org 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 I= D 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 --- 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_i= 2c_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; } =20 + le32_to_cpus(&vendor); + if (vendor =3D=3D TPM_TIS_I2C_DID_VID_9645) { tpm_dev.chip_type =3D SLB9645; } else if (vendor =3D=3D TPM_TIS_I2C_DID_VID_9635) { --=20 2.20.1