summaryrefslogtreecommitdiff
path: root/chip/g/sps.c
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-10-31 18:51:51 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-11-07 17:52:15 -0800
commit3919001a390f593ba8e022f223bf1e43b7dbc0a2 (patch)
tree5a5534aca31394c15d4cc6f09197348b66f786ef /chip/g/sps.c
parent0354ad02cba910c90fd0c0e622c3b0b698802a1c (diff)
downloadchrome-ec-3919001a390f593ba8e022f223bf1e43b7dbc0a2.tar.gz
tpm: provide means of shutting down comms layer while in reset
Currently the Cr50 code resets TPM communications layer at a certain point during TPM reset process. It turns out that this is not sufficient - the comms layer keeps receiving and trying to invoke TPM layer, which does not mesh well with TPM reset. Let's provide two callbacks for each comms layer - to shut it down and to bring it back up. We shut down the comms when starting TPM reset and bring them back up when reset is completed. BRANCH=cr50 BUG=b:68012381 TEST=ran AP firmware test suite on both SPI and I2C based devices. Change-Id: I7caf4a09b9a5c6e5fc6bfe60eae1c0d64ab24904 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/754502 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'chip/g/sps.c')
-rw-r--r--chip/g/sps.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/chip/g/sps.c b/chip/g/sps.c
index 6a5fed0ee3..fc7a0d8458 100644
--- a/chip/g/sps.c
+++ b/chip/g/sps.c
@@ -215,6 +215,9 @@ int sps_register_rx_handler(enum sps_mode mode, rx_handler_f rx_handler,
task_disable_irq(GC_IRQNUM_SPS0_RXFIFO_LVL_INTR);
task_disable_irq(GC_IRQNUM_SPS0_CS_DEASSERT_INTR);
+ if (!rx_handler)
+ return 0;
+
if (!rx_fifo_threshold)
rx_fifo_threshold = 8; /* This is a sensible default. */
sps_rx_handler = rx_handler;