From 0d41bed0bccfdfd82361788cf89a37caff08dd9f Mon Sep 17 00:00:00 2001 From: Andrey Pronin Date: Thu, 10 Jan 2019 17:45:52 -0800 Subject: cr50: reset burstcnt to max when entering idle Before this CL, when entering idle state after aborted command (response not read or read partially, then aborted by setting COMMAND_READY set in STS), the last burstcnt set for the response was carried over to processing the next command. Reset burstcnt on entering idle to max value, as we do in tpm_init and fifo_reg_read when the last chunk is read. BUG=b:118178519 BRANCH=cr50, cr50-mp TEST=1) boot, login normally; 2) imitate lost TPM ready IRQs in host tpm driver (see BUG), verify that trunksd starts and TPM communication work after that. Change-Id: I76061090bf48a36509ab7f4678716f8bc426846a Signed-off-by: Andrey Pronin Reviewed-on: https://chromium-review.googlesource.com/1405626 Commit-Ready: ChromeOS CL Exonerator Bot Reviewed-by: Vadim Bendebury --- common/tpm_registers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 52f4bce91d..5a81e0ca6b 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -189,6 +189,9 @@ static void set_tpm_state(enum tpm_states state) tpm_.fifo_read_index = 0; tpm_.fifo_write_index = 0; tpm_.regs.sts &= ~data_avail; + /* Set burst size for the following write requests. */ + tpm_.regs.sts &= ~(burst_count_mask << burst_count_shift); + tpm_.regs.sts |= 63 << burst_count_shift; } } -- cgit v1.2.1