diff mbox series

[v2,5/6] drivers: tpm: atmel_twi: implement get_desc operation

Message ID 20211111040631.21262-6-matt@traverse.com.au
State Accepted
Commit fb30d99df831c7235e61bd0c4e07a25ae20926b3
Delegated to: Ilias Apalodimas
Headers show
Series drivers: tpm: Fix Atmel/Microchip TPMv1.2 issues | expand

Commit Message

Mathew McBride Nov. 11, 2021, 4:06 a.m. UTC
Without get_desc, the tpm command will not provide a
description of the device in 'tpm device' or 'tpm info'.

Due to the characteristics of the Atmel TPM it isn't
possible to determine certain attributes (e.g open/close
status) without using the TPM stack (compare Infineon
and ST TPM drivers), so just print out the chip model
and udevice name as the identifier.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
---
 drivers/tpm/tpm_atmel_twi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Simon Glass Nov. 25, 2021, 12:12 a.m. UTC | #1
On Wed, 10 Nov 2021 at 21:06, Mathew McBride <matt@traverse.com.au> wrote:
>
> Without get_desc, the tpm command will not provide a
> description of the device in 'tpm device' or 'tpm info'.
>
> Due to the characteristics of the Atmel TPM it isn't
> possible to determine certain attributes (e.g open/close
> status) without using the TPM stack (compare Infineon
> and ST TPM drivers), so just print out the chip model
> and udevice name as the identifier.
>
> Signed-off-by: Mathew McBride <matt@traverse.com.au>
> ---
>  drivers/tpm/tpm_atmel_twi.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/drivers/tpm/tpm_atmel_twi.c b/drivers/tpm/tpm_atmel_twi.c
index 71b101406d..a5dfb34846 100644
--- a/drivers/tpm/tpm_atmel_twi.c
+++ b/drivers/tpm/tpm_atmel_twi.c
@@ -52,7 +52,10 @@  static int tpm_atmel_twi_close(struct udevice *dev)
  */
 static int tpm_atmel_twi_get_desc(struct udevice *dev, char *buf, int size)
 {
-	return 0;
+	if (size < 50)
+		return -ENOSPC;
+
+	return snprintf(buf, size, "Atmel AT97SC3204T I2C 1.2 TPM (%s)", dev->name);
 }
 
 /*