summaryrefslogtreecommitdiff
path: root/chip/lm4/watchdog.c
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2013-10-08 16:46:58 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-10 23:14:20 +0000
commit27e063ea100086a913ed655b611c88e077de5b00 (patch)
tree701999fd9367e30d008179243a0fc95fc51c5175 /chip/lm4/watchdog.c
parentf7e69a211ce0121ec06c79f6d82574d3347dec2f (diff)
downloadchrome-ec-27e063ea100086a913ed655b611c88e077de5b00.tar.gz
lm4: Modified clock gating to allow easy expansion to low power.
Created a new function to enable or disable clocks to various peripherals. This new function makes it easy to specify if you want the clock enabled in run mode, sleep mode, and/or deep sleep mode. Added infrastructure to specify which GPIOs should interrupt the EC from deep sleep. BUG=none BRANCH=none TEST=Passes all unit tests. Ran on a peppy and verified that the clock gate control registers in run mode (LM4_RCGC regs) were the same before and after this change. Change-Id: Ia5009ac8c837f61dca52fe86ebdeede2e1a7fe4d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/172454 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip/lm4/watchdog.c')
-rw-r--r--chip/lm4/watchdog.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/chip/lm4/watchdog.c b/chip/lm4/watchdog.c
index ef817cf715..56f051bcd8 100644
--- a/chip/lm4/watchdog.c
+++ b/chip/lm4/watchdog.c
@@ -91,12 +91,8 @@ DECLARE_HOOK(HOOK_FREQ_CHANGE, watchdog_freq_changed, HOOK_PRIO_DEFAULT);
int watchdog_init(void)
{
- volatile uint32_t scratch __attribute__((unused));
-
- /* Enable watchdog 0 clock */
- LM4_SYSTEM_RCGCWD |= 0x1;
- /* Wait 3 clock cycles before using the module */
- scratch = LM4_SYSTEM_RCGCWD;
+ /* Enable watchdog 0 clock in run, sleep, and deep sleep modes */
+ clock_enable_peripheral(CGC_OFFSET_WD, 0x1, CGC_MODE_ALL);
/* Set initial timeout period */
watchdog_freq_changed();