aboutsummaryrefslogtreecommitdiff
path: root/drivers/tpm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-31 09:52:13 -0700
committerSimon Glass <sjg@chromium.org>2021-01-30 14:25:41 -0700
commit5372fc772ec0004297c080a0bd53f1871bd6b93a (patch)
tree5040c6f86106e651895715531a68fcd468f1f9cc /drivers/tpm
parent6208975e237c9549cab50756c6291d3ecde953b7 (diff)
downloadu-boot-5372fc772ec0004297c080a0bd53f1871bd6b93a.zip
u-boot-5372fc772ec0004297c080a0bd53f1871bd6b93a.tar.gz
u-boot-5372fc772ec0004297c080a0bd53f1871bd6b93a.tar.bz2
tpm: cr50: Add a better description and more debug
Update the TPM description to include the interrupt mechanicm since this is useful to know. Also add a warning if the TPM cannot be found and a debug line if it succeeds. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/tpm')
-rw-r--r--drivers/tpm/cr50_i2c.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/tpm/cr50_i2c.c b/drivers/tpm/cr50_i2c.c
index f53924a..8b79240 100644
--- a/drivers/tpm/cr50_i2c.c
+++ b/drivers/tpm/cr50_i2c.c
@@ -380,7 +380,6 @@ out_err:
static int cr50_i2c_send(struct udevice *dev, const u8 *buf, size_t len)
{
struct cr50_priv *priv = dev_get_priv(dev);
-
int status;
size_t burstcnt, limit, sent = 0;
u8 tpm_go[4] = { TPM_STS_GO };
@@ -557,9 +556,23 @@ static int cr50_i2c_get_desc(struct udevice *dev, char *buf, int size)
{
struct dm_i2c_chip *chip = dev_get_parent_plat(dev);
struct cr50_priv *priv = dev_get_priv(dev);
+ int len;
+
+ len = snprintf(buf, size, "cr50 TPM 2.0 (i2c %02x id %x), ",
+ chip->chip_addr, priv->vendor >> 16);
+ if (priv->use_irq) {
+ len += snprintf(buf + len, size - len, "irq=%s/%ld",
+ priv->irq.dev->name, priv->irq.id);
+ } else if (dm_gpio_is_valid(&priv->ready_gpio)) {
+ len += snprintf(buf + len, size - len, "gpio=%s/%u",
+ priv->ready_gpio.dev->name,
+ priv->ready_gpio.offset);
+ } else {
+ len += snprintf(buf + len, size - len, "delay=%d",
+ TIMEOUT_NO_IRQ_US);
+ }
- return snprintf(buf, size, "cr50 TPM 2.0 (i2c %02x id %x) irq=%d",
- chip->chip_addr, priv->vendor >> 16, priv->use_irq);
+ return len;
}
static int cr50_i2c_open(struct udevice *dev)
@@ -702,11 +715,12 @@ static int cr50_i2c_probe(struct udevice *dev)
mdelay(10);
}
if (vendor != CR50_DID_VID) {
- log_debug("DID_VID %08x not recognised\n", vendor);
+ log_warning("DID_VID %08x not recognised\n", vendor);
return log_msg_ret("vendor-id", -EXDEV);
}
priv->vendor = vendor;
priv->locality = -1;
+ log_debug("Cr50 ready\n");
return 0;
}