summaryrefslogtreecommitdiff
path: root/drivers/char/tpm/tpm_tis.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2011-11-11 17:57:04 (GMT)
committerRajiv Andrade <srajiv@linux.vnet.ibm.com>2011-11-16 11:42:59 (GMT)
commit68d6e6713fcb2ea6278661aaaf5f1c9c821b3751 (patch)
treefb02641cb1941a6d9c23ac3df37d6aafcd4f7f3a /drivers/char/tpm/tpm_tis.c
parentd97c6ade5926afb6d52df36c33a3491d62cd0dc0 (diff)
downloadlinux-fsl-qoriq-68d6e6713fcb2ea6278661aaaf5f1c9c821b3751.tar.xz
tpm: Introduce function to poll for result of self test
This patch introduces a function that runs the TPM_ContinueSelfTest() function and then polls the TPM to check whether it finished the selftest and can receive new commands. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/tpm/tpm_tis.c')
-rw-r--r--drivers/char/tpm/tpm_tis.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 3f4051a..d30d5c3 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -616,6 +616,12 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
/* get the timeouts before testing for irqs */
tpm_get_timeouts(chip);
+ if (tpm_do_selftest(chip)) {
+ dev_err(dev, "TPM self test failed\n");
+ rc = -ENODEV;
+ goto out_err;
+ }
+
/* INTERRUPT Setup */
init_waitqueue_head(&chip->vendor.read_queue);
init_waitqueue_head(&chip->vendor.int_queue);
@@ -722,7 +728,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
list_add(&chip->vendor.list, &tis_chips);
spin_unlock(&tis_lock);
- tpm_continue_selftest(chip);
return 0;
out_err:
@@ -790,7 +795,7 @@ static int tpm_tis_pnp_resume(struct pnp_dev *dev)
ret = tpm_pm_resume(&dev->dev);
if (!ret)
- tpm_continue_selftest(chip);
+ tpm_do_selftest(chip);
return ret;
}