summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-05-27 10:45:32 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-27 23:21:21 +0000
commit8c89bcff4dce7f8921ffda1603d6f77bf8465356 (patch)
tree6b3dc907470fec808830ccc27c5fecf46461c835
parentf4de7fb005b70bf289d05aca2266be429d813e58 (diff)
downloadchrome-ec-8c89bcff4dce7f8921ffda1603d6f77bf8465356.tar.gz
zinger: activate the watchdog.
Ensure we are never stuck somewhere without doing the safety checks by enabling the watchdog and reloading it in the safaty checks function. I have kept the default timing constants, so on STM32F0xx the watchdog period should be between 1.2s (LSI at 30kHz) and 2.0s (LSI at 50kHz). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=add a 2s loop in the serial port interrupt handler and see the power supply rebooting. Change-Id: I000f2a36a31e1166adf63a36c2b7f52999adc928 Reviewed-on: https://chromium-review.googlesource.com/201575 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/zinger/hardware.c2
-rw-r--r--board/zinger/usb_pd_policy.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/board/zinger/hardware.c b/board/zinger/hardware.c
index 0bafa48839..52d2f4e057 100644
--- a/board/zinger/hardware.c
+++ b/board/zinger/hardware.c
@@ -13,6 +13,7 @@
#include "task.h"
#include "timer.h"
#include "util.h"
+#include "watchdog.h"
static void clock_init(void)
{
@@ -164,6 +165,7 @@ void hardware_init(void)
pins_init();
uart_init();
timers_init();
+ watchdog_init();
adc_init();
irq_init();
}
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c
index c8dfcb0ea2..1b52d0876c 100644
--- a/board/zinger/usb_pd_policy.c
+++ b/board/zinger/usb_pd_policy.c
@@ -186,6 +186,9 @@ int pd_board_checks(void)
int vbus_volt, vbus_amp;
int watchdog_enabled = STM32_ADC_CFGR1 & (1 << 23);
+ /* Reload the watchdog */
+ STM32_IWDG_KR = STM32_IWDG_KR_RELOAD;
+
if (watchdog_enabled)
/* if the watchdog is enabled, stop it to do other readings */
adc_disable_watchdog();