diff options
Diffstat (limited to 'power/tegra.c')
-rw-r--r-- | power/tegra.c | 40 |
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, |