summaryrefslogtreecommitdiff
path: root/chip/stm32/usart.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2015-07-28 10:30:44 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-10 17:54:17 +0000
commit014d180b1da90a5e23f2ebd4df3d00457bc5fb28 (patch)
treee6ac67ab0e24d86d82e2e93fc811261bddd66568 /chip/stm32/usart.c
parent77f68f204f2e27f7ed7e80bcdd1e36280bbcff83 (diff)
downloadchrome-ec-014d180b1da90a5e23f2ebd4df3d00457bc5fb28.tar.gz
USART: Split RX driver between L and F families
The USART peripheral in the L and F families is different enough to need different receive drivers. In particular, the L family USART perihperal has no way of disabling the overflow error bit. So for that family we check and clear the bit, and keep a count of overflows. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: Iea26c242d5177afd552a3bd4d6ab1a9c7a65f90e Reviewed-on: https://chromium-review.googlesource.com/288978 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'chip/stm32/usart.c')
-rw-r--r--chip/stm32/usart.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/chip/stm32/usart.c b/chip/stm32/usart.c
index 32dbeaf7d0..549769cb48 100644
--- a/chip/stm32/usart.c
+++ b/chip/stm32/usart.c
@@ -42,7 +42,7 @@ void usart_init(struct usart_config const *config)
*/
STM32_USART_CR1(base) = 0x0000;
STM32_USART_CR2(base) = 0x0000;
- STM32_USART_CR3(base) = STM32_USART_CR3_OVRDIS;
+ STM32_USART_CR3(base) = 0x0000;
/*
* Enable the RX, TX, and variant specific HW.
@@ -52,6 +52,12 @@ void usart_init(struct usart_config const *config)
config->hw->ops->enable(config);
/*
+ * Clear error counts.
+ */
+ config->state->rx_overrun = 0;
+ config->state->rx_dropped = 0;
+
+ /*
* Enable the USART, this must be done last since most of the
* configuration bits require that the USART be disabled for writes to
* succeed.
@@ -98,6 +104,6 @@ void usart_set_baud_f(struct usart_config const *config, int frequency_hz)
void usart_interrupt(struct usart_config const *config)
{
- config->tx->interrupt(config);
- config->rx->interrupt(config);
-} \ No newline at end of file
+ config->tx->interrupt(config);
+ config->rx->interrupt(config);
+}