diff options
author | Vadim Sukhomlinov <sukhomlinov@google.com> | 2020-06-02 11:39:41 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-04 04:28:22 +0000 |
commit | 4fd5c9a385b1a2388d6e7ab282ed5bb570e43288 (patch) | |
tree | 1e0f9a7fd5efd3e58d2dd63bb981c86aea10decc | |
parent | 80f707188fad40701201bc1bb13b4f7558f42528 (diff) | |
download | chrome-ec-4fd5c9a385b1a2388d6e7ab282ed5bb570e43288.tar.gz |
tpmtest/ftdi: improved stability and support for ISERIAL
FTDI module used by tpmtest has stability issues, causing unstable
connection, which seemed to be dependent on setup delay. increased delay
to make it more stable.
Also, FTDI don't work correctly with multiple Ultradebug interfaces.
Make it use ISERIAL env variable if configured to guide interface choice.
BUG=None
TEST=make
Change-Id: Ifa27aac7ef42a8eb990963fa0cf1923a7405f0c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2226139
Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r-- | test/tpm_test/ftdi_spi_tpm.c | 7 | ||||
-rw-r--r-- | test/tpm_test/mpsse.c | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/test/tpm_test/ftdi_spi_tpm.c b/test/tpm_test/ftdi_spi_tpm.c index 4fc281aa24..ebec39b766 100644 --- a/test/tpm_test/ftdi_spi_tpm.c +++ b/test/tpm_test/ftdi_spi_tpm.c @@ -86,7 +86,7 @@ void FtdiStop(void) static void FtdiSpiPoke(void) { Start(mpsse_); - usleep(1000); + usleep(10000); Stop(mpsse_); usleep(60000); } @@ -248,7 +248,7 @@ int FtdiSpiInit(uint32_t freq, int enable_debug) freq = (freq / (100 * 1000)) * 100 * 1000; printf("Starting MPSSE at %d kHz\n", freq / 1000); - mpsse_ = MPSSE(freq, MSB, NULL); + mpsse_ = MPSSE(freq, MSB, getenv("ISERIAL")); if (!mpsse_) return false; @@ -257,6 +257,7 @@ int FtdiSpiInit(uint32_t freq, int enable_debug) FtdiSpiPoke(); + printf("Reading TPM_DID_VID register\n"); FtdiReadReg(TPM_DID_VID_REG, sizeof(did_vid), &did_vid); vid = did_vid & 0xffff; @@ -264,7 +265,7 @@ int FtdiSpiInit(uint32_t freq, int enable_debug) fprintf(stderr, "unknown did_vid: %#x\n", did_vid); return false; } - + printf("Claiming TPM locality zero.\n"); /* Try claiming locality zero. */ FtdiReadReg(TPM_ACCESS_REG, sizeof(cmd), &cmd); if ((cmd & (activeLocality & tpmRegValidSts)) == diff --git a/test/tpm_test/mpsse.c b/test/tpm_test/mpsse.c index e57a9cf761..249b548b11 100644 --- a/test/tpm_test/mpsse.c +++ b/test/tpm_test/mpsse.c @@ -65,7 +65,7 @@ enum clock_rates { #define NULL_CONTEXT_ERROR_MSG "NULL MPSSE context pointer!" #define SPI_TRANSFER_SIZE 512 #define SPI_RW_SIZE (63 * 1024) -#define SETUP_DELAY 25000 +#define SETUP_DELAY 100000 #define LATENCY_MS 2 #define USB_TIMEOUT 120000 #define CHUNK_SIZE 65535 @@ -386,6 +386,12 @@ static struct mpsse_context *OpenIndex(int vid, */ ftdi_usb_purge_buffers(&mpsse->ftdi); + printf("Using FTDI vid=%x, pid=%x", vid, pid); + if (NULL != serial) + printf(" serial=%s\n", serial); + else + printf("\n"); + return mpsse; } |