]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
serial: stm32: Clear prev values before setting RTS delays
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 27 Jun 2022 15:07:52 +0000 (18:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jun 2022 15:15:31 +0000 (17:15 +0200)
The code lacks clearing of previous DEAT/DEDT values. Thus, changing
values on the fly results in garbage delays tending towards the maximum
value as more and more bits are ORed together. (Leaving RS485 mode
would have cleared the old values though).

Fixes: 1bcda09d2910 ("serial: stm32: add support for RS485 hardware control mode")
Cc: stable <stable@kernel.org>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220627150753.34510-1-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/stm32-usart.c

index b7b44f4050d49acace4a4ac48fa7a1b01ec8d561..0973b03eeeaa4f6d2e42ccba5c36c7a2be04eeef 100644 (file)
@@ -72,6 +72,8 @@ static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE,
        *cr3 |= USART_CR3_DEM;
        over8 = *cr1 & USART_CR1_OVER8;
 
+       *cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK);
+
        if (over8)
                rs485_deat_dedt = delay_ADE * baud * 8;
        else