summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-07-24 17:00:55 -0700
committerGerrit <chrome-bot@google.com>2012-07-24 22:32:03 -0700
commitf94f8a01e1a62dbba5a6b566535f1aa47192e8d0 (patch)
tree23d5579e9ab377f2e3c94246f48681ae798379f9
parent3ab8ed4124ec3feffb6a04ce86e2329467e8efc6 (diff)
downloadchrome-ec-f94f8a01e1a62dbba5a6b566535f1aa47192e8d0.tar.gz
Fix order of init hooks so chipset is called before power button
BUG=chrome-os-partner:11779 TEST=manual 1. power on system 2. sysjump RW 3. system should stay powered on Change-Id: Idf238c0567daa6137324e91e58279329865a2d42 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28346 Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
-rw-r--r--chip/lm4/lpc.c2
-rw-r--r--chip/lm4/power_button.c3
-rw-r--r--common/x86_power.c2
-rw-r--r--include/hooks.h9
4 files changed, 13 insertions, 3 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index a5a2220fcb..78dbdb6dda 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -667,7 +667,7 @@ static int lpc_init(void)
* Set prio to higher than default so other inits can initialize their
* memmap data.
*/
-DECLARE_HOOK(HOOK_INIT, lpc_init, HOOK_PRIO_DEFAULT - 1);
+DECLARE_HOOK(HOOK_INIT, lpc_init, HOOK_PRIO_INIT_LPC);
static int lpc_resume(void)
diff --git a/chip/lm4/power_button.c b/chip/lm4/power_button.c
index e209cd4403..9d6185a869 100644
--- a/chip/lm4/power_button.c
+++ b/chip/lm4/power_button.c
@@ -295,7 +295,10 @@ static void set_initial_pwrbtn_state(void)
*/
if (get_power_button_pressed()) {
*memmap_switches |= EC_SWITCH_POWER_BUTTON_PRESSED;
+ CPRINTF("[%T PB init-jumped-held]\n");
set_pwrbtn_to_pch(0);
+ } else {
+ CPRINTF("[%T PB init-jumped]\n");
}
} else if ((reset_flags & RESET_FLAG_AP_OFF) ||
((reset_flags & RESET_FLAG_RESET_PIN) &&
diff --git a/common/x86_power.c b/common/x86_power.c
index cd599692d2..1838643def 100644
--- a/common/x86_power.c
+++ b/common/x86_power.c
@@ -397,7 +397,7 @@ static int x86_power_init(void)
return EC_SUCCESS;
}
-DECLARE_HOOK(HOOK_INIT, x86_power_init, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, x86_power_init, HOOK_PRIO_INIT_CHIPSET);
/*****************************************************************************/
/* Task function */
diff --git a/include/hooks.h b/include/hooks.h
index b27c52fc66..b8ed296529 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -11,9 +11,16 @@
#include "common.h"
enum hook_priority {
+ /* Generic values across all hooks */
HOOK_PRIO_FIRST = 1, /* Highest priority */
HOOK_PRIO_DEFAULT = 5000, /* Default priority */
- HOOK_PRIO_LAST = 9999 /* Lowest priority */
+ HOOK_PRIO_LAST = 9999, /* Lowest priority */
+
+ /* Specific hook vales for HOOK_INIT */
+ /* LPC inits before modules which need memory-mapped I/O */
+ HOOK_PRIO_INIT_LPC = HOOK_PRIO_FIRST + 1,
+ /* Chipset inits before modules which need to know its initial state. */
+ HOOK_PRIO_INIT_CHIPSET = HOOK_PRIO_FIRST + 2,
};