[U-Boot] [PATCH v2 5/6] serial: stm32: add stm32f1 support

Matt Porter
2015-04-21T17:36:57Z

Add support for the STM32F1 famly to the STM32 serial driver.

Signed-off-by: Matt Porter <mporter@konsulko.com>
---
Since v1:
- Explicitly check for F4/F1 family and error if not
set to a supported STM32 family.

drivers/serial/serial_stm32.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 3c80096..9b19b68 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -2,6 +2,8 @@
* (C) Copyright 2015
* Kamil Lulko, <rev13@wp.pl>
*
+ * Copyright 2015 Konsulko Group, Matt Porter <mporter@konsulko.com>
+ *
* SPDX-License-Identifier: GPL-2.0+
*/

@@ -10,8 +12,15 @@
#include <serial.h>
#include <asm/arch/stm32.h>

+#if defined(CONFIG_STM32F4)
#define STM32_USART1_BASE (STM32_APB2PERIPH_BASE + 0x1000)
#define RCC_APB2ENR_USART1EN (1 << 4)
+#elif defined(CONFIG_STM32F1)
+#define STM32_USART1_BASE (STM32_APB2PERIPH_BASE + 0x3800)
+#define RCC_APB2ENR_USART1EN (1 << 14)
+#else
+#error STM32 family not supported
+#endif

#define USART_BASE STM32_USART1_BASE
#define RCC_USART_ENABLE RCC_APB2ENR_USART1EN
--
2.1.0