summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2012-09-19 17:24:27 +0800
committerGerrit <chrome-bot@google.com>2012-09-19 20:43:04 -0700
commitd136fd9282cd39e4428cb7dc6a878e4fb50cd09d (patch)
tree1fa7bd3251f536026963712100d1cf91aa690995
parent8e7afc161a5b282943c0c3c10e2820a8cb4a8de3 (diff)
downloadchrome-ec-d136fd9282cd39e4428cb7dc6a878e4fb50cd09d.tar.gz
Fixed a bug of sysjump: shutdown but reboot.
CL 31370 almost fixed the power on bug except in the sysjump mode. While EC firmware is being updated, the EC would sysjump between RO and RW. So that gaia_power_init() would be called and accidentally set auto_power_on to 1, which makes the next shutdown reboot instead. Thus, clear the auto_power_on if the system is already on. Also added more debug for future debug and fixed the XPSHOLD message output. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> BRANCH=Snow BUG=chrome-os-partner:14183, TEST=On snow: ; reboot successes. power on 1 (XPSHOLD seen) ssh root@snow_ip "ectool reboot_ec RO; ectool reboot_ec A; reboot" ; ; system halts (no more automatical power-on, ending loop 3) ssh root@snow_ip "ectool reboot_ec RO; ectool reboot_ec A; shutdown -h now" Change-Id: Iad54377d53701b986ff4f0c9996f02f8f17f070a Reviewed-on: https://gerrit.chromium.org/gerrit/33601 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Ready: Yung-Chieh Lo <yjlou@chromium.org> Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
-rw-r--r--common/gaia_power.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/common/gaia_power.c b/common/gaia_power.c
index 441f46f634..ab40cdc560 100644
--- a/common/gaia_power.c
+++ b/common/gaia_power.c
@@ -256,12 +256,18 @@ int gaia_power_init(void)
gpio_enable_interrupt(GPIO_SUSPEND_L);
/* Leave power off only if requested by reset flags */
- if (!(system_get_reset_flags() & RESET_FLAG_AP_OFF))
+ if (!(system_get_reset_flags() & RESET_FLAG_AP_OFF)) {
+ CPRINTF("[%T auto_power_on is set due to reset_flag 0x%x]\n",
+ system_get_reset_flags());
auto_power_on = 1;
+ }
/* Auto power on if the recovery combination was pressed */
- if (keyboard_scan_recovery_pressed())
+ if (keyboard_scan_recovery_pressed()) {
+ CPRINTF("[%T auto_power_on is set due to "
+ "keyboard_scan_recovery_pressed() ...]\n");
auto_power_on = 1;
+ }
return EC_SUCCESS;
}
@@ -306,8 +312,11 @@ void chipset_exit_hard_off(void)
static int check_for_power_on_event(void)
{
/* the system is already ON */
- if (gpio_get_level(GPIO_EN_PP3300))
+ if (gpio_get_level(GPIO_EN_PP3300)) {
+ CPRINTF("[%T system is on, thus clear auto_power_on]\n");
+ auto_power_on = 0; /* no need to arrange another power on */
return 1;
+ }
/* power on requested at EC startup for recovery */
if (auto_power_on) {
@@ -424,10 +433,10 @@ static int react_to_xpshold(unsigned int timeout_us)
wait_in_signal(GPIO_SOC1V8_XPSHOLD, 1, timeout_us);
if (gpio_get_level(GPIO_SOC1V8_XPSHOLD) == 0) {
- CPUTS("XPSHOLD not seen in time\n");
+ CPUTS("[%T XPSHOLD not seen in time]\n");
return -1;
}
- CPRINTF("%T XPSHOLD seen\n");
+ CPRINTF("[%T XPSHOLD seen]\n");
gpio_set_level(GPIO_PMIC_PWRON_L, 1);
return 0;
}