kevin: Fix EC watchdog on power-down after sysjump

If the AP requests a shutdown before HOOK_INIT completes, we may yank
our SPI pins before motion sense-related SPI sensor init has completed.

BUG=chrome-os-partner:57518
BRANCH=Kevin
TEST=Cold reset EC, verify EC doesn't watchdog.

Change-Id: Ie8196fc1f6f52e119860378b001bf6037e7d5239
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/386445
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 0a17e821524d1ef66ac878e5573abf80cb440746)
Reviewed-on: https://chromium-review.googlesource.com/387627
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2016-09-16 17:29:07 -07:00
committed by chrome-bot
parent 420b423096
commit 7983efdf80

View File

@@ -298,8 +298,23 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME,
board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
/*
* Don't yank our SPI pins until we know HOOK_INIT has completed, since we
* do sensor initialization from HOOK_INIT.
*/
static int hook_init_done;
static void hook_init_last(void)
{
hook_init_done = 1;
}
DECLARE_HOOK(HOOK_INIT, hook_init_last, HOOK_PRIO_LAST + 1);
static void board_spi_disable(void)
{
while (!hook_init_done)
msleep(10);
spi_enable(CONFIG_SPI_ACCEL_PORT, 0);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND,