From 967c31bc07fa3844ef25eec09f13df561a7efb9d Mon Sep 17 00:00:00 2001 From: Ilya Tagunov Date: Thu, 29 Mar 2018 19:40:00 +0300 Subject: [PATCH] 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 --- drivers/serial/uart_stm32.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c index 2cece2bffd1..b5b563c63f5 100644 --- a/drivers/serial/uart_stm32.c +++ b/drivers/serial/uart_stm32.c @@ -165,9 +165,11 @@ static void uart_stm32_irq_err_enable(struct device *dev) /* Enable FE, ORE interruptions */ LL_USART_EnableIT_ERROR(UartInstance); +#if !defined(CONFIG_SOC_SERIES_STM32F0X) || defined(USART_LIN_SUPPORT) /* Enable Line break detection */ -#ifndef CONFIG_SOC_SERIES_STM32F0X - LL_USART_EnableIT_LBD(UartInstance); + if (IS_UART_LIN_INSTANCE(UartInstance)) { + LL_USART_EnableIT_LBD(UartInstance); + } #endif /* Enable parity error interruption */ 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); - /* Enable FE, ORE interruptions */ + /* Disable FE, ORE interruptions */ LL_USART_DisableIT_ERROR(UartInstance); - /* Enable Line break detection */ -#ifndef CONFIG_SOC_SERIES_STM32F0X - LL_USART_DisableIT_LBD(UartInstance); +#if !defined(CONFIG_SOC_SERIES_STM32F0X) || defined(USART_LIN_SUPPORT) + /* Disable Line break detection */ + if (IS_UART_LIN_INSTANCE(UartInstance)) { + LL_USART_DisableIT_LBD(UartInstance); + } #endif - /* Enable parity error interruption */ + /* Disable parity error interruption */ LL_USART_DisableIT_PE(UartInstance); }