From 43abc6d9dec5fbea7f4f29f4b238bb21d5c8ea1f Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Wed, 15 Mar 2017 10:13:10 -0700 Subject: [PATCH] cr50: use plt_rst_l low level as a sleep wake trigger When an x86 based system is reset, a pulse on the plt_rst_l line is generated. This pulse is supposed to reset the system and the pulse' rising edge is an interrupt trigger for H1 to reset the TPM. If H1 is in sleep state at the time of the rising edge, the interrupt request could be lost. Luckily, the minimum plt_rst_l pulse duration is 1 ms, and the worst case max time to wake up from sleep for H1 150 us. Let's wake up on low level of plt_rst_l, this way by the time the rising edge comes along the H1 would be awake and ready to process the interrupt. BRANCH=cr50 BUG=b:35995492 TEST=verified that platform_KernelErrorPaths.CORRUPT_STACK passes hundreds of times on a system were it was failing after a few runs before this fix. - verified that suspend_stress_test still succeeds at least 300 iterations Change-Id: Ib9984efa08bdd185a95716dc9e48077cf4bb3c2a Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/455579 Reviewed-by: Aaron Durbin --- board/cr50/board.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/board/cr50/board.c b/board/cr50/board.c index ade07be2a5..5079af1f89 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -473,10 +473,19 @@ static void configure_board_specific_gpios(void) /* Enbale the input */ GWRITE_FIELD(PINMUX, DIOM3_CTL, IE, 1); - /* Set to be edge sensitive */ - GWRITE_FIELD(PINMUX, EXITEDGE0, DIOM3, 1); - /* Select rising edge polarity */ - GWRITE_FIELD(PINMUX, EXITINV0, DIOM3, 0); + /* + * Make plt_rst_l routed to DIOM3 a low level sensitive wake + * source. This way when a plt_rst_l pulse comes along while + * H1 is in sleep, the H1 wakes from sleep first, enabling all + * necessary clocks, and becomes ready to generate an + * interrupt on the rising edge of plt_rst_l. + * + * It takes at most 150 us to wake up, and the pulse is at + * least 1ms long. + */ + GWRITE_FIELD(PINMUX, EXITEDGE0, DIOM3, 0); + GWRITE_FIELD(PINMUX, EXITINV0, DIOM3, 1); + /* Enable powerdown exit on DIOM3 */ GWRITE_FIELD(PINMUX, EXITEN0, DIOM3, 1); } else {