All of lore.kernel.org
 help / color / mirror / Atom feed
From: wanghongzhe <wanghongzhe@huawei.com>
To: <peterhuewe@gmx.de>
Cc: <linux-integrity@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<zhangchenfeng1@huawei.com>
Subject: [PATCH] tpm: tpm_tis_spi: set cs_change = 0 when timesout
Date: Tue, 14 Jan 2020 20:12:31 +0800	[thread overview]
Message-ID: <1579003951-16029-1-git-send-email-wanghongzhe@huawei.com> (raw)

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: wanghongzhe <wanghongzhe@huawei.com>
---
 drivers/char/tpm/tpm_tis_spi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
index d1754fd..a1ae4f6 100644
--- a/drivers/char/tpm/tpm_tis_spi.c
+++ b/drivers/char/tpm/tpm_tis_spi.c
@@ -67,7 +67,14 @@ static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
 		}
 
 		if (i == TPM_RETRY)
+        {
+            spi_xfer.cs_change = 0;
+            spi_xfer->len = 1;
+            spi_message_init(&m);
+            spi_message_add_tail(spi_xfer, &m);
+            ret = spi_sync_locked(phy->spi_device, &m);
 			return -ETIMEDOUT;
+        }
 	}
 
 	return 0;
-- 
1.7.12.4


             reply	other threads:[~2020-01-14 11:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 12:12 wanghongzhe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-01-15  7:09 [PATCH] tpm:tpm_tis_spi: set cs_change = 0 when timesout wanghongzhe
     [not found] <1579071543-22632-1-git-send-email-wanghongzhe@huawei.com>
2020-01-15  6:31 ` wanghongzhe
2020-01-14 12:31 [PATCH] tpm: tpm_tis_spi: " wanghongzhe
2020-01-14 12:12 ` Paul Menzel
2020-01-14 12:31 wanghongzhe
2019-01-15  7:02 [PATCH] tpm:tpm_tis_spi: " wanghongzhe
2019-01-15  6:59 wanghongzhe
2019-01-15  6:56 wanghongzhe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1579003951-16029-1-git-send-email-wanghongzhe@huawei.com \
    --to=wanghongzhe@huawei.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=zhangchenfeng1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.