From d5e07815c227089b7f266ba5329812bf309b87e6 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Thu, 7 Aug 2014 15:20:21 -0700 Subject: [PATCH] storm: reset TPM proprely on proto0 The proto0 storm hardware has TPM reset line wired to the SOC GPIO22 pin instead of the system reset. This causes all kind of TPM behavior problems and requires frequent power cycles. Adding explicit TPM reset makes all those problems go away. BUG=chrome-os-partner:30705, chrome-os-partner:30829 TEST=tried resetting proto0 at different moments during boot up - the TPM does not fail anymore. Change-Id: Ia877fcd9efaf3ba12c8fe8c2958bd81c4bf22799 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/211497 Reviewed-by: Trevor Bourget Reviewed-by: David Hendricks --- src/mainboard/google/storm/mainboard.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/storm/mainboard.c b/src/mainboard/google/storm/mainboard.c index 442e9e9581..268ed463fe 100644 --- a/src/mainboard/google/storm/mainboard.c +++ b/src/mainboard/google/storm/mainboard.c @@ -18,10 +18,12 @@ */ #include +#include #include #include -#include #include +#include +#include #include #include @@ -71,10 +73,29 @@ static void setup_mmu(void) dcache_mmu_enable(); } +#define TPM_RESET_GPIO 22 +static void setup_tpm(void) +{ + if (board_id() != 0) + return; /* Only proto0 have TPM reset connected to GPIO22 */ + + gpio_tlmm_config_set(TPM_RESET_GPIO, FUNC_SEL_GPIO, GPIO_PULL_UP, + GPIO_4MA, GPIO_ENABLE); + /* + * Generate a reset pulse. The spec calls for 80 us minimum, let's + * make it twice as long. If the output was driven low originally, the + * reset pulse will be even longer. + */ + gpio_set_out_value(TPM_RESET_GPIO, 0); + udelay(160); + gpio_set_out_value(TPM_RESET_GPIO, 1); +} + static void mainboard_init(device_t dev) { setup_mmu(); setup_usb(); + setup_tpm(); } static void mainboard_enable(device_t dev)