linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Support TPM Reset GPIO
@ 2022-04-07 11:18 Lino Sanfilippo
  2022-04-07 11:18 ` [PATCH 1/5] tpm: add functions to set and unset the tpm chips reset state Lino Sanfilippo
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Lino Sanfilippo @ 2022-04-07 11:18 UTC (permalink / raw)
  To: peterhuewe, jarkko, jgg, =robh+dt
  Cc: devicetree, linux-integrity, linux-kernel, stefanb,
	p.rosenberger, lukas, Lino Sanfilippo

If the system starts up with the TPM chip still in reset the probe routine
of the tpm-tis driver fails with the following error message: 

"tpm_tis_spi: probe of spiX.Y failed with error -110"

The reason for this error is a missing response to the first command sent
to the chip (TPM_DID_VID) and a following timeout.

With the SLB9670 this issue can be triggered by setting up a pin 
configuration in device tree with the reset line setting to
BCM2835_PUD_DOWN (note that the reset signal for the SLB9670 is active
low).

This patchset adds support to set the chip out of reset from within the TPM
driver.


For this reason two new callbacks are introduced that can optionally be
implemented by a tpm tis driver:

        int (*unset_reset) (struct tpm_tis_data *data);
        int (*set_reset) (struct tpm_tis_data *data);


Function "unset_reset" is called directly before the first TPM command is
issued. Function "set_reset" is called at system shutdown directly after
the TPM2 shutdown command. 

Both callbacks are added to the set of tpm_tis_phy_ops functions. Patch 5
of this series provides the implementations for the SLB9670.

Patch 1:
  Extend struct tpm_tis_phy_ops by the optional callbacks "set_reset" and
  "unset_reset". If defined call "set_reset" before the first TPM command
  is sent and "unset_reset" at system shutdown after the TPM2 shutdown
  command.

Patch 2:
  Document the property "reset-gpios" as an optional property which can be
  used to specify the TPM chips reset gpio.

Patch 3:
  If available get the reset gpio and store it in the tpm_tis_data
  structure.

Patch 4:
  Declare functions tpm_tis_spi_flow_control, tpm_tis_spi_read_bytes and
  tpm_tis_spi_write_bytes as extern. This is in preparation of the next
  patch in which a custom probe function for the SLB9670 is implemented
  that is used to define its own set of tpm_tis_phy_ops.

Patch 5:
  Implement the "set_reset" and "unset_reset" callbacks for the SLB9670 and
  assign it in the probe function. The SLB9670 specific parts are moved
  into an own file to separate it from the generic code (for now I opted
  not to use a kernel config option for the SLB9670 code as it is used in
  case of the SPI CR50).

This series has been tested with a SLB9670.

Lino Sanfilippo (5):
  tpm: add functions to set and unset the tpm chips reset state
  dt-bindings: tpm: document reset gpio property
  tpm: tpm_tis: get optionally defined reset gpio
  tpm: tpm_tis: make functions available for external linkage
  tpm: tpm_tis_spi_slb_9670: implement set_reset and unset_reset
    functions

 .../bindings/security/tpm/tpm_tis_spi.txt     |  2 +
 drivers/char/tpm/Makefile                     |  1 +
 drivers/char/tpm/tpm-chip.c                   |  5 ++
 drivers/char/tpm/tpm_tis_core.c               | 23 ++++++
 drivers/char/tpm/tpm_tis_core.h               |  3 +
 drivers/char/tpm/tpm_tis_spi.h                |  9 ++
 drivers/char/tpm/tpm_tis_spi_main.c           | 16 ++--
 drivers/char/tpm/tpm_tis_spi_slb9670.c        | 82 +++++++++++++++++++
 8 files changed, 133 insertions(+), 8 deletions(-)
 create mode 100644 drivers/char/tpm/tpm_tis_spi_slb9670.c


base-commit: ed4643521e6af8ab8ed1e467630a85884d2696cf
-- 
2.35.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-04-14 12:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 11:18 [PATCH 0/5] Support TPM Reset GPIO Lino Sanfilippo
2022-04-07 11:18 ` [PATCH 1/5] tpm: add functions to set and unset the tpm chips reset state Lino Sanfilippo
2022-04-07 14:25   ` Jason Gunthorpe
2022-04-10  9:03     ` Lino Sanfilippo
2022-04-10 17:11     ` Lukas Wunner
2022-04-11 11:47       ` Jason Gunthorpe
2022-04-14 12:13         ` Jarkko Sakkinen
2022-04-07 11:18 ` [PATCH 2/5] dt-bindings: tpm: document reset gpio property Lino Sanfilippo
2022-04-07 11:18 ` [PATCH 3/5] tpm: tpm_tis: get optionally defined reset gpio Lino Sanfilippo
2022-04-07 11:18 ` [PATCH 4/5] tpm: tpm_tis: make functions available for external linkage Lino Sanfilippo
2022-04-07 11:18 ` [PATCH 5/5] tpm: tpm_tis_spi_slb_9670: implement set_reset and unset_reset functions Lino Sanfilippo
2022-04-10 17:18   ` Lukas Wunner
2022-04-10 19:44     ` Lino Sanfilippo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).