summaryrefslogtreecommitdiff
path: root/chip/stm32/uart.c
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-06-15 19:37:54 +0000
committerGerrit <chrome-bot@google.com>2012-08-09 11:55:03 -0700
commitb081af1284c2e63747451bc8984d27e8430a9bb4 (patch)
tree733988cac0c88af67832712b6ddeeb8d02cacfce /chip/stm32/uart.c
parent3a6a369d39512d8cc394936ec2ccea81c651816b (diff)
downloadchrome-ec-b081af1284c2e63747451bc8984d27e8430a9bb4.tar.gz
stm32f100: implement low power mode
When the AP is not running and we have enough time go to STOP mode instead of simple idle. The EC consumption should drop from 12mW to a few mW. This is currently not activated by default, you need to type "sleepmask 0" in the EC console to activate it. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=chrome-os-partner:8866 TEST=on Snow, check the software is still working properly when STOP mode is activated and measure power consumption on 3v_alw rail. Change-Id: I231d76fe6494c07b198c41694755b82d87c00e75 Reviewed-on: https://gerrit.chromium.org/gerrit/29315 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/stm32/uart.c')
-rw-r--r--chip/stm32/uart.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/chip/stm32/uart.c b/chip/stm32/uart.c
index 176e0afcf3..4b786d4c4c 100644
--- a/chip/stm32/uart.c
+++ b/chip/stm32/uart.c
@@ -9,6 +9,7 @@
#include "board.h"
#include "config.h"
+#include "clock.h"
#include "registers.h"
#include "task.h"
#include "uart.h"
@@ -31,6 +32,7 @@ int uart_init_done(void)
void uart_tx_start(void)
{
+ disable_sleep(SLEEP_MASK_UART);
STM32_USART_CR1(UARTN) |= 0x80;
should_stop = 0;
task_trigger_irq(STM32_IRQ_USART(UARTN));
@@ -40,6 +42,7 @@ void uart_tx_stop(void)
{
STM32_USART_CR1(UARTN) &= ~0x80;
should_stop = 1;
+ enable_sleep(SLEEP_MASK_UART);
}
int uart_tx_stopped(void)