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 <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/211497
Reviewed-by: Trevor Bourget <tbourget@codeaurora.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
Vadim Bendebury 2014-08-07 15:20:21 -07:00 committed by chrome-internal-fetch
commit d5e07815c2

View file

@ -18,10 +18,12 @@
*/
#include <arch/cache.h>
#include <boardid.h>
#include <boot/coreboot_tables.h>
#include <console/console.h>
#include <device/device.h>
#include <delay.h>
#include <device/device.h>
#include <gpiolib.h>
#include <string.h>
#include <soc/qualcomm/ipq806x/include/clock.h>
@ -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)