summaryrefslogtreecommitdiff
path: root/chip/lm4/watchdog.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-03-19 10:59:38 -0700
committerRandall Spangler <rspangler@chromium.org>2012-03-19 15:41:14 -0700
commitb2ac77b37b66ce2e6e621743d5cd1510457cc19f (patch)
tree53a66e7092d8a1fc74f04178c805ec05eb77f637 /chip/lm4/watchdog.c
parent1fd7062b29c685d98be8586ded4587e5e1e169ee (diff)
downloadchrome-ec-b2ac77b37b66ce2e6e621743d5cd1510457cc19f.tar.gz
Support warm reboot from one EC image to another.
This is necessary at init-time for verified boot to jump from RO to one of the RW images. It's also used by factory EC update to update one image and then jump to the updated image to finish the update. In this case, the x86 does NOT reboot. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:8449 TEST=manual 1) power on x86 and log in 2) sysjump a --> system is in a; x86 has not rebooted 3) sysjump ro --> system is back in RO; x86 has not rebooted 4) reboot -> system is in RO; x86 HAS rebooted Change-Id: I9dbadcf9775e146a0718abfd4ee0758b65350a87
Diffstat (limited to 'chip/lm4/watchdog.c')
-rw-r--r--chip/lm4/watchdog.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/chip/lm4/watchdog.c b/chip/lm4/watchdog.c
index 5a3080dcdb..74fe3e5fbd 100644
--- a/chip/lm4/watchdog.c
+++ b/chip/lm4/watchdog.c
@@ -114,10 +114,13 @@ int watchdog_init(int period_ms)
/* Enable watchdog 0 clock */
LM4_SYSTEM_RCGCWD |= 0x1;
- /* wait 3 clock cycles before using the module */
+ /* Wait 3 clock cycles before using the module */
scratch = LM4_SYSTEM_RCGCWD;
- /* set the time-out period */
+ /* Unlock watchdog registers */
+ LM4_WATCHDOG_LOCK(0) = LM4_WATCHDOG_MAGIC_WORD;
+
+ /* Set the time-out period */
watchdog_period = period_ms * (CPU_CLOCK / 1000);
LM4_WATCHDOG_LOAD(0) = watchdog_period;
@@ -129,7 +132,10 @@ int watchdog_init(int period_ms)
*/
LM4_WATCHDOG_CTL(0) = 0x3;
- /* lock watchdog registers against unintended accesses */
+ /* Reset watchdog interrupt bits */
+ LM4_WATCHDOG_ICR(0) = LM4_WATCHDOG_RIS(0);
+
+ /* Lock watchdog registers against unintended accesses */
LM4_WATCHDOG_LOCK(0) = 0xdeaddead;
/* Enable watchdog interrupt */