Re: [PATCH] st33zp24 fix when using irq mode

2015-03-19 Thread Peter Hüwe
Hi,

great timing :) I just sent the pull request for 4.1 out yesterday :)
But thanks for spotting and fixing it. 
Found bugs are good bugs, and fixed ones are even better.

Am Donnerstag, 19. März 2015, 22:15:08 schrieb Christophe Ricard:
 Hi,
 
 Please find in this patch a fix that fix an improper command completion
 wait. This patch apply on top of for-james branch
 tpm/tpm_infineon: Use struct dev_pm_ops for power management
 6b37729bd184fdd44f144c6cc4951b06b55bcf4b
 
 *** Note: This bug is also present in kernel 4.0 but will not apply as the
 driver structure changed between kernel 4.0 and kernel 4.1.
 
 A backported version is also going to be sent to sta...@vger.kernel.org ?

Are kernels  4.0 also affected or was this code introduced in 4.0 ?

How critical is the mentioned 'critical failure' ? What will happen?
How often does it happen?  

If this thing is big enough and kernels  4.0 are not affected we can try to 
get it into 4.0 still, so no stable. (but I still need the backport :) )


If it won't hit 4.0 then backport to 4.0.1 is needed,
which will be sent to stable@...
with the upstream commit mentioned.


See 
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/stable_kernel_rules.txt

Thanks,
Peter


--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v8 0/4] st33zp24 new architecture proposal and st33zp24 spi driver

2015-03-14 Thread Peter Hüwe
Hi Christophe,

 Do you see any issue with this patch series to hit kernel revision 4.1 ?
sorry for the delay. 
No I think v8 is fine (hey it's already v8 ;-))

I added it to my tree (for-james) and will include it in the next pull request 
which will be sent in a few days.

Thanks for your patches - and sorry it took so long - it's only my spare time, 
which is limited.

Would of course be easier if the TPM vendors would support it more (e.g. HW).

Thanks,
Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 0/4] st33zp24 new architecture proposal and st33zp24 spi driver

2015-02-10 Thread Peter Hüwe
Hi Christophe,

 
 Any news on this patchset ?
 

Unfortunately not - I'm still lacking behind due to a big cold I caught.

I'll add it once I pushed the fixes for 3.20 out.
(still waiting on vicky's fixed patchset)

Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 0/4] st33zp24 new architecture proposal and st33zp24 spi driver

2015-01-26 Thread Peter Hüwe
Hi Christophe,

Am Sonntag, 25. Januar 2015, 22:11:29 schrieb Christophe Ricard:
 Hi,
 
 The following patchset:
 - propose a new architecture allowing to share a core st33zp24 data
 management layer with different phy (i2c  spi). For st33zp24 both phy
 have a proprietary transport protocol. Both are relying on the TCG TIS
 protocol. At the end, it simplifies the maintenance. - Add an spi phy
 allowing to support st33zp24 using with an SPI bus.
 
 The complete solution got tested in polling and interrupt mode successfully
 with i2c  spi phy. This patchset applies on top of Peter's tree
 https://github.com/PeterHuewe/linux-tpmdd.git for-james branch on top of:
 d4989d9f693b9502f9288da5db279c2f8c2e50be tpm/tpm_tis: Add missing ifdef
 CONFIG_ACPI for pnp_acpi_device
 
 I confirm also Jarkko Sakkinen's changes are working with this product with
 both phy's.
 
 - v2 takes into account feedbacks from Jason Gunthorpe.
 - v3 is reduced to 4 patches as 6 out of 10 got accepted for 3.20. Also
 compare to v2: * Fix build issue with patch v2 04/10 Replace access to
 io_lpcpd from struct st33zp24_platform_data to tpm_stm_dev * Fix link
 issue with patch v2 08/10 Split tpm_i2c_tpm_st33 in 2 layers (core +
 phy) when building as a module. The symbols wasn't exported in
 st33zp24.c.
 * Add missing MODULE_LICENSE in patch v2 09/10 Add st33zp24 spi
 phy * Fix node example in dts spi documentation in patch v2 10/10 Add
 dts documentation for st33zp24 spi phy * Fix typo on Jason Gunthorpe
 first name. Sorry for that :(... * Change contact email address as
 tpmsupp...@st.com is no more valid - v4 adds missing module_license in
 st33zp24

I'll review the stuff (since I cannot test :) during the next few days.
Meanwhile I added to my 'staging tree'
https://github.com/PeterHuewe/linux-tpmdd/tree/testing-and-review

I doubt that James will accept it for 3.20.

Thanks,
Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 1/4] tpm/tpm_i2c_stm_st33: Replace access to io_lpcpd from struct st33zp24_platform_data to tpm_stm_dev

