diff options
author | Charlie Mooney <charliemooney@chromium.org> | 2012-08-31 11:31:12 -0700 |
---|---|---|
committer | Charlie Mooney <charliemooney@chromium.org> | 2012-09-04 11:00:00 -0700 |
commit | 0766b23f71afd2152751cf298b6ed754f02f0606 (patch) | |
tree | 1308cff4e8cd517cae696d478136c6d0bb202e85 | |
parent | f01e91dbbe8d9379293e701d319577947de217a5 (diff) | |
download | chrome-ec-0766b23f71afd2152751cf298b6ed754f02f0606.tar.gz |
Snow: Dont hang when trying to pmic-reset board
Old Snow board (non-MP) don't have the capability to hard-reset their
pmics unless they've been manually fixed to do so. This means that if
you have an old board, with a new copy of the EC on it and it tries to
hard-reset the system, it will hang forever and trigger the watchdog.
Since there's no way for the EC to check if the hardware fix exists on
its board, this adds a timeout after trying to reset. If the board has
the fix, it will reset before the timeout expires. Otherwise, it will
print a warning message before returning, to prevent it hanging.
Additionally, it also fixes the places board_hard_reset() is called to
deal with the new possibility of it returning.
BUG=chrome-os-partner:13508
TEST=On a machine with the hardware rework and one without it, go to the
EC console and run "pmu reset" to try and force a reset. The one with
the fix should reset immediately, and the one without should warn you
that it tried (and failed) to reset.
BRANCH=snow
Original-Change-Id: I493122ee4da539f363a31f624ab9dd7db8068ec8
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
(cherry picked from commit 3400e5df201ddf1d69acb86075fe334c26579a2b)
Change-Id: Iac9aff9240cf9c1ae85cc92397bea94699bf3bcd
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32068
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
-rw-r--r-- | board/snow/board.c | 11 | ||||
-rw-r--r-- | common/pmu_tps65090.c | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/board/snow/board.c b/board/snow/board.c index c2e29e879c..ab60b71723 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -25,6 +25,8 @@ #define INT_BOTH_FLOATING (GPIO_INPUT | GPIO_INT_BOTH) #define INT_BOTH_PULL_UP (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH) +#define HARD_RESET_TIMEOUT_MS 5 + /* GPIO interrupt handlers prototypes */ #ifndef CONFIG_TASK_GAIAPOWER #define gaia_power_event NULL @@ -308,9 +310,12 @@ void board_hard_reset(void) { /* Force a hard reset of tps Chrome */ gpio_set_level(GPIO_PMIC_RESET, 1); - /* Hang until the power is cut */ - while (1) - ; + + /* Delay while the power is cut */ + udelay(HARD_RESET_TIMEOUT_MS * 1000); + + /* Shouldn't get here unless the board doesn't have this capability */ + panic_puts("Hard reset failed! (this board may not be capable)\n"); } #ifdef CONFIG_PMU_BOARD_INIT diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c index 0804ce3c8b..0b433c53f9 100644 --- a/common/pmu_tps65090.c +++ b/common/pmu_tps65090.c @@ -491,8 +491,11 @@ static int command_pmu(int argc, char **argv) if (argc > 1) { repeat = strtoi(argv[1], &e, 0); if (*e) { - if (strlen(argv[1]) >= 1 && argv[1][0] == 'r') + if (strlen(argv[1]) >= 1 && argv[1][0] == 'r') { board_hard_reset(); + /* If this returns, there was an error */ + return EC_ERROR_UNKNOWN; + } ccputs("Invalid repeat count\n"); return EC_ERROR_INVAL; |