Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp534466pxb; Wed, 8 Sep 2021 06:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy1savTxnBXFKwxLwwN3dOz7N1UTjoXKPvNm9zm/tuSxygH0copb/9JLavFZQEqWFhmajZ X-Received: by 2002:a6b:7710:: with SMTP id n16mr3360368iom.101.1631109066106; Wed, 08 Sep 2021 06:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631109066; cv=none; d=google.com; s=arc-20160816; b=EMI566vU8v0Ri5xavLvsLZvlCt5PeC4EXAemiJUepAicLjFdvvMfbSkGeT5YUvnGTU D4/4ClBB0wnIpBY1cFJt65n0gGXBQa0RR4RugL2dUzdsCBV49P0LMhO1WkeN42lw8bL5 OFpKSeKJQBLMLO3cSntaU4VTNjBd52xRf3jD2rPksLuzvE40wxGPIrtSfzgAKszUbYEv H0uo2SIUY39tShHhGT3swkghLQ0lhAjXsH3sKc7wf8bM5ChM5zRsZGuGex0MaIisRXU3 QTkOD37xYvE3niwQs2M2uf8PS6GLjgtBl7Ux4XwmeAjqNdMVSFQ8X7mW6a4/HzuqQKlN k4JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=/1NE4rOtyn9xNYVvOLAp2q26YzZElOhUXCb/U8pyIJE=; b=tg5nwGbwXRbmMuTEjz7aUYzYqYSHLejNz52BEHJd+LlYsoVnIsPOopo/1uj08URiZx vyO4HDQYe/J7jIGZ8E0h8r/2aq/hM6d32Y2Mxo6sOGXj/jK75k0NGuhh3JjqJPEiNrbw Ui9Bf196pJCHVwanhNl/hRXZT3TQ7UZ6jXKof4excH0i1hbeFLx/IHnqdiULqD3VTuGI 1EC4wCEU3jGrElwVMKh9TCA06VYYmzhnHc6xr8bizU0yRwJ4X9dMxo+zW0lCibU0rv// qRVROQJlYiU3kXSJXj086ORoWV9KMbnIn6tpI8qN2G5b8NgfHIOphDpBPR7A2F2RTNL/ 4JGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q7si2018816ilc.104.2021.09.08.06.50.52; Wed, 08 Sep 2021 06:51:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242771AbhIHNoY (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de 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-kernel@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