From: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v4 2/2] tpm: Add TPM 2.0 support to the Nuvoton i2c driver (NPCT6xx family)
Date: Mon, 18 Jul 2016 21:00:24 +0300 [thread overview]
Message-ID: <20160718180024.GA22594@intel.com> (raw)
In-Reply-To: <1468345311-8014-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On Tue, Jul 12, 2016 at 11:41:50AM -0600, Jason Gunthorpe wrote:
> The command flow is exactly the same, the core simply needs to be
> told to enable TPM2 mode when the compatible string indicates a
> TPM2.
>
> Signed-off-by: Andrew Azmansky <andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
> Tested-by: Andrew Zamansky <andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
I've been on a vacation since last week and will be until Aug 8th.
That's why there might be some delay with code reviews.
/Jarkko
> ---
> .../devicetree/bindings/i2c/trivial-devices.txt | 1 +
> drivers/char/tpm/tpm_i2c_nuvoton.c | 26 +++++++++++++++++-----
> 2 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
> index 539874490492..d4f654276cf9 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,npct601 i2c trusted platform module (TPM2)
> 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 6e404e0211dd..e3a9155ee671 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
> *
> @@ -31,6 +31,7 @@
> #include <linux/interrupt.h>
> #include <linux/wait.h>
> #include <linux/i2c.h>
> +#include <linux/of_device.h>
> #include "tpm.h"
>
> /* I2C interface offsets */
> @@ -52,7 +53,8 @@
> #define TPM_I2C_RETRY_DELAY_SHORT 2 /* msec */
> #define TPM_I2C_RETRY_DELAY_LONG 10 /* msec */
>
> -#define I2C_DRIVER_NAME "tpm_i2c_nuvoton"
> +#define OF_IS_TPM2 ((void *)1)
> +#define I2C_IS_TPM2 1
>
> struct priv_data {
> int irq;
> @@ -165,7 +167,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
> */
> @@ -545,6 +547,16 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
> if (!priv)
> return -ENOMEM;
>
> + if (dev->of_node) {
> + const struct of_device_id *of_id;
> +
> + of_id = of_match_device(dev->driver->of_match_table, dev);
> + if (of_id && of_id->data == OF_IS_TPM2)
> + chip->flags |= TPM_CHIP_FLAG_TPM2;
> + } else
> + if (id->driver_data == I2C_IS_TPM2)
> + chip->flags |= TPM_CHIP_FLAG_TPM2;
> +
> init_waitqueue_head(&priv->read_queue);
>
> /* Default timeouts */
> @@ -620,7 +632,8 @@ static int i2c_nuvoton_remove(struct i2c_client *client)
> }
>
> static const struct i2c_device_id i2c_nuvoton_id[] = {
> - {I2C_DRIVER_NAME, 0},
> + {"tpm_i2c_nuvoton"},
> + {"tpm2_i2c_nuvoton", .driver_data = I2C_IS_TPM2},
> {}
> };
> MODULE_DEVICE_TABLE(i2c, i2c_nuvoton_id);
> @@ -629,6 +642,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,npct601", .data = OF_IS_TPM2},
> {},
> };
> MODULE_DEVICE_TABLE(of, i2c_nuvoton_of_match);
> @@ -641,7 +655,7 @@ static struct i2c_driver i2c_nuvoton_driver = {
> .probe = i2c_nuvoton_probe,
> .remove = i2c_nuvoton_remove,
> .driver = {
> - .name = I2C_DRIVER_NAME,
> + .name = "tpm_i2c_nuvoton",
> .pm = &i2c_nuvoton_pm_ops,
> .of_match_table = of_match_ptr(i2c_nuvoton_of_match),
> },
> --
> 2.1.4
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: andrew.zamansky@nuvoton.com, tpmdd-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] tpm: Add TPM 2.0 support to the Nuvoton i2c driver (NPCT6xx family)
Date: Mon, 18 Jul 2016 21:00:24 +0300 [thread overview]
Message-ID: <20160718180024.GA22594@intel.com> (raw)
In-Reply-To: <1468345311-8014-3-git-send-email-jgunthorpe@obsidianresearch.com>
On Tue, Jul 12, 2016 at 11:41:50AM -0600, Jason Gunthorpe wrote:
> The command flow is exactly the same, the core simply needs to be
> told to enable TPM2 mode when the compatible string indicates a
> TPM2.
>
> Signed-off-by: Andrew Azmansky <andrew.zamansky@nuvoton.com>
> Tested-by: Andrew Zamansky <andrew.zamansky@nuvoton.com>
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
I've been on a vacation since last week and will be until Aug 8th.
That's why there might be some delay with code reviews.
/Jarkko
> ---
> .../devicetree/bindings/i2c/trivial-devices.txt | 1 +
> drivers/char/tpm/tpm_i2c_nuvoton.c | 26 +++++++++++++++++-----
> 2 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
> index 539874490492..d4f654276cf9 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,npct601 i2c trusted platform module (TPM2)
> 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 6e404e0211dd..e3a9155ee671 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
> *
> @@ -31,6 +31,7 @@
> #include <linux/interrupt.h>
> #include <linux/wait.h>
> #include <linux/i2c.h>
> +#include <linux/of_device.h>
> #include "tpm.h"
>
> /* I2C interface offsets */
> @@ -52,7 +53,8 @@
> #define TPM_I2C_RETRY_DELAY_SHORT 2 /* msec */
> #define TPM_I2C_RETRY_DELAY_LONG 10 /* msec */
>
> -#define I2C_DRIVER_NAME "tpm_i2c_nuvoton"
> +#define OF_IS_TPM2 ((void *)1)
> +#define I2C_IS_TPM2 1
>
> struct priv_data {
> int irq;
> @@ -165,7 +167,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
> */
> @@ -545,6 +547,16 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
> if (!priv)
> return -ENOMEM;
>
> + if (dev->of_node) {
> + const struct of_device_id *of_id;
> +
> + of_id = of_match_device(dev->driver->of_match_table, dev);
> + if (of_id && of_id->data == OF_IS_TPM2)
> + chip->flags |= TPM_CHIP_FLAG_TPM2;
> + } else
> + if (id->driver_data == I2C_IS_TPM2)
> + chip->flags |= TPM_CHIP_FLAG_TPM2;
> +
> init_waitqueue_head(&priv->read_queue);
>
> /* Default timeouts */
> @@ -620,7 +632,8 @@ static int i2c_nuvoton_remove(struct i2c_client *client)
> }
>
> static const struct i2c_device_id i2c_nuvoton_id[] = {
> - {I2C_DRIVER_NAME, 0},
> + {"tpm_i2c_nuvoton"},
> + {"tpm2_i2c_nuvoton", .driver_data = I2C_IS_TPM2},
> {}
> };
> MODULE_DEVICE_TABLE(i2c, i2c_nuvoton_id);
> @@ -629,6 +642,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,npct601", .data = OF_IS_TPM2},
> {},
> };
> MODULE_DEVICE_TABLE(of, i2c_nuvoton_of_match);
> @@ -641,7 +655,7 @@ static struct i2c_driver i2c_nuvoton_driver = {
> .probe = i2c_nuvoton_probe,
> .remove = i2c_nuvoton_remove,
> .driver = {
> - .name = I2C_DRIVER_NAME,
> + .name = "tpm_i2c_nuvoton",
> .pm = &i2c_nuvoton_pm_ops,
> .of_match_table = of_match_ptr(i2c_nuvoton_of_match),
> },
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-07-18 18:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-12 17:41 [PATCH v4 0/2] Nuvoton TPM2 support Jason Gunthorpe
[not found] ` <1468345311-8014-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-12 17:41 ` [PATCH v4 1/2] tpm: Factor out common startup code Jason Gunthorpe
2016-07-12 17:41 ` Jason Gunthorpe
2016-07-12 17:41 ` [PATCH v4 2/2] tpm: Add TPM 2.0 support to the Nuvoton i2c driver (NPCT6xx family) Jason Gunthorpe
2016-07-12 17:41 ` Jason Gunthorpe
[not found] ` <1468345311-8014-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-18 18:00 ` Jarkko Sakkinen [this message]
2016-07-18 18:00 ` Jarkko Sakkinen
2016-07-18 18:03 ` [PATCH v4 0/2] Nuvoton TPM2 support Jarkko Sakkinen
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=20160718180024.GA22594@intel.com \
--to=jarkko.sakkinen-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.