summaryrefslogtreecommitdiff
path: root/chip/npcx
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-07-23 15:58:48 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-30 04:32:36 +0000
commit1cef85d675613e6cf18a5408675cc33085586d8b (patch)
treee27e38bd2fcec9982ead68ad36591f3e6595a7e4 /chip/npcx
parentc7a2cb72c6de063c83cc2b5385f1e67571267569 (diff)
downloadchrome-ec-1cef85d675613e6cf18a5408675cc33085586d8b.tar.gz
spi: Use different hooks for SPI enable/disable
If CONFIG_CHIPSET_RESUME_INIT_HOOK is defined, move the SPI enable/disable to different hooks, i.e. * RESUME_INIT instead of RESUME * SUSPEND_COMPLETE instead SUSPEND The SPI interface has to be enable earlier than other hooks to receive a host sleep event. BRANCH=None BUG=b:148149387 TEST=make buildall -j Change-Id: Ic56a7b5ef20fb8258487d1d350fc5f8a55e33049 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2324989 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'chip/npcx')
-rw-r--r--chip/npcx/shi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/npcx/shi.c b/chip/npcx/shi.c
index f3b94cc304..bb2696acae 100644
--- a/chip/npcx/shi.c
+++ b/chip/npcx/shi.c
@@ -940,7 +940,11 @@ static void shi_enable(void)
*/
task_enable_irq(NPCX_IRQ_SHI);
}
+#ifdef CONFIG_CHIPSET_RESUME_INIT_HOOK
+DECLARE_HOOK(HOOK_CHIPSET_RESUME_INIT, shi_enable, HOOK_PRIO_DEFAULT);
+#else
DECLARE_HOOK(HOOK_CHIPSET_RESUME, shi_enable, HOOK_PRIO_DEFAULT);
+#endif
static void shi_reenable_on_sysjump(void)
{
@@ -979,7 +983,11 @@ static void shi_disable(void)
*/
enable_sleep(SLEEP_MASK_SPI);
}
+#ifdef CONFIG_CHIPSET_RESUME_INIT_HOOK
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND_COMPLETE, shi_disable, HOOK_PRIO_DEFAULT);
+#else
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, shi_disable, HOOK_PRIO_DEFAULT);
+#endif
DECLARE_HOOK(HOOK_SYSJUMP, shi_disable, HOOK_PRIO_DEFAULT);
static void shi_init(void)