drivers: serial: stm32: enable LBD only for UARTs with LIN support

LBD interrupt manupulation makes sense for UART with LIN support only.
Otherwise this bit should not be touched.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
This commit is contained in:
Ilya Tagunov 2018-03-29 19:40:00 +03:00 committed by Kumar Gala
commit 967c31bc07

View file

@ -165,9 +165,11 @@ static void uart_stm32_irq_err_enable(struct device *dev)
/* Enable FE, ORE interruptions */ /* Enable FE, ORE interruptions */
LL_USART_EnableIT_ERROR(UartInstance); LL_USART_EnableIT_ERROR(UartInstance);
#if !defined(CONFIG_SOC_SERIES_STM32F0X) || defined(USART_LIN_SUPPORT)
/* Enable Line break detection */ /* Enable Line break detection */
#ifndef CONFIG_SOC_SERIES_STM32F0X if (IS_UART_LIN_INSTANCE(UartInstance)) {
LL_USART_EnableIT_LBD(UartInstance); LL_USART_EnableIT_LBD(UartInstance);
}
#endif #endif
/* Enable parity error interruption */ /* Enable parity error interruption */
LL_USART_EnableIT_PE(UartInstance); LL_USART_EnableIT_PE(UartInstance);
@ -177,13 +179,15 @@ static void uart_stm32_irq_err_disable(struct device *dev)
{ {
USART_TypeDef *UartInstance = UART_STRUCT(dev); USART_TypeDef *UartInstance = UART_STRUCT(dev);
/* Enable FE, ORE interruptions */ /* Disable FE, ORE interruptions */
LL_USART_DisableIT_ERROR(UartInstance); LL_USART_DisableIT_ERROR(UartInstance);
/* Enable Line break detection */ #if !defined(CONFIG_SOC_SERIES_STM32F0X) || defined(USART_LIN_SUPPORT)
#ifndef CONFIG_SOC_SERIES_STM32F0X /* Disable Line break detection */
if (IS_UART_LIN_INSTANCE(UartInstance)) {
LL_USART_DisableIT_LBD(UartInstance); LL_USART_DisableIT_LBD(UartInstance);
}
#endif #endif
/* Enable parity error interruption */ /* Disable parity error interruption */
LL_USART_DisableIT_PE(UartInstance); LL_USART_DisableIT_PE(UartInstance);
} }