[PATCH] tpm: display message when using gpio-reset instead of when missing it

Tim Harvey tharvey at gateworks.com
Thu Mar 21 19:02:19 CET 2024


Instead of displaying what looks like an error message if a
gpio-reset dt prop is missing for a TPM dipslay a more
informative message about resetting the TPM if the gpio is found:

before:
tpm_tis_spi_probe: missing reset GPIO

after:
tpm at 0: performing 1ms reset on gpio at 30210000:12

Note that the reset dt binding prop used in this driver is not
dt-compliant; it does not exist in the Linux dt-bindings documentation
and the reset is not done by the Linux driver.

Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
 drivers/tpm/tpm2_tis_spi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c
index de9cf8f21e07..944540f7a711 100644
--- a/drivers/tpm/tpm2_tis_spi.c
+++ b/drivers/tpm/tpm2_tis_spi.c
@@ -237,14 +237,14 @@ static int tpm_tis_spi_probe(struct udevice *dev)
 			/* legacy reset */
 			ret = gpio_request_by_name(dev, "gpio-reset", 0,
 						   &reset_gpio, GPIOD_IS_OUT);
-			if (ret) {
-				log(LOGC_NONE, LOGL_NOTICE,
-				    "%s: missing reset GPIO\n", __func__);
+			if (ret)
 				goto init;
-			}
 			log(LOGC_NONE, LOGL_NOTICE,
 			    "%s: gpio-reset is deprecated\n", __func__);
 		}
+		log(LOGC_NONE, LOGL_NOTICE,
+		    "%s: performing 1ms reset on %s:%d\n", dev->name,
+		    reset_gpio.dev->name, reset_gpio.offset);
 		dm_gpio_set_value(&reset_gpio, 1);
 		mdelay(1);
 		dm_gpio_set_value(&reset_gpio, 0);
-- 
2.25.1



More information about the U-Boot mailing list