summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-02-23 08:53:53 -0800
committerVadim Bendebury <vbendeb@chromium.org>2017-02-23 17:09:32 +0000
commit569b5e8f0f124f08e2c1e3cab27081dfff2e266c (patch)
treee0b6fa6bede92d69db88756cb171d977e848178d
parent3cf2d9047ab798de9eb74ac73dcb3cd7b612f455 (diff)
downloadchrome-ec-569b5e8f0f124f08e2c1e3cab27081dfff2e266c.tar.gz
g: sps: add flow control signaling
The TPM SPI protocol adds flow control capability, but it is impossible to enforce it by software, software implementations need additional means of informing the master about the slave status. Let's follow the i2c slave driver example and use the interrupt line from the H1 to the SOC to generate a low level pulse every time receive data processing is completed. BRANCH=none BUG=none TEST=to benefit from this patch some changes on the SOC side will be required. Change-Id: I576233598e98e01a007dff6b973fd96ea5ea551c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/446048 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r--chip/g/sps.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/chip/g/sps.c b/chip/g/sps.c
index 2496f7ed27..dba3129dfc 100644
--- a/chip/g/sps.c
+++ b/chip/g/sps.c
@@ -5,6 +5,7 @@
#include "common.h"
#include "console.h"
+#include "gpio.h"
#include "hooks.h"
#include "pmu.h"
#include "registers.h"
@@ -323,6 +324,14 @@ static void sps_rx_interrupt(uint32_t port, int cs_deasserted)
if (cs_deasserted)
sps_rx_handler(NULL, 0, 1);
+
+ /*
+ * SPI does not provide inherent flow control. Let's use this pin to
+ * signal the AP that the device has finished processing received
+ * data.
+ */
+ gpio_set_level(GPIO_INT_AP_L, 0);
+ gpio_set_level(GPIO_INT_AP_L, 1);
}
static void sps_cs_deassert_interrupt(uint32_t port)