drivers: tpm2: update reset gpio semantics
PATCH v3 1/1 drivers: tpm2: update reset gpio semantics
Use the more generic reset-gpios property name.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>
---
v3: maintained the legacy property in the docs
.../tpm2/tis-tpm2-spi.txt | 3 ++- drivers/tpm/tpm2_tis_spi.c | 23 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-)
doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt +2 -1
@@ -6,7 +6,8 @@ Required properties: - reg : SPI Chip select Optional properties: -- gpio-reset : Reset GPIO (if not connected to the SoC reset line) +- reset-gpios : Reset GPIO (if not connected to the SoC reset line) +- gpio-reset : Reset GPIO (will be deprecated, use reset-gpios instead) - spi-max-frequency : See spi-bus.txt Example:
drivers/tpm/tpm2_tis_spi.c +15 -8
@@ -589,18 +589,25 @@ static int tpm_tis_spi_probe(struct udevice *dev)if (CONFIG_IS_ENABLED (DM_GPIO )) {struct gpio_desc reset_gpio; - ret =gpio_request_by_name (dev,"gpio-reset" ,0 , + ret =gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio,GPIOD_IS_OUT );if (ret) { -log (LOGC_NONE ,LOGL_NOTICE ,"%s: missing reset GPIO\n" , - __func__); - }else { -dm_gpio_set_value (&reset_gpio,1 ); -mdelay (1 ); -dm_gpio_set_value (&reset_gpio,0 ); +/* 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__); + goto init; + } +log (LOGC_NONE ,LOGL_NOTICE , +"%s: gpio-reset will be deprecated\n" , __func__); } +dm_gpio_set_value (&reset_gpio,1 ); +mdelay (1 ); +dm_gpio_set_value (&reset_gpio,0 ); } - +init:/* Ensure a minimum amount of time elapsed since reset of the TPM */ mdelay (drv_data->time_before_first_cmd_ms);
Signature · 1 line
2.31.1
Quoted 16 lines · Jorge Ramirez-Ortiz
Use the more generic reset-gpios property name.
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>---
v3: maintained the legacy property in the docs
.../tpm2/tis-tpm2-spi.txt | 3 ++- drivers/tpm/tpm2_tis_spi.c | 23 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-)doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt +0
-0
doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt Required properties: · line 10
Quoted 6 lines
doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt +2
-1@@ -6,7 +6,8 @@ Required properties: - reg : SPI Chip select Optional properties: -- gpio-reset : Reset GPIO (if not connected to the SoC reset line) +- reset-gpios : Reset GPIO (if not connected to the SoC reset line) +- gpio-reset : Reset GPIO (will be deprecated, use reset-gpios instead)
nit: I would use "is deprecated"
Quoted 21 lines
doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt +0
-0- spi-max-frequency : See spi-bus.txt Example:drivers/tpm/tpm2_tis_spi.c +1
-7@@ -589,18 +589,25 @@ static int tpm_tis_spi_probe(struct udevice *dev)if (CONFIG_IS_ENABLED (DM_GPIO )) {struct gpio_desc reset_gpio; - ret =gpio_request_by_name (dev,"gpio-reset" ,0 , + ret =gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio,GPIOD_IS_OUT );if (ret) { -log (LOGC_NONE ,LOGL_NOTICE ,"%s: missing reset GPIO\n" , - __func__); - }else { -dm_gpio_set_value (&reset_gpio,1 ); -mdelay (1 ); -dm_gpio_set_value (&reset_gpio,0 );
drivers/tpm/tpm2_tis_spi.c static int tpm_tis_spi_probe(struct udevice *dev) · line 604
Quoted 10 lines
drivers/tpm/tpm2_tis_spi.c +10
-0+/* 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__); + goto init; + } +log (LOGC_NONE ,LOGL_NOTICE , +"%s: gpio-reset will be deprecated\n" , __func__);
ditto.
drivers/tpm/tpm2_tis_spi.c static int tpm_tis_spi_probe(struct udevice *dev) · line 613
Quoted 11 lines
drivers/tpm/tpm2_tis_spi.c +4
-1} +dm_gpio_set_value (&reset_gpio,1 ); +mdelay (1 ); +dm_gpio_set_value (&reset_gpio,0 ); } - +init:/* Ensure a minimum amount of time elapsed since reset of the TPM */ mdelay (drv_data->time_before_first_cmd_ms);
With above changes
Acked-by Michal Simek <[email protected]>
Thanks,
Michal