diff options
author | Charlie Mooney <charliemooney@chromium.org> | 2012-08-31 11:31:12 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-08-31 15:41:45 -0700 |
commit | 7d1ffde50818b6a0eb1ccb58f571a6f7bcd65a4c (patch) | |
tree | 42f71f912e2902d2fc33b61d7c90c303501da5bc | |
parent | 96103ab32d9a2c4f6651c83e3993385ed346917a (diff) | |
download | chrome-ec-7d1ffde50818b6a0eb1ccb58f571a6f7bcd65a4c.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
Change-Id: I493122ee4da539f363a31f624ab9dd7db8068ec8
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32043
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Simon Glass <sjg@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 7ca50704a5..14c7277a71 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 @@ -305,9 +307,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 faba493fb4..3af89ad5bb 100644 --- a/common/pmu_tps65090.c +++ b/common/pmu_tps65090.c @@ -561,8 +561,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; |