diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2012-01-27 23:10:25 +0000 |
---|---|---|
committer | Vincent Palatin <vpalatin@chromium.org> | 2012-01-31 22:29:13 +0000 |
commit | e3edad44599ed0f66b46c110b6a0b8abc51e671c (patch) | |
tree | 0bc3c1bd4e1b3d46ecc7a1de8e80a1b0c852e96b /board | |
parent | df1d8933223817b4b5afe33101e939ff243aa9f6 (diff) | |
download | chrome-ec-e3edad44599ed0f66b46c110b6a0b8abc51e671c.tar.gz |
stm32l: add UART driver
simple UART driver to get the serial console on the USART3.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=None
TEST=run on Discovery board and check we get the first message on the
UART and the console is echoing the characters.
Change-Id: Id85999a5ddbd75804e9317a1b8c2fd4afb89eb38
Diffstat (limited to 'board')
-rw-r--r-- | board/discovery/board.c | 11 | ||||
-rw-r--r-- | board/discovery/board.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/board/discovery/board.c b/board/discovery/board.c index d6b05bb622..ec18af63e3 100644 --- a/board/discovery/board.c +++ b/board/discovery/board.c @@ -6,9 +6,20 @@ #include "board.h" #include "common.h" +#include "registers.h" void configure_board(void) { + /* Enable all GPIOs clocks + * TODO: more fine-grained enabling for power saving + */ + STM32L_RCC_AHBENR |= 0x3f; + + /* Select Alternate function for USART3 on pins PB10/PB11 */ + STM32L_GPIO_AFRH(B) = (STM32L_GPIO_AFRH(B) & ~0x0000FF00) | + (0x7 << 12) | (0x7 << 8); + STM32L_GPIO_MODER(B) = (STM32L_GPIO_MODER(B) & ~0x00F00000) | + 0x00A00000; } /** diff --git a/board/discovery/board.h b/board/discovery/board.h index 48a1e280da..42365cacf2 100644 --- a/board/discovery/board.h +++ b/board/discovery/board.h @@ -11,6 +11,9 @@ /* 16 MHz SYSCLK clock frequency */ #define CPU_CLOCK 16000000 +/* Use USART3 as console serial port */ +#define CONFIG_CONSOLE_UART 3 + #define USB_CHARGE_PORT_COUNT 0 /* GPIO signal list */ |