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>
This commit is contained in:
Vadim Bendebury
2016-02-12 14:05:14 -08:00
committed by chrome-bot
parent 7dd904b8d3
commit 80d49a433d
2 changed files with 7 additions and 3 deletions

View File

@@ -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;

View File

@@ -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;