summaryrefslogtreecommitdiff
path: root/chip/lm4/uart.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/uart.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/uart.c')
-rw-r--r--chip/lm4/uart.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/chip/lm4/uart.c b/chip/lm4/uart.c
index 75f6fa0724..13fad41be6 100644
--- a/chip/lm4/uart.c
+++ b/chip/lm4/uart.c
@@ -180,14 +180,16 @@ static void uart_config(int port)
void uart_init(void)
{
- /* Enable UART0 and Host UART and delay a few clocks */
- LM4_SYSTEM_RCGCUART |= 1;
+ uint32_t mask = 0;
+
+ /* Enable UART0 and Host UART in run, sleep, and deep sleep modes. */
+ mask |= 1;
#ifdef CONFIG_UART_HOST
- LM4_SYSTEM_RCGCUART |= (1 << CONFIG_UART_HOST);
+ mask |= (1 << CONFIG_UART_HOST);
#endif
- clock_wait_cycles(3);
+ clock_enable_peripheral(CGC_OFFSET_UART, mask, CGC_MODE_ALL);
gpio_config_module(MODULE_UART, 1);