From patchwork Sun Apr 10 10:53:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrew Zamansky (NTIL)" X-Patchwork-Id: 8840811 Return-Path: X-Original-To: patchwork-tpmdd-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DA1F9C0555 for ; Thu, 14 Apr 2016 18:37:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D94B72020F for ; Thu, 14 Apr 2016 18:37:28 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E27A20361 for ; Thu, 14 Apr 2016 18:37:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aqm8q-0006ZP-10; Thu, 14 Apr 2016 18:37:24 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1apDOH-0006gK-On for tpmdd-devel@lists.sourceforge.net; Sun, 10 Apr 2016 11:18:53 +0000 X-ACL-Warn: Received: from maillog.nuvoton.com ([202.39.227.15]) by sog-mx-1.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1apDOF-0004aP-K2 for tpmdd-devel@lists.sourceforge.net; Sun, 10 Apr 2016 11:18:53 +0000 Received: from nthcims04.nuvoton.com (nthcims04.nuvoton.com [10.1.8.200]) by maillog.nuvoton.com (Postfix) with ESMTP id 6351B1C80549; Sun, 10 Apr 2016 18:53:38 +0800 (CST) Received: from NTILML02.nuvoton.com (10.190.1.46) by nthcims04.nuvoton.com (10.1.8.200) with Microsoft SMTP Server (TLS) id 8.3.327.1; Sun, 10 Apr 2016 18:53:37 +0800 Received: from NTILML02.nuvoton.com (10.190.1.46) by NTILML02.nuvoton.com (10.190.1.46) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Sun, 10 Apr 2016 13:53:32 +0300 Received: from taln70.nuvoton.co.il (10.191.1.70) by NTILML02.nuvoton.com (10.190.1.47) with Microsoft SMTP Server id 15.0.1130.7 via Frontend Transport; Sun, 10 Apr 2016 13:53:32 +0300 Received: by taln70.nuvoton.co.il (Postfix, from userid 10050) id 4CD954138; Sun, 10 Apr 2016 13:53:32 +0300 (IDT) Date: Sun, 10 Apr 2016 13:53:32 +0300 To: , , , , , , , User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Message-ID: <20160410105332.4CD954138@taln70.nuvoton.co.il> From: "Andrew Zamansky (NTIL)" X-Spam-Score: 1.2 (+) X-Headers-End: 1apDOF-0004aP-K2 X-Mailman-Approved-At: Thu, 14 Apr 2016 18:37:22 +0000 Subject: [tpmdd-devel] [PATCH 1/1] added tpm 2.0 support to nuvoton i2c driver X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces@lists.sourceforge.net X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_NXDOMAIN, HK_RANDOM_ENVFROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP >From 2fbdc8ad7b675270873a58d0934a675eb927f704 Mon Sep 17 00:00:00 2001 From: andrew azmansky Date: Thu, 7 Apr 2016 09:19:57 +0300 Subject: [PATCH 1/1] added tpm 2.0 support to nuvoton i2c driver add tpm 2.0 support to nuvoton i2c tpm driver Signed-off-by: andrew azmansky --- .../devicetree/bindings/i2c/trivial-devices.txt | 1 + drivers/char/tpm/tpm_i2c_nuvoton.c | 39 +++++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) -- 1.9.1 =========================================================================================== The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton. ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt index 53987449..0a07cbc 100644 --- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt +++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt @@ -62,6 +62,7 @@ national,lm80 Serial Interface ACPI-Compatible Microprocessor System Hardware M national,lm85 Temperature sensor with integrated fan control national,lm92 ±0.33°C Accurate, 12-Bit + Sign Temperature Sensor and Thermal Window Comparator with Two-Wire Interface nuvoton,npct501 i2c trusted platform module (TPM) +nuvoton,npct6xx i2c trusted platform module (TPM) 6xx series nxp,pca9556 Octal SMBus and I2C registered interface nxp,pca9557 8-bit I2C-bus and SMBus I/O port with reset nxp,pcf8563 Real-time clock/calendar diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c index 847f159..d87433b 100644 --- a/drivers/char/tpm/tpm_i2c_nuvoton.c +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Nuvoton TPM I2C Device Driver Interface for WPCT301/NPCT501, + * Nuvoton TPM I2C Device Driver Interface for WPCT301/NPCT501/NPCT6XX, * based on the TCG TPM Interface Spec version 1.2. * Specifications at www.trustedcomputinggroup.org * @@ -163,7 +163,7 @@ static int i2c_nuvoton_get_burstcount(struct i2c_client *client, } /* - * WPCT301/NPCT501 SINT# supports only dataAvail + * WPCT301/NPCT501/NPCT6XX SINT# supports only dataAvail * any call to this function which is not waiting for dataAvail will * set queue to NULL to avoid waiting for interrupt */ @@ -601,10 +601,38 @@ static int i2c_nuvoton_probe(struct i2c_client *client, } } - if (tpm_get_timeouts(chip)) - return -ENODEV; + rc = tpm2_probe(chip); + if (rc) + return rc; - if (tpm_do_selftest(chip)) + if (chip->flags & TPM_CHIP_FLAG_TPM2) { + chip->vendor.timeout_a = msecs_to_jiffies(TPM2_TIMEOUT_A); + chip->vendor.timeout_b = msecs_to_jiffies(TPM2_TIMEOUT_B); + chip->vendor.timeout_c = msecs_to_jiffies(TPM2_TIMEOUT_C); + chip->vendor.timeout_d = msecs_to_jiffies(TPM2_TIMEOUT_D); + chip->vendor.duration[TPM_SHORT] = + msecs_to_jiffies(TPM2_DURATION_SHORT); + chip->vendor.duration[TPM_MEDIUM] = + msecs_to_jiffies(TPM2_DURATION_MEDIUM); + chip->vendor.duration[TPM_LONG] = + msecs_to_jiffies(TPM2_DURATION_LONG); + + rc = tpm2_do_selftest(chip); + if (rc == TPM2_RC_INITIALIZE) { + if (tpm2_startup(chip, TPM2_SU_CLEAR)) + return -ENODEV; + + rc = tpm2_do_selftest(chip); + } + + } else { + if (tpm_get_timeouts(chip)) + return -ENODEV; + + rc = tpm_do_selftest(chip); + } + + if (rc) return -ENODEV; return tpm_chip_register(chip); @@ -628,6 +656,7 @@ MODULE_DEVICE_TABLE(i2c, i2c_nuvoton_id); static const struct of_device_id i2c_nuvoton_of_match[] = { {.compatible = "nuvoton,npct501"}, {.compatible = "winbond,wpct301"}, + {.compatible = "nuvoton,npct6xx"}, {}, }; MODULE_DEVICE_TABLE(of, i2c_nuvoton_of_match);