From 7d1ffde50818b6a0eb1ccb58f571a6f7bcd65a4c Mon Sep 17 00:00:00 2001 From: Charlie Mooney Date: Fri, 31 Aug 2012 11:31:12 -0700 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/32043 Reviewed-by: Vincent Palatin Reviewed-by: Simon Glass --- common/pmu_tps65090.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/pmu_tps65090.c') 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; -- cgit v1.2.1