cr50: don't disable TPM_RST_L interrupt

x86 devices use TPM_RST_L to detect the AP state, so we set
device_states[DETECT_AP].detect to GPIO_TPM_RST_L on those boards.
board_update_device_state uses this signal to poll the AP state once a
second to detect if the device is off.

If for some reason TPM_RST_L is deasserted, but the tpm reset handler
has not yet set the state to 'on', we will catch it when we poll the AP
state with board_update_device_state. It will call device_state_on with
TPM_RST_L. In that case device_state_on used to silently disable the
TPM_RST_L interrupt and not change the AP state. This change modifies
device_state_on to notify the tpm reset handler and prevent it from
disabling the tpm reset interrupt.

BUG=chrome-os-partner:62748
BRANCH=none
TEST=disable the deferred_tpm_rst_isr call in
configure_board_specific_gpios. Close the lid and wait 5 minutes. Open
the lid. Verify cr50 prints "device_state_on: tpm_rst_isr hasn't set the
AP state to 'on'" and the system boots normally.

Change-Id: I6e5b722fab6e7b0acb91dda0e5207e4411e97363
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/439816
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Mary Ruthven
2017-02-09 10:52:56 -08:00
committed by chrome-bot
parent 20cf61354c
commit 9ca2b4c775

View File

@@ -800,10 +800,39 @@ static void servo_attached(void)
void device_state_on(enum gpio_signal signal)
{
gpio_disable_interrupt(signal);
/*
* On boards with plt_rst_l the ap state is detected with tpm_rst_l.
* Make sure we don't disable the tpm reset interrupt.
*/
if (signal != GPIO_TPM_RST_L)
gpio_disable_interrupt(signal);
switch (signal) {
case GPIO_DETECT_AP: /* Would happen only on non plt_rst_l devices. */
case GPIO_TPM_RST_L:
/*
* Boards using tpm_rst_l have no AP state interrupt that will
* trigger device_state_on, so this will only get called when we
* poll the AP state and see that the detect signal is high, but
* the device state is not 'on'.
*
* Boards using tpm_rst_l to detect the AP state use the tpm
* reset handler to set the AP state to 'on'. If we managed to
* get to this point, the tpm reset handler has not run yet.
* This should only happen if there is a race between the board
* state polling and a scheduled call to
* deferred_tpm_rst_isr_data, but it may be because we missed
* the rising edge. Notify the handler again just in case we
* missed the edge to make sure we reset the tpm and update the
* state. If there is already a pending call, then this call
* won't affect it, because subsequent calls to to
* hook_call_deferred just change the delay for the call, and we
* are setting the delay to asap.
*/
CPRINTS("%s: tpm_rst_isr hasn't set the AP state to 'on'.",
__func__);
hook_call_deferred(&deferred_tpm_rst_isr_data, 0);
break;
case GPIO_DETECT_AP:
if (device_state_changed(DEVICE_AP, DEVICE_STATE_ON))
hook_notify(HOOK_CHIPSET_RESUME);
break;