[PATCHv3] drivers: tpm2: update reset gpio semantics

Michal Simek michal.simek at xilinx.com
Thu Jun 3 11:33:37 CEST 2021



On 6/3/21 11:21 AM, Jorge Ramirez-Ortiz wrote:
> Use the more generic reset-gpios property name.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge at foundries.io>
> ---
> 
>  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(-)
> 
> diff --git a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
> index 3a2ee4bd17..521550bf67 100644
> --- a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
> +++ b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
> @@ -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"

>  - spi-max-frequency	: See spi-bus.txt
>  
>  Example:
> diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c
> index 4b33ac8fd3..73e7c342aa 100644
> --- a/drivers/tpm/tpm2_tis_spi.c
> +++ b/drivers/tpm/tpm2_tis_spi.c
> @@ -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__);

ditto.

>  		}
> +		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 <michal.simek at xilinx.com>

Thanks,
Michal


More information about the U-Boot mailing list