drivers: uart: stm32: improve STM32L0 support

STM32L0 UARTs are named as STM32F0 ones, but their
clocking is like all other families.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
This commit is contained in:
Ilya Tagunov 2018-03-20 20:50:57 +03:00 committed by Anas Nashif
commit 08418a210d

View file

@ -360,11 +360,13 @@ DEVICE_AND_API_INIT(uart_stm32_##n, CONFIG_UART_STM32_PORT_##n##_NAME, \
\
STM32_UART_IRQ_HANDLER(n)
/* STM32F0 Series differs from other STM32FX series in regard to the clock
* busses used for USARTS and the naming of the corresponding peripheral Enable
* bitmasks.
/*
* STM32F0 and STM32L0 series differ from other STM32 series by some
* peripheral names (UART vs USART). Besides, STM32F0 doesn't have APB2 bus,
* so APB1 GRP2 should be accessed instead.
*/
#ifdef CONFIG_SOC_SERIES_STM32F0X
#if defined(CONFIG_SOC_SERIES_STM32F0X)
#ifdef CONFIG_UART_STM32_PORT_1
UART_DEVICE_INIT_STM32(1, STM32_CLOCK_BUS_APB1_2, LL_APB1_GRP2_PERIPH_USART1)
#endif /* CONFIG_UART_STM32_PORT_1 */
@ -397,7 +399,25 @@ UART_DEVICE_INIT_STM32(7, STM32_CLOCK_BUS_APB1_2, LL_APB1_GRP2_PERIPH_USART7)
UART_DEVICE_INIT_STM32(8, STM32_CLOCK_BUS_APB1_2, LL_APB1_GRP2_PERIPH_USART8)
#endif /* CONFIG_UART_STM32_PORT_8 */
#else /* CONFIG_SOC_SERIES_STM32F0X */
#elif defined(CONFIG_SOC_SERIES_STM32L0X)
#ifdef CONFIG_UART_STM32_PORT_1
UART_DEVICE_INIT_STM32(1, STM32_CLOCK_BUS_APB2, LL_APB2_GRP1_PERIPH_USART1)
#endif /* CONFIG_UART_STM32_PORT_1 */
#ifdef CONFIG_UART_STM32_PORT_2
UART_DEVICE_INIT_STM32(2, STM32_CLOCK_BUS_APB1, LL_APB1_GRP1_PERIPH_USART2)
#endif /* CONFIG_UART_STM32_PORT_2 */
#ifdef CONFIG_UART_STM32_PORT_4
UART_DEVICE_INIT_STM32(4, STM32_CLOCK_BUS_APB1, LL_APB1_GRP1_PERIPH_USART4)
#endif /* CONFIG_UART_STM32_PORT_4 */
#ifdef CONFIG_UART_STM32_PORT_5
UART_DEVICE_INIT_STM32(5, STM32_CLOCK_BUS_APB1, LL_APB1_GRP1_PERIPH_USART5)
#endif /* CONFIG_UART_STM32_PORT_5 */
#else
#ifdef CONFIG_UART_STM32_PORT_1
UART_DEVICE_INIT_STM32(1, STM32_CLOCK_BUS_APB2, LL_APB2_GRP1_PERIPH_USART1)
@ -438,4 +458,5 @@ UART_DEVICE_INIT_STM32(9, STM32_CLOCK_BUS_APB2, LL_APB2_GRP1_PERIPH_UART9)
#ifdef CONFIG_UART_STM32_PORT_10
UART_DEVICE_INIT_STM32(10, STM32_CLOCK_BUS_APB2, LL_APB2_GRP1_PERIPH_UART10)
#endif /* CONFIG_UART_STM32_PORT_10 */
#endif /* CONFIG_SOC_SERIES_STM32F0X */
#endif