[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1579072164-23423-1-git-send-email-wanghongzhe@huawei.com>
Date: Wed, 15 Jan 2020 15:09:24 +0800
From: wanghongzhe <wanghongzhe@...wei.com>
To: <peterhuewe@....de>
CC: <linux-integrity@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<zhangchenfeng1@...wei.com>, <wanghongzhe@...wei.com>
Subject: [PATCH] tpm:tpm_tis_spi: set cs_change = 0 when timesout
From: Wang Hongzhe <wanghongzhe@...wei.com>
when i reach TPM_RETRY, the cs cannot change back to 'high'.
So the TPM chips thinks this communication is not over.
And next times communication cannot be effective because the
communications mixed up with the last time.
Signed-off-by: Wang Hongzhe <wanghongzhe@...wei.com>
---
drivers/char/tpm/tpm_tis_spi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
index d1754fd..27e57bf 100644
--- a/drivers/char/tpm/tpm_tis_spi.c
+++ b/drivers/char/tpm/tpm_tis_spi.c
@@ -66,8 +66,15 @@ static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
break;
}
- if (i == TPM_RETRY)
+ if (i == TPM_RETRY) {
+ spi_xfer->len = 1;
+ spi_xfer->cs_change = 0;
+ spi_message_init(&m);
+ spi_message_add_tail(spi_xfer, &m);
+ if (ret < 0)
+ return ret;
return -ETIMEDOUT;
+ }
}
return 0;
--
1.7.12.4
Powered by blists - more mailing lists