<p>Justin TerAvest has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25543">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">drivers/spi/tpm: Add sleep delay after ready cmd.<br><br>This is analogous to a sleep done in the I2C TPM driver to ensure that<br>cr50 has time to process the COMMAND_READY command before receiving any<br>later traffic. This change made the TPM much more reliable (though not<br>perfect).<br><br>BUG=b:75306520<br>BRANCH=None<br>TEST=Significantly improved reliability<br><br>Signed-off-by: Justin TerAvest<br><br>Change-Id: Ia25467dc60c968b3b3892e59f90f0393161375c8<br>---<br>M src/drivers/spi/tpm/tpm.c<br>1 file changed, 3 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/43/25543/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/drivers/spi/tpm/tpm.c b/src/drivers/spi/tpm/tpm.c</span><br><span>index c0fee46..a7900c6 100644</span><br><span>--- a/src/drivers/spi/tpm/tpm.c</span><br><span>+++ b/src/drivers/spi/tpm/tpm.c</span><br><span>@@ -38,6 +38,7 @@</span><br><span> #define TPM_FW_VER   (TPM_LOCALITY_0_SPI_BASE + 0xf90)</span><br><span> </span><br><span> #define CR50_TIMEOUT_INIT_MS 30000 /* Very long timeout for TPM init */</span><br><span style="color: hsl(120, 100%, 40%);">+#define CR50_SLEEP_LONG 210 /* in usec */</span><br><span> </span><br><span> /* SPI slave structure for TPM device. */</span><br><span> static struct spi_slave g_spi_slave CAR_GLOBAL;</span><br><span>@@ -725,6 +726,8 @@</span><br><span> </span><br><span>  /* Move the TPM back to idle state. */</span><br><span>       write_tpm_sts(TPM_STS_COMMAND_READY);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Add sleep after sending command ready so TPM has time to process */</span><br><span style="color: hsl(120, 100%, 40%);">+        udelay(CR50_SLEEP_LONG);</span><br><span> </span><br><span>         return payload_size;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25543">change 25543</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/25543"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia25467dc60c968b3b3892e59f90f0393161375c8 </div>
<div style="display:none"> Gerrit-Change-Number: 25543 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Justin TerAvest <teravest@chromium.org> </div>