Skip to content

Commit

Permalink
tpm, tpm_tis: Ensure reset is deasserted on probe
Browse files Browse the repository at this point in the history
The TPM may be held in a reset state on boot.

Deassert reset to allow driver binding to the TPM.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
  • Loading branch information
l1k committed Sep 16, 2023
1 parent e6ab267 commit a1ca802
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions drivers/char/tpm/tpm_tis_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/wait.h>
#include <linux/acpi.h>
#include <linux/freezer.h>
#include <linux/reset.h>
#include "tpm.h"
#include "tpm_tis_core.h"

Expand Down Expand Up @@ -1003,6 +1004,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
const struct tpm_tis_phy_ops *phy_ops,
acpi_handle acpi_dev_handle)
{
struct reset_control *rstc;
u32 vendor;
u32 intfcaps;
u32 intmask;
Expand Down Expand Up @@ -1034,6 +1036,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,

dev_set_drvdata(&chip->dev, priv);

rstc = reset_control_get_optional_exclusive(dev, NULL);
if (IS_ERR(rstc)) {
rc = PTR_ERR(rstc);
dev_err_probe(dev, rc, "Cannot get reset control: %d\n", rc);
return rc;
}

rc = reset_control_deassert(rstc);
reset_control_put(rstc);
if (rc) {
dev_err(dev, "Cannot deassert reset control: %d\n", rc);
return rc;
}


rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
if (rc < 0)
return rc;
Expand Down

0 comments on commit a1ca802

Please sign in to comment.