From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca, =robh+dt@kernel.org
Cc: devicetree@vger.kernel.org, linux-integrity@vger.kernel.org,
linux-kernel@vger.kernel.org, stefanb@linux.ibm.com,
p.rosenberger@kunbus.com, lukas@wunner.de,
Lino Sanfilippo <LinoSanfilippo@gmx.de>
Subject: [PATCH 0/5] Support TPM Reset GPIO
Date: Thu, 7 Apr 2022 13:18:44 +0200 [thread overview]
Message-ID: <20220407111849.5676-1-LinoSanfilippo@gmx.de> (raw)
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
next reply other threads:[~2022-04-07 11:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 11:18 Lino Sanfilippo [this message]
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
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=20220407111849.5676-1-LinoSanfilippo@gmx.de \
--to=linosanfilippo@gmx.de \
--cc==robh+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=p.rosenberger@kunbus.com \
--cc=peterhuewe@gmx.de \
--cc=stefanb@linux.ibm.com \
/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 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).