summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-02-12 14:05:14 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-02-13 20:04:48 -0800
commit80d49a433dd95b243e118c8690ad4e6b1db2b71e (patch)
tree712879e899fe1fe73a4e0d03c40302a5e30596cd /test
parent7dd904b8d339ea5fbcedf596ae74cb512c4d1052 (diff)
downloadchrome-ec-80d49a433dd95b243e118c8690ad4e6b1db2b71e.tar.gz
cr50: modify mpsse to work with the new device
The ultra debug board uses a different FTDI chip (vid:did 0403:6010), which has two ports. The SPI interface on this chip is hooked up to the second port, but the code indiscriminately uses the first port when trying to open the SPI channel, on all devices known to it. Adding a new field in the supported_devices table allows to keep default behavior, but use port B (the second port) when required. Also, fix printout formatting problem. BRANCH=none BUG=chrome-os-partner:37754 TEST=tpmtest succeeds with the new board Change-Id: I01f7937444c8df61d7439a66d9da89fb2cac5372 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/327232 Commit-Ready: Marius Schilder <mschilder@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/tpm_test/ftdi_spi_tpm.c2
-rw-r--r--test/tpm_test/mpsse.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/test/tpm_test/ftdi_spi_tpm.c b/test/tpm_test/ftdi_spi_tpm.c
index ac028ef325..6cf8761b24 100644
--- a/test/tpm_test/ftdi_spi_tpm.c
+++ b/test/tpm_test/ftdi_spi_tpm.c
@@ -369,7 +369,7 @@ struct swig_string_data FtdiSendCommandAndWait(char *tpm_command,
for (i = 0; i < command_size; i++) {
if (!(i % 16))
printf("\n");
- printf(" %2.2x", tpm_command[i]);
+ printf(" %2.2x", (uint8_t)tpm_command[i]);
}
printf("\n");
return empty_string_data;
diff --git a/test/tpm_test/mpsse.c b/test/tpm_test/mpsse.c
index 9b8d97e8e3..f54c37bc90 100644
--- a/test/tpm_test/mpsse.c
+++ b/test/tpm_test/mpsse.c
@@ -80,9 +80,11 @@ static struct vid_pid {
int vid;
int pid;
char *description;
+ int use_B;
} supported_devices[] = {
{
- 0x0403, 0x6010, "FT2232 Future Technology Devices International, Ltd"},
+ 0x0403, 0x6010, "FT2232 Future Technology Devices International, Ltd",
+ 1},
{
0x0403, 0x6011, "FT4232 Future Technology Devices International, Ltd"},
{
@@ -405,7 +407,9 @@ struct mpsse_context *MPSSE(int freq, int endianness, const char *serial)
for (i = 0; supported_devices[i].vid != 0; i++) {
mpsse = OpenIndex(supported_devices[i].vid,
supported_devices[i].pid, freq, endianness,
- IFACE_A, NULL, serial, 0);
+ supported_devices[i].use_B ?
+ IFACE_B : IFACE_A,
+ NULL, serial, 0);
if (!mpsse)
continue;