mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Stefano Radaelli <stefano.radaelli21@gmail.com>
Cc: linux-kernel@vger.kernel.org, Peter Huewe <peterhuewe@gmx.de>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	pierluigi.p@variscite.com,
	Stefano Radaelli <stefano.r@variscite.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH v1 1/1] tpm: tis_i2c: Deassert optional reset line before probing
Date: Fri, 18 Sep 2026 05:38:23 +0300	[thread overview]
Message-ID: <aqykH7j_Gp5FmIPA@kernel.org> (raw)
In-Reply-To: <20260917124211.136221-1-stefano.r@variscite.com>

On Thu, Sep 17, 2026 at 02:42:11PM +0200, Stefano Radaelli wrote:
> From: Stefano Radaelli <stefano.r@variscite.com>
> 
> The common TPM Device Tree binding already documents resets and
> reset-gpios, but the TIS I2C driver never requests a reset control.
> As a result, an I2C TPM held in reset by board wiring remains
> inaccessible and the first register access during probe fails.
> 
> Request the optional reset control and deassert it before
> communicating with the TPM. This keeps existing boards without a reset
> line unchanged while allowing platforms using resets or reset-gpios to
> release the TPM before probe continues.
> 
> Tested on a Variscite DART-MX95 with an ST33KTPM2XI2C TPM using
> reset-gpios.
> 
> Signed-off-by: Stefano Radaelli <stefano.r@variscite.com>
> ---
>  drivers/char/tpm/tpm_tis_i2c.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/char/tpm/tpm_tis_i2c.c b/drivers/char/tpm/tpm_tis_i2c.c
> index d55f30fef00a..cde0b093ed58 100644
> --- a/drivers/char/tpm/tpm_tis_i2c.c
> +++ b/drivers/char/tpm/tpm_tis_i2c.c
> @@ -12,6 +12,7 @@
>  
>  #include <linux/i2c.h>
>  #include <linux/crc-ccitt.h>
> +#include <linux/reset.h>
>  #include "tpm_tis_core.h"
>  
>  /* TPM registers */
> @@ -330,6 +331,7 @@ static const struct tpm_tis_phy_ops tpm_i2c_phy_ops = {
>  static int tpm_tis_i2c_probe(struct i2c_client *dev)
>  {
>  	struct tpm_tis_i2c_phy *phy;
> +	struct reset_control *reset;
>  	const u8 crc_enable = 1;
>  	const u8 locality = 0;
>  	int ret;
> @@ -346,6 +348,16 @@ static int tpm_tis_i2c_probe(struct i2c_client *dev)
>  	set_bit(TPM_TIS_DEFAULT_CANCELLATION, &phy->priv.flags);
>  	phy->i2c_client = dev;
>  
> +	reset = devm_reset_control_get_optional_exclusive(&dev->dev, NULL);
> +	if (IS_ERR(reset))
> +		return dev_err_probe(&dev->dev, PTR_ERR(reset),
> +				     "failed to get reset control\n");
> +
> +	ret = reset_control_deassert(reset);
> +	if (ret)
> +		return dev_err_probe(&dev->dev, ret,
> +				     "failed to deassert reset\n");
> +
>  	/* must precede all communication with the tpm */
>  	ret = tpm_tis_i2c_init_guard_time(phy);
>  	if (ret)
> -- 
> 2.47.3
> 

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

      reply	other threads:[~2026-09-18  2:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 12:42 Stefano Radaelli
2026-09-18  2:38 ` Jarkko Sakkinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqykH7j_Gp5FmIPA@kernel.org \
    --to=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=peterhuewe@gmx.de \
    --cc=pierluigi.p@variscite.com \
    --cc=stefano.r@variscite.com \
    --cc=stefano.radaelli21@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®