summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-09-16 17:29:07 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-21 19:38:18 -0700
commit7983efdf80d2b55249c868386276af75db4c6be1 (patch)
tree97aeb5fcff1d5923d9e5321d61f4e338efd377cc
parent420b4230968c16c6fb856874a6fd78730c8fd397 (diff)
downloadchrome-ec-7983efdf80d2b55249c868386276af75db4c6be1.tar.gz
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>
-rw-r--r--board/kevin/board.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/board/kevin/board.c b/board/kevin/board.c
index 9b594e8e76..53fc52c36f 100644
--- a/board/kevin/board.c
+++ b/board/kevin/board.c
@@ -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,