summaryrefslogtreecommitdiff
path: root/chip/stm32/usart-stm32f3.h
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2015-02-18 10:25:45 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-24 03:08:07 +0000
commitd2964ba0cf936dc46da3b8f102a420483d0e69d2 (patch)
tree014f73cb92cb11f4de7242423b345474e041dc5b /chip/stm32/usart-stm32f3.h
parenta8628526a3a4790a1890ecffc6df1d42644697c8 (diff)
downloadchrome-ec-d2964ba0cf936dc46da3b8f102a420483d0e69d2.tar.gz
USART: Add STM32F3 support and fix STM32F baud rate bug
Previously the STM32F3 support was non-functional due to it being a cut and paste of the STM32F0, and the clocks are not set up the same way on the two platforms. Also, the STM32F initialization code was incorrectly calling the F0/L buad rate setup code. This change has the variant specific USART code pass the input frequency to the baud rate divisor clock to the baud rate setup code, instead of that code calling clock_get_freq() to determine the input clock frequency. This is required because the STM32F3 is not configured such that the clock_get_freq value and the input to the USART baud rate divisor match. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Verify USART works on discovery as well as Ryu Change-Id: I71248d83b53969d0e7020747a9bb9570803f30ac Reviewed-on: https://chromium-review.googlesource.com/250920 Reviewed-by: Vic Yang <victoryang@chromium.org> Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'chip/stm32/usart-stm32f3.h')
-rw-r--r--chip/stm32/usart-stm32f3.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/chip/stm32/usart-stm32f3.h b/chip/stm32/usart-stm32f3.h
new file mode 100644
index 0000000000..ebf972aab9
--- /dev/null
+++ b/chip/stm32/usart-stm32f3.h
@@ -0,0 +1,20 @@
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef CHIP_STM32_USART_STM32F3_H
+#define CHIP_STM32_USART_STM32F3_H
+
+#include "usart.h"
+
+#define STM32_USARTS_MAX 3
+
+/*
+ * The STM32F3 series can have as many as three UARTS. These are the HW configs
+ * for those UARTS. They can be used to initialize STM32 generic UART configs.
+ */
+extern struct usart_hw_config const usart1_hw;
+extern struct usart_hw_config const usart2_hw;
+extern struct usart_hw_config const usart3_hw;
+
+#endif /* CHIP_STM32_USART_STM32F3_H */