From 80d49a433dd95b243e118c8690ad4e6b1db2b71e Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Fri, 12 Feb 2016 14:05:14 -0800 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/327232 Commit-Ready: Marius Schilder Tested-by: Marius Schilder Reviewed-by: Marius Schilder --- test/tpm_test/ftdi_spi_tpm.c | 2 +- test/tpm_test/mpsse.c | 8 ++++++-- 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;