From f55e55322834db625bfffe02371e9f258412a024 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Wed, 31 Oct 2012 17:44:51 -0700 Subject: link: Cold reboot should ignore WAKE# pin This fixes the EC not being able to do a cold reset while the power button is held down, because the power button asserts WAKE#. BUG=chrome-os-partner:15705 BRANCH=link TEST=manual - scope HIB# - hold down power button - from console, 'reboot cold' HIB# should stay asserted for 150ms. Before this fix, it asserted only briefly. Change-Id: I07c6bb5ee3f846544c75e7e0d4584f8434a9cd56 Signed-off-by: Randall Spangler Reviewed-on: https://gerrit.chromium.org/gerrit/37090 Reviewed-by: Vincent Palatin Reviewed-by: Puneet Kumar (cherry picked from commit 9a1548984d1bcfb6a2035110349af9e2e0f4531a) Reviewed-on: https://gerrit.chromium.org/gerrit/37094 --- chip/lm4/system.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/chip/lm4/system.c b/chip/lm4/system.c index 80d4522e72..bc650a3a93 100644 --- a/chip/lm4/system.c +++ b/chip/lm4/system.c @@ -227,7 +227,11 @@ static void hibernate(uint32_t seconds, uint32_t microseconds, uint32_t flags) /* Set up wake reasons and hibernate flags */ hibctl = LM4_HIBERNATE_HIBCTL | LM4_HIBCTL_PINWEN; - flags |= HIBDATA_WAKE_PIN; + + if (flags & HIBDATA_WAKE_PIN) + hibctl |= LM4_HIBCTL_PINWEN; + else + hibctl &= ~LM4_HIBCTL_PINWEN; if (seconds || microseconds) { hibctl |= LM4_HIBCTL_RTCWEN; @@ -279,7 +283,7 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds) { /* Flush console before hibernating */ cflush(); - hibernate(seconds, microseconds, 0); + hibernate(seconds, microseconds, HIBDATA_WAKE_PIN); } int system_pre_init(void) @@ -362,7 +366,10 @@ void system_reset(int flags) hibdata_write(HIBDATA_INDEX_SAVED_RESET_FLAGS, save_flags); if (flags & SYSTEM_RESET_HARD) { - /* Bounce through hibernate to trigger a hard reboot */ + /* + * Bounce through hibernate to trigger a hard reboot. Do + * not wake on wake pin, since we need the full duration. + */ hibernate(0, HIB_RESET_USEC, HIBDATA_WAKE_HARD_RESET); } else CPU_NVIC_APINT = 0x05fa0004; -- cgit v1.2.1