Allow repeated waitms commands without resetting

At present issuing several 'waitms 1000' commands immediately after each
other trips the watchdog. Add a watchdog reload to avoid this.

Also document the behaviour in the command help.

BUG=b:72542719
BRANCH=none
TEST=manually on grunt, pasting these three lines in:
  waitms 1000
  waitms 1000
  waitms 1000
and see that it does not reset now.
Change-Id: I453708299e4e26c1bbdb5fc406f26e916e7389af
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/955927
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
This commit is contained in:
Simon Glass
2018-03-08 09:37:49 -07:00
committed by chrome-bot
parent 31369c44c2
commit 427005489f

View File

@@ -13,6 +13,7 @@
#include "util.h"
#include "task.h"
#include "timer.h"
#include "watchdog.h"
#define TIMER_SYSJUMP_TAG 0x4d54 /* "TM" */
@@ -265,13 +266,25 @@ static int command_wait(int argc, char **argv)
if (*e)
return EC_ERROR_PARAM1;
/*
* Waiting for too long (e.g. 3s) will cause the EC to reset due to a
* watchdog timeout. This is intended behaviour and is in fact used by
* a FAFT test to check that the watchdog timer is working.
*/
udelay(i * 1000);
/*
* Reload the watchdog so that issuing multiple small waitms commands
* quickly one after the other will not cause a reset.
*/
watchdog_reload();
return EC_SUCCESS;
}
/* Typically a large delay (e.g. 3s) will cause a reset */
DECLARE_CONSOLE_COMMAND(waitms, command_wait,
"msec",
"Busy-wait for msec");
"Busy-wait for msec (large delays will reset)");
#endif
#ifdef CONFIG_CMD_FORCETIME