From 3919001a390f593ba8e022f223bf1e43b7dbc0a2 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Tue, 31 Oct 2017 18:51:51 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/754502 Reviewed-by: Randall Spangler Reviewed-by: Mary Ruthven --- chip/g/sps.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'chip/g/sps.c') 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; -- cgit v1.2.1