From d4ce7fd5f4d6eb13623b6d962bec56546a2f3502 Mon Sep 17 00:00:00 2001 From: Louis Yung-Chieh Lo Date: Thu, 12 Dec 2013 11:09:56 -0800 Subject: nyan: bring back set_ap_reset() for old boards. Since some folks are still using old boards (rev <= 2.0), bring this back so that they can reset system gracefully. BUG=None BRANCH=nyan TEST=tested on rev 2.0 reboot // EC and AP are rebooted reset button on board // EC and AP are reset power off // AP (rev 2.0) is expected NOT powered off. power on Change-Id: I35dbc5648b092c892dc06ce5676e1e68c695d477 Signed-off-by: Louis Yung-Chieh Lo Reviewed-on: https://chromium-review.googlesource.com/179851 Reviewed-by: Randall Spangler --- power/tegra.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/power/tegra.c b/power/tegra.c index e865011bc3..83dc47bd58 100644 --- a/power/tegra.c +++ b/power/tegra.c @@ -142,6 +142,23 @@ static int wait_in_signal(enum gpio_signal signal, int value, int timeout) return EC_SUCCESS; } +/** + * Set the AP RESET signal. + * + * This fucntion is for backward-compatible. + * + * AP_RESET_L (PB3) is stuffed before rev <= 2.0 and connected to PMIC RESET. + * After rev >= 2.2, this is removed. This should not effected the new board. + * + * @param asserted Assert (=1) or deassert (=0) the signal. This is the + * logical level of the pin, not the physical level. + */ +static void set_ap_reset(int asserted) +{ + /* Signal is active-low */ + gpio_set_level(GPIO_AP_RESET_L, asserted ? 0 : 1); +} + /** * Set the PMIC PWRON signal. * @@ -368,6 +385,9 @@ void chipset_force_shutdown(void) set_pmic_therm(1); udelay(PMIC_THERM_HOLD_TIME); set_pmic_therm(0); + + /* Hold the reset pin so that the AP stays in off mode (rev <= 2.0) */ + set_ap_reset(1); } /*****************************************************************************/ @@ -421,8 +441,9 @@ static int check_for_power_on_event(void) */ static int power_on(void) { - /* Make sure we de-assert the PMI_THERM_L pin. */ + /* Make sure we de-assert the PMI_THERM_L and AP_RESET_L pin. */ set_pmic_therm(0); + set_ap_reset(0); /* Push the power button */ set_pmic_pwron(1); -- cgit v1.2.1