diff options
Diffstat (limited to 'src/drivers/i2c/tpm/tis.c')
-rw-r--r-- | src/drivers/i2c/tpm/tis.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/src/drivers/i2c/tpm/tis.c b/src/drivers/i2c/tpm/tis.c index ce0de8953b..fea5145ad2 100644 --- a/src/drivers/i2c/tpm/tis.c +++ b/src/drivers/i2c/tpm/tis.c @@ -31,7 +31,6 @@ static struct tpm_chip g_chip CAR_GLOBAL; #define TPM_CMD_COUNT_BYTE 2 #define TPM_CMD_ORDINAL_BYTE 6 -#define TPM_VALID_STATUS (1 << 7) int tis_open(void) { @@ -69,38 +68,8 @@ int tis_close(void) int tis_init(void) { - int bus = CONFIG_DRIVER_TPM_I2C_BUS; - int chip = CONFIG_DRIVER_TPM_I2C_ADDR; - struct stopwatch sw; - uint8_t buf = 0; - int ret; - long sw_run_duration = 750; - - /* - * Probe TPM. Check if the TPM_ACCESS register's ValidSts bit is set(1) - * If the bit remains clear(0) then claim that init has failed. - */ - stopwatch_init_msecs_expire(&sw, sw_run_duration); - do { - ret = i2c_readb(bus, chip, 0, &buf); - if (!ret && (buf & TPM_VALID_STATUS)) { - sw_run_duration = stopwatch_duration_msecs(&sw); - break; - } - } while (!stopwatch_expired(&sw)); - - printk(BIOS_INFO, - "%s: ValidSts bit %s(%d) in TPM_ACCESS register after %ld ms\n", - __func__, (buf & TPM_VALID_STATUS) ? "set" : "clear", - (buf & TPM_VALID_STATUS) >> 7, sw_run_duration); - - /* - * Claim failure if the ValidSts (bit 7) is clear. - */ - if (!(buf & TPM_VALID_STATUS)) - return -1; - - return 0; + return tpm_vendor_probe(CONFIG_DRIVER_TPM_I2C_BUS, + CONFIG_DRIVER_TPM_I2C_ADDR); } static ssize_t tpm_transmit(const uint8_t *buf, size_t bufsiz) |