2015-01-26 Thread Peter Hüwe
Hi Christophe,
Am Sonntag, 25. Januar 2015, 22:11:30 schrieb Christophe Ricard:
 io_lpcpd is accessible from struct tpm_stm_dev.
 struct st33zp24_platform_data is only valid when using static platform
 configuration data, not when using dts.
 
 Reviewed-by: Jason Gunthorpe jason.guntho...@obsidianresearch.com
 Signed-off-by: Christophe Ricard christophe-h.ric...@st.com
 ---
  drivers/char/tpm/tpm_i2c_stm_st33.c | 18 +++---
  1 file changed, 11 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c
 b/drivers/char/tpm/tpm_i2c_stm_st33.c index 612845b..882c60a 100644
 --- a/drivers/char/tpm/tpm_i2c_stm_st33.c
 +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
 @@ -837,11 +837,14 @@ static int tpm_stm_i2c_remove(struct i2c_client
 *client) */
  static int tpm_stm_i2c_pm_suspend(struct device *dev)
  {
 - struct st33zp24_platform_data *pin_infos = dev-platform_data;
 + struct tpm_chip *chip = dev_get_drvdata(dev);
 + struct tpm_stm_dev *tpm_dev;
   int ret = 0;
 
 - if (gpio_is_valid(pin_infos-io_lpcpd))
 - gpio_set_value(pin_infos-io_lpcpd, 0);
 + tpm_dev = (struct tpm_stm_dev *)TPM_VPRIV(chip);
 +
 + if (gpio_is_valid(tpm_dev-io_lpcpd))
 + gpio_set_value(tpm_dev-io_lpcpd, 0);
   else
   ret = tpm_pm_suspend(dev);

I know this is not changed by this patch, but
don't you need to send a tpm savestate? or is this implicit by pulling 
io_lpcpd ?



 
 @@ -856,12 +859,13 @@ static int tpm_stm_i2c_pm_suspend(struct device *dev)
  static int tpm_stm_i2c_pm_resume(struct device *dev)
  {
   struct tpm_chip *chip = dev_get_drvdata(dev);
 - struct st33zp24_platform_data *pin_infos = dev-platform_data;
 -
 + struct tpm_stm_dev *tpm_dev;
   int ret = 0;
 
 - if (gpio_is_valid(pin_infos-io_lpcpd)) {
 - gpio_set_value(pin_infos-io_lpcpd, 1);
 + tpm_dev = (struct tpm_stm_dev *)TPM_VPRIV(chip);
 +
 + if (gpio_is_valid(tpm_dev-io_lpcpd)) {
 + gpio_set_value(tpm_dev-io_lpcpd, 1);
   ret = wait_for_stat(chip,
   TPM_STS_VALID, chip-vendor.timeout_b,
   chip-vendor.read_queue, false);


Same applies to startup(STATE) on resume?

Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 3/4] tpm/st33zp24/spi: Add st33zp24 spi phy

2015-01-26 Thread Peter Hüwe
Am Sonntag, 25. Januar 2015, 22:11:32 schrieb Christophe Ricard:
 st33zp24 TIS 1.2 support also SPI. It is using a proprietary protocol to
 transport TIS data.
 
 Reviewed-by: Jason Gunthorpe jason.guntho...@obsidianresearch.com
 Signed-off-by: Christophe Ricard christophe-h.ric...@st.com
 ---
  drivers/char/tpm/st33zp24/Kconfig  |  10 +
  drivers/char/tpm/st33zp24/Makefile |   3 +
  drivers/char/tpm/st33zp24/spi.c| 386
 + 3 files changed, 399 insertions(+)
  create mode 100644 drivers/char/tpm/st33zp24/spi.c
 
 diff --git a/drivers/char/tpm/st33zp24/Kconfig
 b/drivers/char/tpm/st33zp24/Kconfig index 51dcef5..09cb7278 100644
 --- a/drivers/char/tpm/st33zp24/Kconfig
 +++ b/drivers/char/tpm/st33zp24/Kconfig
 @@ -18,3 +18,13 @@ config TCG_TIS_ST33ZP24_I2C
 ST33ZP24 with i2c interface.
 To compile this driver as a module, choose M here; the module will be
 called tpm_st33zp24_i2c.
 +
 +config TCG_TIS_ST33ZP24_SPI
 + tristate TPM 1.2 ST33ZP24 SPI support
 + depends on TCG_TIS_ST33ZP24
 + depends on SPI
 + ---help---
 +   This module adds support for the STMicroelectronics TPM security chip
 +   ST33ZP24 with spi interface.
 +   To compile this driver as a module, choose M here; the module will be
 +   called tpm_st33zp24_spi.
 diff --git a/drivers/char/tpm/st33zp24/Makefile
 b/drivers/char/tpm/st33zp24/Makefile index 414497f..74a722e 100644
 --- a/drivers/char/tpm/st33zp24/Makefile
 +++ b/drivers/char/tpm/st33zp24/Makefile
 @@ -7,3 +7,6 @@ obj-$(CONFIG_TCG_TIS_ST33ZP24) += tpm_st33zp24.o
 
  tpm_st33zp24_i2c-objs = i2c.o
  obj-$(CONFIG_TCG_TIS_ST33ZP24_I2C) += tpm_st33zp24_i2c.o
 +
 +tpm_st33zp24_spi-objs = spi.o
 +obj-$(CONFIG_TCG_TIS_ST33ZP24_SPI) += tpm_st33zp24_spi.o
 diff --git a/drivers/char/tpm/st33zp24/spi.c
 b/drivers/char/tpm/st33zp24/spi.c new file mode 100644
 index 000..d481478
 --- /dev/null
 +++ b/drivers/char/tpm/st33zp24/spi.c
 @@ -0,0 +1,386 @@
 +/*
 + * STMicroelectronics TPM SPI Linux driver for TPM ST33ZP24
 + * Copyright (C) 2009 - 2015  STMicroelectronics
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, see http://www.gnu.org/licenses/.
 + */
 +
 +#include linux/module.h
 +#include linux/spi/spi.h
 +#include linux/gpio.h
 +#include linux/of_irq.h
 +#include linux/of_gpio.h
 +#include linux/tpm.h
 +#include linux/platform_data/st33zp24.h
 +
 +#include st33zp24.h
 +
 +#define TPM_DATA_FIFO   0x24
 +#define TPM_INTF_CAPABILITY 0x14
 +
 +#define TPM_DUMMY_BYTE   0x00
 +#define TPM_WRITE_DIRECTION  0x80
 +#define TPM_BUFSIZE  2048
see previous email :)
 +
 +#define MAX_SPI_LATENCY  15
 +#define LOCALITY00
 +
 +#define ST33ZP24_OK  0x5A
 +#define ST33ZP24_UNDEFINED_ERR   0x80
 +#define ST33ZP24_BADLOCALITY 0x81
 +#define ST33ZP24_TISREGISTER_UKNOWN  0x82
 +#define ST33ZP24_LOCALITY_NOT_ACTIVATED  0x83
 +#define ST33ZP24_HASH_END_BEFORE_HASH_START  0x84
 +#define ST33ZP24_BAD_COMMAND_ORDER   0x85
 +#define ST33ZP24_INCORECT_RECEIVED_LENGTH0x86
 +#define ST33ZP24_TPM_FIFO_OVERFLOW   0x89
 +#define ST33ZP24_UNEXPECTED_READ_FIFO0x8A
 +#define ST33ZP24_UNEXPECTED_WRITE_FIFO   0x8B
 +#define ST33ZP24_CMDRDY_SET_WHEN_PROCESSING_HASH_END 0x90
 +#define ST33ZP24_DUMMY_BYTES 0x00
 +
 +struct st33zp24_spi_phy {
 + struct spi_device *spi_device;
 + struct spi_transfer spi_xfer;
 + int io_lpcpd;
 + int latency;
 +};
 +
 +static int st33zp24_status_to_errno(u8 code)
 +{
 + switch (code) {
 + case ST33ZP24_OK:
 + return 0;
 + case ST33ZP24_UNDEFINED_ERR:
 + case ST33ZP24_BADLOCALITY:
 + case ST33ZP24_TISREGISTER_UKNOWN:
 + case ST33ZP24_LOCALITY_NOT_ACTIVATED:
 + case ST33ZP24_HASH_END_BEFORE_HASH_START:
 + case ST33ZP24_BAD_COMMAND_ORDER:
 + case ST33ZP24_UNEXPECTED_READ_FIFO:
 + case ST33ZP24_UNEXPECTED_WRITE_FIFO:
 + case ST33ZP24_CMDRDY_SET_WHEN_PROCESSING_HASH_END:
 + return -EPROTO;
 + case ST33ZP24_INCORECT_RECEIVED_LENGTH:
 + case ST33ZP24_TPM_FIFO_OVERFLOW:
 + return -EMSGSIZE;
 + case ST33ZP24_DUMMY_BYTES:
 + default:
 +   

Re: [PATCH v4 2/4] tpm/tpm_i2c_stm_st33: Split tpm_i2c_tpm_st33 in 2 layers (core + phy)

2015-01-26 Thread Peter Hüwe
Hi Christophe,

some superficial (and picky) reviews below - in general I like it.

Peter

Am Sonntag, 25. Januar 2015, 22:11:31 schrieb Christophe Ricard:
 tpm_i2c_stm_st33 is a TIS 1.2 TPM with a core interface which can be used
 by different phy such as i2c or spi. The core part is called st33zp24 which
 is also the main part reference.
 
 include/linux/platform_data/tpm_stm_st33.h is renamed consequently.
 The driver is also split into an i2c phy in charge of sending/receiving
 data as well as managing platform data or dts configuration.
 
 Reviewed-by: Jason Gunthorpe jason.guntho...@obsidianresearch.com
 Signed-off-by: Christophe Ricard christophe-h.ric...@st.com
 ---
  drivers/char/tpm/Kconfig   |  11 +-
  drivers/char/tpm/Makefile  |   2 +-
  drivers/char/tpm/st33zp24/Kconfig  |  20 +
  drivers/char/tpm/st33zp24/Makefile |   9 +
  drivers/char/tpm/st33zp24/i2c.c| 278 +
  drivers/char/tpm/st33zp24/st33zp24.c   | 691 ++
  drivers/char/tpm/st33zp24/st33zp24.h   |  34 ++
  drivers/char/tpm/tpm_i2c_stm_st33.c| 915
 - include/linux/platform_data/st33zp24.h |
  28 +
  include/linux/platform_data/tpm_stm_st33.h |  39 --
  10 files changed, 1062 insertions(+), 965 deletions(-)
  create mode 100644 drivers/char/tpm/st33zp24/Kconfig
  create mode 100644 drivers/char/tpm/st33zp24/Makefile
  create mode 100644 drivers/char/tpm/st33zp24/i2c.c
  create mode 100644 drivers/char/tpm/st33zp24/st33zp24.c
  create mode 100644 drivers/char/tpm/st33zp24/st33zp24.h
  delete mode 100644 drivers/char/tpm/tpm_i2c_stm_st33.c
  create mode 100644 include/linux/platform_data/st33zp24.h
  delete mode 100644 include/linux/platform_data/tpm_stm_st33.h
 
 diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
 index 9d4e375..2dc16d3 100644
 --- a/drivers/char/tpm/Kconfig
 +++ b/drivers/char/tpm/Kconfig
 @@ -100,16 +100,6 @@ config TCG_IBMVTPM
 will be accessible from within Linux.  To compile this driver
 as a module, choose M here; the module will be called tpm_ibmvtpm.
 
 -config TCG_TIS_I2C_ST33
 - tristate TPM Interface Specification 1.2 Interface (I2C -
 STMicroelectronics) -depends on I2C
 - depends on GPIOLIB
 - ---help---
 -   If you have a TPM security chip from STMicroelectronics working with
 -   an I2C bus say Yes and it will be accessible from within Linux.
 -   To compile this driver as a module, choose M here; the module will be
 -   called tpm_i2c_stm_st33.
 -
  config TCG_XEN
   tristate XEN TPM Interface
   depends on TCG_TPM  XEN
 @@ -131,4 +121,5 @@ config TCG_CRB
 from within Linux.  To compile this driver as a module, choose
 M here; the module will be called tpm_crb.
 
 +source drivers/char/tpm/st33zp24/Kconfig
  endif # TCG_TPM
 diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
 index 990cf18..56e8f1f 100644
 --- a/drivers/char/tpm/Makefile
 +++ b/drivers/char/tpm/Makefile
 @@ -20,6 +20,6 @@ obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
  obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
  obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
  obj-$(CONFIG_TCG_IBMVTPM) += tpm_ibmvtpm.o
 -obj-$(CONFIG_TCG_TIS_I2C_ST33) += tpm_i2c_stm_st33.o
 +obj-$(CONFIG_TCG_TIS_ST33ZP24) += st33zp24/
  obj-$(CONFIG_TCG_XEN) += xen-tpmfront.o
  obj-$(CONFIG_TCG_CRB) += tpm_crb.o
 diff --git a/drivers/char/tpm/st33zp24/Kconfig
 b/drivers/char/tpm/st33zp24/Kconfig new file mode 100644
 index 000..51dcef5
 --- /dev/null
 +++ b/drivers/char/tpm/st33zp24/Kconfig
 @@ -0,0 +1,20 @@
 +config TCG_TIS_ST33ZP24
 + tristate STMicroelectronics TPM Interface Specification 1.2 Interface
 + depends on GPIOLIB
 + ---help---
 +   STMicroelectronics ST33ZP24 core driver. It implements the core
 +   TPM1.2 logic and hooks into the TPM kernel APIs. Physical layers will
 +   register against it.
 +
 +   To compile this driver as a module, choose m here. The module will be
 called +tpm_st33zp24.
 +
 +config TCG_TIS_ST33ZP24_I2C
 + tristate TPM 1.2 ST33ZP24 I2C support
 + depends on TCG_TIS_ST33ZP24
 + depends on I2C
 + ---help---
 +   This module adds support for the STMicroelectronics TPM security chip
 +   ST33ZP24 with i2c interface.
 +   To compile this driver as a module, choose M here; the module will be
 +   called tpm_st33zp24_i2c.
 diff --git a/drivers/char/tpm/st33zp24/Makefile
 b/drivers/char/tpm/st33zp24/Makefile new file mode 100644
 index 000..414497f
 --- /dev/null
 +++ b/drivers/char/tpm/st33zp24/Makefile
 @@ -0,0 +1,9 @@
 +#
 +# Makefile for ST33ZP24 TPM 1.2 driver
 +#
 +
 +tpm_st33zp24-objs = st33zp24.o
 +obj-$(CONFIG_TCG_TIS_ST33ZP24) += tpm_st33zp24.o
 +
 +tpm_st33zp24_i2c-objs = i2c.o
 +obj-$(CONFIG_TCG_TIS_ST33ZP24_I2C) += tpm_st33zp24_i2c.o
 diff --git a/drivers/char/tpm/st33zp24/i2c.c
 b/drivers/char/tpm/st33zp24/i2c.c new file mode 100644
 

Re: [PATCH v3 0/4] st33zp24 new architecture proposal and st33zp24 spi driver

2015-01-25 Thread Peter Hüwe
Am Sonntag, 25. Januar 2015, 16:34:53 schrieb Christophe Ricard:
 Hi,
 
 The following patchset:
 - propose a new architecture allowing to share a core st33zp24 data
 management layer with different phy (i2c  spi). For st33zp24 both phy
 have a proprietary transport protocol. Both are relying on the TCG TIS
 protocol. At the end, it simplifies the maintenance. - Add an spi phy
 allowing to support st33zp24 using with an SPI bus.
 
 The complete solution got tested in polling and interrupt mode successfully
 with i2c  spi phy. This patchset applies on top of Peter's tree
 https://github.com/PeterHuewe/linux-tpmdd.git for-james branch on top of:
 d4989d9f693b9502f9288da5db279c2f8c2e50be tpm/tpm_tis: Add missing ifdef
 CONFIG_ACPI for pnp_acpi_device
 
 I confirm also Jarkko Sakkinen's changes are working with this product with
 both phy's.
 
 - v2 takes into account feedbacks from Jason Gunthorpe.
 - v3 is reduced to 4 patches as 6 out of 10 got accepted for 3.20. Also
 compare to v2: * Fix build issue with patch v2 04/10 Replace access to
 io_lpcpd from struct st33zp24_platform_data to tpm_stm_dev * Fix link
 issue with patch v2 08/10 Split tpm_i2c_tpm_st33 in 2 layers (core +
 phy) when building as a module. The symbols wasn't exported in
 st33zp24.c.
   * Add missing MODULE_LICENSE in patch v2 09/10 Add st33zp24 spi phy
   * Fix node example in dts spi documentation in patch v2 10/10 Add dts
 documentation for st33zp24 spi phy * Fix typo on Jason Gunthorpe first
 name. Sorry for that :(...

[169760.443732] tpm_st33zp24: module license 'unspecified' taints kernel.

:(

Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 10/10] tpm/st33zp24/dts/st33zp24-spi: Add dts documentation for st33zp24 spi phy

2015-01-17 Thread Peter Hüwe
Am Dienstag, 13. Januar 2015, 23:13:18 schrieb Christophe Ricard:
 +Example (for ARM-based BeagleBoard xM with ST33ZP24 on SPI2):
 +
 +i2c2 {
^^^

I2C for SPI?!
Doubt this is correct :)


 +
 +status = okay;
 +
 +st33zp24@0 {
 +

Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/10] st33zp24 new architecture proposal and st33zp24 spi driver

2015-01-17 Thread Peter Hüwe
Hi,

 v2 takes into account feedbacks from Jason Gunthorpe.
On most patches you have written jaso_b_ instead of jason ... I'll fix this. 

And for some kind of reason not every patch shows up in patchwork like 1/10 - 
I'll have to investigate this.


Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 09/10] tpm/st33zp24/spi: Add st33zp24 spi phy

2015-01-17 Thread Peter Hüwe
Am Dienstag, 13. Januar 2015, 23:13:17 schrieb Christophe Ricard:
 st33zp24 TIS 1.2 support also SPI. It is using a proprietary protocol to
 transport TIS data.
 
 Reviewed-by: Jasob Gunthorpe jason.guntho...@obsidianresearch.com
 Signed-off-by: Christophe Ricard christophe-h.ric...@st.com

 +
 +MODULE_AUTHOR(Christophe Ricard (tpmsupp...@st.com));
 +MODULE_DESCRIPTION(STM TPM 1.2 SPI ST33 Driver);
 +MODULE_VERSION(1.3.0);

Missing MODULE_LICENSE!

WARNING: modpost: missing MODULE_LICENSE() in 
drivers/char/tpm/st33zp24/tpm_st33zp24_spi.o

-- does not compile.
Judging from the header, can I add 
MODULE_LICENSE(GPL) 
?
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 08/10] tpm/tpm_i2c_stm_st33: Split tpm_i2c_tpm_st33 in 2 layers (core + phy)

2015-01-17 Thread Peter Hüwe
Am Dienstag, 13. Januar 2015, 23:13:16 schrieb Christophe Ricard:
 tpm_i2c_stm_st33 is a TIS 1.2 TPM with a core interface which can be used
 by different phy such as i2c or spi. The core part is called st33zp24 which
 is also the main part reference.
 
 include/linux/platform_data/tpm_stm_st33.h is renamed consequently.
 The driver is also split into an i2c phy in charge of sending/receiving
 data as well as managing platform data or dts configuration.
 
 Reviewed-by: Jasob Gunthorpe jason.guntho...@obsidianresearch.com
 Signed-off-by: Christophe Ricard christophe-h.ric...@st.com


Fails to link for me ;(

 make -j24 
  CHK include/config/kernel.release
  CHK include/generated/uapi/linux/version.h
  CHK include/generated/utsrelease.h
  CALLscripts/checksyscalls.sh
  CHK include/generated/compile.h
  LD  drivers/char/tpm/built-in.o
  CC [M]  drivers/char/tpm/tpm-interface.o
  CHK kernel/config_data.h
  CC [M]  drivers/char/tpm/tpm-dev.o
  CC [M]  drivers/char/tpm/tpm-sysfs.o
  CC [M]  drivers/char/tpm/tpm-chip.o
  CC [M]  drivers/char/tpm/tpm2-cmd.o
  CC [M]  drivers/char/tpm/tpm_ppi.o
  CC [M]  drivers/char/tpm/tpm_acpi.o
  CC [M]  drivers/char/tpm/tpm_eventlog.o
  CC [M]  drivers/char/tpm/tpm_tis.o
  CC [M]  drivers/char/tpm/tpm_i2c_infineon.o
  CC [M]  drivers/char/tpm/tpm_i2c_atmel.o
  CC [M]  drivers/char/tpm/tpm_i2c_nuvoton.o
  CC [M]  drivers/char/tpm/tpm_atmel.o
  CC [M]  drivers/char/tpm/tpm_nsc.o
  CC [M]  drivers/char/tpm/tpm_infineon.o
  CC [M]  drivers/char/tpm/tpm_crb.o
  LD  drivers/char/tpm/st33zp24/built-in.o
  CC [M]  drivers/char/tpm/st33zp24/st33zp24.o
  CC [M]  drivers/char/tpm/st33zp24/i2c.o
  CC [M]  drivers/char/tpm/st33zp24/spi.o
  LD [M]  drivers/char/tpm/tpm.o
  LD [M]  drivers/char/tpm/st33zp24/tpm_st33zp24_i2c.o
  LD [M]  drivers/char/tpm/st33zp24/tpm_st33zp24_spi.o
  LD [M]  drivers/char/tpm/st33zp24/tpm_st33zp24.o
  Building modules, stage 2.
Kernel: arch/x86/boot/bzImage is ready  (#195)
  MODPOST 817 modules
ERROR: st33zp24_probe [drivers/char/tpm/st33zp24/tpm_st33zp24_spi.ko] 
undefined!
ERROR: st33zp24_pm_suspend [drivers/char/tpm/st33zp24/tpm_st33zp24_spi.ko] 
undefined!
ERROR: st33zp24_remove [drivers/char/tpm/st33zp24/tpm_st33zp24_spi.ko] 
undefined!
ERROR: st33zp24_pm_resume [drivers/char/tpm/st33zp24/tpm_st33zp24_spi.ko] 
undefined!
ERROR: st33zp24_probe [drivers/char/tpm/st33zp24/tpm_st33zp24_i2c.ko] 
undefined!
ERROR: st33zp24_pm_suspend [drivers/char/tpm/st33zp24/tpm_st33zp24_i2c.ko] 
undefined!
ERROR: st33zp24_remove [drivers/char/tpm/st33zp24/tpm_st33zp24_i2c.ko] 
undefined!
ERROR: st33zp24_pm_resume [drivers/char/tpm/st33zp24/tpm_st33zp24_i2c.ko] 
undefined!
scripts/Makefile.modpost:90: recipe for target '__modpost' failed
make[1]: *** [__modpost] Error 1
Makefile:1099: recipe for target 'modules' failed
make: *** [modules] Error 2


Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 04/10] tpm/tpm_i2c_stm_st33: Replace access to io_lpcpd from struct st33zp24_platform_data to tpm_stm_dev

2015-01-17 Thread Peter Hüwe
Am Dienstag, 13. Januar 2015, 23:13:12 schrieb Christophe Ricard:
 io_lpcpd is accessible from struct tpm_stm_dev.
 struct st33zp24_platform_data is only valid when using static platform
 configuration data, not when using dts.
 
 Reviewed-by: Jasob Gunthorpe jason.guntho...@obsidianresearch.com
 Signed-off-by: Christophe Ricard christophe-h.ric...@st.com
 ---
  drivers/char/tpm/tpm_i2c_stm_st33.c | 16 ++--
  1 file changed, 10 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c
 b/drivers/char/tpm/tpm_i2c_stm_st33.c index d12d507..9d3c9c8 100644
 --- a/drivers/char/tpm/tpm_i2c_stm_st33.c
 +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
 @@ -834,11 +834,14 @@ static int tpm_stm_i2c_remove(struct i2c_client
 *client) */
  static int tpm_stm_i2c_pm_suspend(struct device *dev)
  {
 - struct st33zp24_platform_data *pin_infos = dev-platform_data;
 + struct tpm_chip *chip = dev_get_drvdata(dev);
 + struct tpm_stm_dev *tpm_dev;
   int ret = 0;
 
 - if (gpio_is_valid(pin_infos-io_lpcpd))
 - gpio_set_value(pin_infos-io_lpcpd, 0);
 + tpm_dev = (struct tpm_stm_dev *)TPM_VPRIV(chip);
 +
 + if (gpio_is_valid(tpm_dev-io_lpcpd))
 + gpio_set_value(tpm_dev-io_lpcpd, 0);
   else
   ret = tpm_pm_suspend(dev);

patch is not self contained and fails to build.

drivers/char/tpm/tpm_i2c_stm_st33.c: In function 'tpm_stm_i2c_pm_resume':
drivers/char/tpm/tpm_i2c_stm_st33.c:864:20: error: 'pin_infos' undeclared 
(first use in this function)
  if (gpio_is_valid(pin_infos-io_lpcpd)) {
^
drivers/char/tpm/tpm_i2c_stm_st33.c:864:20: note: each undeclared identifier 
is reported only once for each function it appears in
scripts/Makefile.build:263: recipe for target 
'drivers/char/tpm/tpm_i2c_stm_st33.o' failed
make[3]: *** [drivers/char/tpm/tpm_i2c_stm_st33.o] Error 1
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/10] st33zp24 new architecture proposal and st33zp24 spi driver

2015-01-17 Thread Peter Hüwe
Am Dienstag, 13. Januar 2015, 23:13:08 schrieb Christophe Ricard:
 Hi,
 
 The following patchset:
 - clean the current tpm_i2c_stm_st33 driver
 - propose a new architecture allowing to share a core st33zp24 data
 management layer with different phy (i2c  spi). For st33zp24 both phy
 have a proprietary transport protocol. Both are relying on the TCG TIS
 protocol. At the end, it simplifies the maintenance. - Add an spi phy
 allowing to support st33zp24 using with an SPI bus.
 
 The complete solution got tested in polling and interrupt mode successfully
 with i2c  spi phy. This patchset applies on top of Peter's tree
 https://github.com/PeterHuewe/linux-tpmdd.git for-james branch on top of:
 tpm: TPM 2.0 FIFO Interface 2c71d9fb22289a196a4b51d6158cf0d2f9abcfb9
 
 I confirm also Jarkko Sakkinen's changes are working with this product with
 both phy's.
 
 v2 takes into account feedbacks from Jason Gunthorpe.
 
 Best Regards
 Christophe
 
 Christophe Ricard (10):
   tpm/tpm_i2c_stm_st33: Remove sparse spaces
Applied
   tpm/tpm_i2c_stm_st33: Sanity cleanup
Applied
   tpm/tpm_i2c_stm_st33: Replace remaining r by ret
Applied
   tpm/tpm_i2c_stm_st33: Replace access to io_lpcpd from struct 
st33zp24_platform_data to tpm_stm_dev
please fix

   tpm/tpm_i2c_stm_st33: Change tpm_i2c_stm_st33.h to tpm_stm_st33.h
Applied

   tpm/tpm_i2c_stm_st33: Add status check when reading data on the FIFO
Applied, marked as stable

   tpm/tpm_i2c_stm_st33/dts/st33zp24-i2c: Rename st33zp24 dts
 documentation
Applied

   tpm/tpm_i2c_stm_st33: Split tpm_i2c_tpm_st33 in 2 layers (core + phy)
Please fix
   tpm/st33zp24/spi: Add st33zp24 spi phy
N/A
   tpm/st33zp24/dts/st33zp24-spi: Add dts documentation for st33zp24 spi
 phy
N/A

Also fixed the Jasob typo :)

The applied stuff will be included in the pull request.


Peter

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 00/15] ST33 I2C TPM driver cleanup

2014-12-01 Thread Peter Hüwe
Am Montag, 1. Dezember 2014, 19:32:45 schrieb Christophe Ricard:
 Hi Peter,
 
 I have seen one mistake done during the rebase on v5 on patch
 0010-tpm-tpm_i2c_stm_st33-Add-devicetree-structure.
 ~~ Please discard v5. ~~
 
 This new patchset version is taking into account as much as possible
 Jason Gunthorpe feedbacks as well as yours. I hope, i am not missing any.
 
 I have also aligned dts compatible string with other drivers and rephrase
 one part of the st33zp24 dts documentation as pointed by Mark Rutland.
 
 It still brings:
 - Some few code clean up from code style up to structure
 - Device tree support keeping static platform data configuration support.
 - Fixes  improvement for irq support.
 - Update the GPLv2 license header
 
 I have moved previous patch 0013 tpm/tpm_i2c_stm_st33: Fix potential bug in
 tpm_stm_i2c_send to 0001 as per your request. I have fixed as some build
 errors seen during the rebase :(. My bad.
 I have also changed the convention in the driver from r to ret.
 
 This patchset apply on top of James Morris linux-security tree
 on top of ac14ae25b676d721b6bfcfb046dc53a9f7760d83 on next branch
 Hope i am targetting the correct tree.
 
 Best Regards
 Christophe

Applied to my tree:
https://github.com/PeterHuewe/linux-tpmdd for-james

Will be included in the next pull-request (if no negative feedback from the 
device tree guys).

Thanks,
Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 09/15] tpm/tpm_i2c_stm_st33/dts/st33zp24_i2c: Add DTS Documentation

2014-11-30 Thread Peter Hüwe
Hi,

can I get an ACK from the device tree gurus?

Am Sonntag, 19. Oktober 2014, 23:11:19 schrieb Christophe Ricard:
 st33zp24 tpm can be seen as a trivial i2c device as other i2c tpm.
 However several other properties needs to be documented such as lpcpd.
 
 Reviewed-By: Jason Gunthorpe jguntho...@obsidianresearch.com
 Signed-off-by: Christophe Ricard christophe-h.ric...@st.com
 ---
  .../devicetree/bindings/security/tpm/st33zp24.txt  | 36
 ++ 1 file changed, 36 insertions(+)
  create mode 100644
 Documentation/devicetree/bindings/security/tpm/st33zp24.txt
 
 diff --git a/Documentation/devicetree/bindings/security/tpm/st33zp24.txt
 b/Documentation/devicetree/bindings/security/tpm/st33zp24.txt new file
 mode 100644
 index 000..eb48222
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/security/tpm/st33zp24.txt
 @@ -0,0 +1,36 @@
 +* STMicroelectronics SAS. ST33ZP24 TPM SoC
 +
 +Required properties:
 +- compatible: Should be st,st33zp24_i2c.
 +- clock-frequency: I²C work frequency.
 +- reg: address on the bus
 +
 +Optional ST33ZP24 Properties:
 +- interrupt-parent: phandle for the interrupt gpio controller
 +- interrupts: GPIO interrupt to which the chip is connected
 +- lpcpd-gpios: Output GPIO pin used for ST33ZP24 power management D1/D2
 state. +If set vps must present when the platform is going into
 sleep/hibernate mode. +
 +Optional SoC Specific Properties:
 +- pinctrl-names: Contains only one value - default.
 +- pintctrl-0: Specifies the pin control groups used for this controller.
 +
 +Example (for ARM-based BeagleBoard xM with ST33ZP24 on I2C2):
 +
 +i2c2 {
 +
 +status = okay;
 +
 +st33zp24: st33zp24@13 {
 +
 +compatible = st,st33zp24_i2c;
 +
 +reg = 0x013;
 +clock-frequency = 40;
 +
 +interrupt-parent = gpio5;
 +interrupts = 7 IRQ_TYPE_LEVEL_HIGH;
 +
 +lpcpd-gpios = gpio5 15 GPIO_ACTIVE_HIGH;
 +};
 +};


Thanks,
Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/15] ST33 I2C TPM driver cleanup

2014-11-30 Thread Peter Hüwe
Hi Christophe,

sorry for the late reply :/
 
 This new patchset version is taking into account as much as possible
 Jason Gunthorpe feedbacks. I hope, i am not missing any.
 
 It still brings:
 - Some few code clean up from code style up to structure
 - Device tree support keeping static platform data configuration support.
 - Fixes  improvement for irq support.
 - Update the GPLv2 license header
 
 I am also adding the mention Reviewed-By: Jason Gunthorpe
 jguntho...@obsidianresearch.com on all those patches.
 Jason, please feel free to let me know if i am mistaking here. :).
 
 This patchset apply on top of James Morris linux-security tree

Unfortunately I get compile warnings:

/data/data-old/linux-2.6/drivers/char/tpm/tpm_i2c_stm_st33.c: In function 
'tpm_stm_i2c_probe':
/data/data-old/linux-2.6/drivers/char/tpm/tpm_i2c_stm_st33.c:748:3: warning: 
passing argument 1 of 'tpm_stm_i2c_of_request_resources' from incompatible 
pointer type [enabled by default]
/data/data-old/linux-2.6/drivers/char/tpm/tpm_i2c_stm_st33.c:670:12: note: 
expected 'struct i2c_client *' but argument is of type 'struct tpm_chip *'
/data/data-old/linux-2.6/drivers/char/tpm/tpm_i2c_stm_st33.c:722:3: warning: 
'chip' may be used uninitialized in this function [-Wuninitialized]

Smatch complains:
/data/data-old/linux-2.6/drivers/char/tpm/tpm_i2c_stm_st33.c:722 
tpm_stm_i2c_probe() error: potentially dereferencing uninitialized 'chip'.



Can you fix this up?

(also if you redo the patchset, moving 
tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send
to the front would be nice, as indicated by Jason on v3


Nitpick: maybe you could use ret instead of r in your return code cleanup.
I'm not a fan of one letter variables, except counters)


Peter


--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/15] ST33 I2C TPM driver cleanup

2014-11-30 Thread Peter Hüwe
Hi Christophe,

 Thank you for your feedback (on Sunday :)).
 
 To be honest i missed those warnings. I figured they come when CONFIG_OF
 is not set :/.
 
 No problem to send a v5 with tpm/tpm_i2c_stm_st33: Fix potential bug in
 tpm_stm_i2c_send and replace r by ret. The purpose here was more to
 have a kind of convention inside the driver rather than mixing
 r/ret/err.
 
 I hope to send this by tonight.

Would be great! - usually I try to sort this stuff out myself, but this is not 
possible at the moment.


Thanks,
Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/16] ST33 I2C TPM driver cleanup

2014-10-07 Thread Peter Hüwe
Hi Christophe,


Am Dienstag, 7. Oktober 2014, 22:02:53 schrieb Christophe Ricard:
 Hi Peter,
 
 The following patchset brings:
 - Some few code clean up from code style up to structure
 - Device tree support keeping static platform data configuration support.
 - Fix irq support.
 - Update the GPLv2 license header
 
 This patchset apply on top of James Morris linux-security tree
 on top of 594081ee7145cc30a3977cb4e218f81213b63dc5 on next branch
 Hope i am targetting to correct tree.
 
 The full patchset got also crosschecked by Jean-Luc here in copy.
 
 Best Regards
 Christophe


I'll try to have a look at them as soon as possible - but with the ELCE/Linux 
Con comming up next week (TPM minisummit! ;) it's a bit hectic at the moment.

Thanks,
Peter
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html