From: Peter Huewe <peter.huewe@infineon.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
<tpmdd-devel@lists.sourceforge.net>,
<linux-kernel@vger.kernel.org>, <peterhuewe@gmx.de>,
Christophe Ricard <christophe-h.ricard@st.com>,
"Peter Huewe" <peter.huewe@infineon.com>,
<stable@vger.kernel.org>,
Alexander Steffen <Alexander.Steffen@infineon.com>
Subject: [PATCH 5/5] tpm_tis_spi: Add small delay after last transfer
Date: Thu, 16 Feb 2017 16:09:46 +0000 [thread overview]
Message-ID: <1487261386-2641-5-git-send-email-peter.huewe@infineon.com> (raw)
Testing the implementation with a Raspberry Pi 2 showed that under some
circumstances its SPI master erroneously releases the CS line before the
transfer is complete, i.e. before the end of the last clock. In this case
the TPM ignores the transfer and misses for example the GO command. The
driver is unable to detect this communication problem and will wait for a
command response that is never going to arrive, timing out eventually.
As a workaround, the small delay ensures that the CS line is held long
enough, even with a faulty SPI master. Other SPI masters are not affected,
except for a negligible performance penalty.
Cc: <stable@vger.kernel.org>
Fixes: 0edbfea537d1 ("tpm/tpm_tis_spi: Add support for spi phy")
Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
Signed-off-by: Peter Huewe <peter.huewe@infineon.com>
---
drivers/char/tpm/tpm_tis_spi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
index b50c5b072df3..685c51bf5d7e 100644
--- a/drivers/char/tpm/tpm_tis_spi.c
+++ b/drivers/char/tpm/tpm_tis_spi.c
@@ -110,6 +110,7 @@ static int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u8 len,
spi_xfer.cs_change = 0;
spi_xfer.len = transfer_len;
+ spi_xfer.delay_usecs = 5;
if (direction) {
spi_xfer.tx_buf = NULL;
--
2.7.4
next reply other threads:[~2017-02-16 16:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-16 16:09 Peter Huewe [this message]
2017-02-17 5:09 ` Christophe Ricard
2017-02-17 7:26 ` Peter Huewe
2017-02-24 13:00 ` Jarkko Sakkinen
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=1487261386-2641-5-git-send-email-peter.huewe@infineon.com \
--to=peter.huewe@infineon.com \
--cc=Alexander.Steffen@infineon.com \
--cc=christophe-h.ricard@st.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=stable@vger.kernel.org \
--cc=tpmdd-devel@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®