summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2013-12-27 15:34:02 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-01-03 23:04:27 +0000
commit9346e740397d5abf3cb0576bcf6a6e13ab443690 (patch)
tree9a0aed390e7fb6486e211582025fb0bb70758969
parent3f00af41c41d35fec50090a48796db5c24d0a6d3 (diff)
downloadchrome-ec-9346e740397d5abf3cb0576bcf6a6e13ab443690.tar.gz
nyan: implement chipset_reset() for cold/warm reset
For AP hang detection, the warm reset must be implemented. Since the cold reset is easy, implement it at the same time. BUG=chrome-os-partner:23822, chrome-os-partner:24789, chrome-os-partner:24558 BRANCH=nyan TEST=on nyan rev 3.12 power on/off --> work as usual power on, then apreset cold --> system is cold reset (off, then on) power off, then apreset cold --> nothing happens. this is fine. power on, then apreset warm --> system is warm reset (power trail is kept). power off, then apreset warm --> nothing happens. this is fine. power on --> system is back to normal again. Change-Id: I010793b7a2d309e5d606fbc5877e9e3b07c8c5f3 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/181164 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--power/tegra.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/power/tegra.c b/power/tegra.c
index b00ceb498e..a6f3ebb639 100644
--- a/power/tegra.c
+++ b/power/tegra.c
@@ -332,11 +332,7 @@ static int tegra_power_init(void)
* The warm reset triggers AP into the Tegra recovery mode (
* flash SPI from USB).
*/
- CPRINTF("[%T assert GPIO_PMIC_WARM_RESET_L for %d ms]\n",
- PMIC_WARM_RESET_L_HOLD_TIME / MSEC);
- gpio_set_level(GPIO_PMIC_WARM_RESET_L, 0);
- usleep(PMIC_WARM_RESET_L_HOLD_TIME);
- gpio_set_level(GPIO_PMIC_WARM_RESET_L, 1);
+ chipset_reset(0);
}
/* Leave power off only if requested by reset flags */
@@ -378,23 +374,6 @@ void chipset_exit_hard_off(void)
*/
}
-void chipset_reset(int is_cold)
-{
- /*
- * TODO(crosbug.com/p/23822): Implement cold reset. For now, all
- * resets are warm resets.
- */
- CPRINTF("[%T EC triggered warm reboot]\n");
-
- /*
- * This is a hack to do an AP warm reboot while still preserving RAM
- * contents. This is useful for looking at kernel log message contents
- * from previous boot in cases where the AP/OS is hard hung.
- */
- power_request = POWER_REQ_ON;
- task_wake(TASK_ID_CHIPSET);
-}
-
void chipset_force_shutdown(void)
{
/* Release the power button, if it was asserted */
@@ -561,6 +540,23 @@ static void power_off(void)
CPRINTF("[%T power shutdown complete]\n");
}
+void chipset_reset(int is_cold)
+{
+ if (is_cold) {
+ CPRINTF("[%T EC triggered cold reboot]\n");
+ power_off();
+ /* After XPSHOLD is dropped off, the system will be on again */
+ power_request = POWER_REQ_ON;
+ } else {
+ CPRINTF("[%T EC triggered warm reboot]\n");
+ CPRINTF("[%T assert GPIO_PMIC_WARM_RESET_L for %d ms]\n",
+ PMIC_WARM_RESET_L_HOLD_TIME / MSEC);
+ gpio_set_level(GPIO_PMIC_WARM_RESET_L, 0);
+ usleep(PMIC_WARM_RESET_L_HOLD_TIME);
+ gpio_set_level(GPIO_PMIC_WARM_RESET_L, 1);
+ }
+}
+
/*
* Calculates the delay in microseconds to the next time we have to check
* for a power event,