diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2016-09-22 18:52:47 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-09-26 22:16:45 -0700 |
commit | 5a6bb19a889f5b7fa5f4b590aba5893bee9d5452 (patch) | |
tree | adac78be67c57bcde092587fc2ade2d57ca6f5fc /common/i2cs_tpm.c | |
parent | 75aaabcd9ade5d2a2ad068d2543e8e82011b979f (diff) | |
download | chrome-ec-5a6bb19a889f5b7fa5f4b590aba5893bee9d5452.tar.gz |
tpm: reset communications channels when resetting TPM
TPM resets happen asynchronously, conceivably there is some interface
(i2cs or sps) activity under way when TPM is reset.
Sps driver provides a means of disconnecting the client of the driver,
while the i2cs driver does not. Come to think of it, there is no real
need to provide a special function to disconnect a client, this makes
API simpler and allows to add driver initialization to the client
registration function.
To make tpm_registers.c more flexible - allow to register a callback
for interface initialization, this way when TPM is reset, the
interface can be also re-initialized and is guaranteed to start from
scratch after reset.
BRANCH=none
BUG=chrome-os-partner:52366
TEST=both firmware_TPMExtend and firmware_TPMKernelVersion autotests
pass
Change-Id: I212166a23f9cd512d8f75315377d1f5620aea070
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/388886
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/i2cs_tpm.c')
-rw-r--r-- | common/i2cs_tpm.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/common/i2cs_tpm.c b/common/i2cs_tpm.c index 7700fd8373..5aa3a07e01 100644 --- a/common/i2cs_tpm.c +++ b/common/i2cs_tpm.c @@ -223,8 +223,16 @@ static void wr_complete_handler(void *i2cs_data, size_t i2cs_data_size) gpio_set_level(GPIO_INT_AP_L, 1); } -static void i2cs_tpm_init(void) +static void i2cs_tpm_enable(void) { i2cs_register_write_complete_handler(wr_complete_handler); } -DECLARE_HOOK(HOOK_INIT, i2cs_tpm_init, HOOK_PRIO_LAST); + +static void i2cs_if_register(void) +{ + if (!(system_get_board_properties() & BOARD_SLAVE_CONFIG_I2C)) + return; + + tpm_register_interface(i2cs_tpm_enable); +} +DECLARE_HOOK(HOOK_INIT, i2cs_if_register, HOOK_PRIO_LAST); |