[PATCH 0/5] Support TPM Reset GPIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux