summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-02-23 08:53:53 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-03-02 18:10:10 +0000
commit4fd2e59466e41ef8e62f8f819f8ed937870e2136 (patch)
treec3411e12b442da24a4064eddce236f582fd3f48a
parent7a66f777078090b264c95ac0e013cd60911121f8 (diff)
downloadchrome-ec-4fd2e59466e41ef8e62f8f819f8ed937870e2136.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> (cherry picked from commit 569b5e8f0f124f08e2c1e3cab27081dfff2e266c) Reviewed-on: https://chromium-review.googlesource.com/448718
-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)