diff options
author | Bill Richardson <wfrichar@chromium.org> | 2016-10-07 12:54:56 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-10-07 21:51:43 -0700 |
commit | 241d9e3728c6e2d23d71330be6ddfa5015414f1d (patch) | |
tree | 42c76e368bf443bd21e96ecd216db4393c52d9b8 /board | |
parent | 155b8d6100b92921efe185c101cd2f90072e0b2f (diff) | |
download | chrome-ec-241d9e3728c6e2d23d71330be6ddfa5015414f1d.tar.gz |
Cr50: ecrst and sysrst commands should show state
The current implementation of the ecrst and sysrst commands don't
have a way to show the state of the EC_RST_L and SYS_RST_L.
This tweaks the commands to accept an optional "pulse" argument
in addition to the boolean arg, which will assert, pause, then
deassert the relevant signal. With no args at all, the current
signal state is shown.
BUG=chrome-os-partner:58123
BUG=chrome-os-partner:56835
BRANCH=none
TEST=manual
sysrst pulse resets the AP
sysrst on/off asserts/deasserts SYS_RST_L
sysrst displays the current SYS_RST_L state
ecrst pulse resets the EC (and AP)
ecrst on/off asserts/deasserts EC_RST_L
ecrst displays the current EC_RST_L state
Change-Id: I8e1c9a577afd9ed9e770f1b3f5c0a69e4607de66
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/395587
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/cr50/rdd.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/board/cr50/rdd.c b/board/cr50/rdd.c index 0bb7055ca2..623209fa03 100644 --- a/board/cr50/rdd.c +++ b/board/cr50/rdd.c @@ -225,56 +225,57 @@ static int command_sys_rst(int argc, char **argv) int val; if (argc > 1) { - if (parse_bool(argv[1], &val)) { + if (!strcasecmp("pulse", argv[1])) { + ccprintf("Pulsing AP reset\n"); + assert_sys_rst(); + usleep(200); + deassert_sys_rst(); + } else if (parse_bool(argv[1], &val)) { if (val) assert_sys_rst(); else deassert_sys_rst(); } else return EC_ERROR_PARAM1; - ccprintf("SYS_RST_L is %s\n", is_sys_rst_asserted() ? - "asserted" : "deasserted"); - } else { - ccprintf("Issuing AP reset\n"); - assert_sys_rst(); - usleep(200); - deassert_sys_rst(); } + ccprintf("SYS_RST_L is %s\n", is_sys_rst_asserted() ? + "asserted" : "deasserted"); + return EC_SUCCESS; } DECLARE_SAFE_CONSOLE_COMMAND(sysrst, command_sys_rst, - "[<BOOLEAN>]", + "[pulse | <BOOLEAN>]", "Assert/deassert SYS_RST_L to reset the AP"); static int command_ec_rst(int argc, char **argv) { int val; - if (argc > 1) { - if (parse_bool(argv[1], &val)) { + if (!strcasecmp("pulse", argv[1])) { + ccprintf("Pulsing EC reset\n"); + assert_ec_rst(); + usleep(200); + deassert_ec_rst(); + } else if (parse_bool(argv[1], &val)) { if (val) assert_ec_rst(); else deassert_ec_rst(); } else return EC_ERROR_PARAM1; - - ccprintf("EC_RST_L is %s\n", is_ec_rst_asserted() ? - "asserted" : "deasserted"); - } else { - ccprintf("Issuing EC reset\n"); - assert_ec_rst(); - usleep(200); - deassert_ec_rst(); } + + ccprintf("EC_RST_L is %s\n", is_ec_rst_asserted() ? + "asserted" : "deasserted"); + return EC_SUCCESS; } DECLARE_SAFE_CONSOLE_COMMAND(ecrst, command_ec_rst, - "[<BOOLEAN>]", - "Assert/deassert EC_RST_L"); + "[pulse | <BOOLEAN>]", + "Assert/deassert EC_RST_L to reset the EC (and AP)"); static int command_powerbtn(int argc, char **argv) { |