From: Stefan Wahren <wahrenst@gmx.net>
To: Peter Huewe <peterhuewe@gmx.de>,
Jarkko Sakkinen <jarkko@kernel.org>,
Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org,
Stefan Berger <stefanb@linux.ibm.com>,
Stefan Wahren <wahrenst@gmx.net>
Subject: [PATCH RFC 2/2] tpm: tpm_tis: Provide error messages in tpm_tis_core_init
Date: Fri, 6 Sep 2024 08:09:47 +0200 [thread overview]
Message-ID: <20240906060947.4844-3-wahrenst@gmx.net> (raw)
In-Reply-To: <20240906060947.4844-1-wahrenst@gmx.net>
In case of SPI wiring issues (e.g. MISO pin permanent high) the
core init won't provide any error message on failure. Add some
helpful error messages to tpm_tis_core_init(), which helps
to better understand why the driver won't probe.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
drivers/char/tpm/tpm_tis_core.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index fdef214b9f6b..830e331fcebe 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -1133,8 +1133,10 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
dev_set_drvdata(&chip->dev, priv);
rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
- if (rc < 0)
+ if (rc < 0) {
+ dev_err(dev, "Failed to read TPM_DID_VID register: %d\n", rc);
return rc;
+ }
priv->manufacturer_id = vendor;
@@ -1162,19 +1164,25 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
chip->ops->clk_enable(chip, true);
if (wait_startup(chip, 0) != 0) {
+ dev_err(dev, "TPM device not accessible (0x%0x)\n",
+ vendor);
rc = -ENODEV;
goto out_err;
}
/* Take control of the TPM's interrupt hardware and shut it off */
rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
- if (rc < 0)
+ if (rc < 0) {
+ dev_err(dev, "Failed to read TPM_INT_ENABLE register: %d\n", rc);
goto out_err;
+ }
/* Figure out the capabilities */
rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps);
- if (rc < 0)
+ if (rc < 0) {
+ dev_err(dev, "Failed to read TPM_INTF_CAPS register: %d\n", rc);
goto out_err;
+ }
dev_dbg(dev, "TPM interface capabilities (0x%x):\n",
intfcaps);
@@ -1209,6 +1217,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
rc = tpm_tis_request_locality(chip, 0);
if (rc < 0) {
+ dev_err(dev, "Failed to request locality (0x%0x)\n", vendor);
rc = -ENODEV;
goto out_err;
}
--
2.34.1
next prev parent reply other threads:[~2024-09-06 6:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 6:09 [PATCH RFC 0/2] tpm: Minor improvements Stefan Wahren
2024-09-06 6:09 ` [PATCH RFC 1/2] tpm: tpm_tis_spi: Ensure SPI mode 0 Stefan Wahren
2024-09-06 9:47 ` Jarkko Sakkinen
2024-09-06 14:46 ` Stefan Wahren
2024-09-09 17:05 ` Jarkko Sakkinen
2024-09-09 17:16 ` Stefan Wahren
2024-09-06 6:09 ` Stefan Wahren [this message]
2024-09-06 9:50 ` [PATCH RFC 2/2] tpm: tpm_tis: Provide error messages in tpm_tis_core_init Jarkko Sakkinen
2024-09-06 14:42 ` Stefan Wahren
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=20240906060947.4844-3-wahrenst@gmx.net \
--to=wahrenst@gmx.net \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®