summaryrefslogtreecommitdiff
path: root/chip/g/spi_master.c
diff options
context:
space:
mode:
authorMarius Schilder <mschilder@google.com>2018-03-26 22:15:14 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-03-27 20:34:42 -0700
commit62cd2cb56cee0655ce7ef18661058db7738d096e (patch)
treef0d8c02fa2ff0146caca037bfbf2561f92d7b5ca /chip/g/spi_master.c
parente23e0cf3c002a7ed40a6334b5e5141815691c612 (diff)
downloadchrome-ec-62cd2cb56cee0655ce7ef18661058db7738d096e.tar.gz
g: add stream sniffing for DUT spiflash content.
Use the stream signing mechanism to hook outgoing spiflash content. This is (only?) used by Mn50 during chip production flows. BUG=None BRANCH=none TEST=make buildall -j8 Signed-off-by: mschilder@google.com Change-Id: Iccfee173865f587f088a31fcbc7b939823884c31 Reviewed-on: https://chromium-review.googlesource.com/981892 Commit-Ready: Marius Schilder <mschilder@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'chip/g/spi_master.c')
-rw-r--r--chip/g/spi_master.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/chip/g/spi_master.c b/chip/g/spi_master.c
index e3547d0d97..96acfa4315 100644
--- a/chip/g/spi_master.c
+++ b/chip/g/spi_master.c
@@ -12,6 +12,10 @@
#include "timer.h"
#include "util.h"
+#ifdef CONFIG_STREAM_SIGNATURE
+#include "signing.h"
+#endif
+
/* Not defined in the hardware register spec, the RX and TX buffers are 128B. */
#define SPI_BUF_SIZE 0x80
@@ -69,6 +73,13 @@ int spi_transaction(const struct spi_device_t *spi_device,
/* Grab the port's mutex. */
mutex_lock(&spi_mutex[port]);
+#ifdef CONFIG_STREAM_SIGNATURE
+ /*
+ * This hook allows mn50 to sniff data written to target
+ * manufactured H1 devices.
+ */
+ sig_append(stream_spiflash, txdata, txlen);
+#endif
/* Copy the txdata into the 128B Transmit Buffer. */
memmove((uint8_t *)GREG32_ADDR_I(SPI, port, TX_DATA), txdata, txlen);