Skip to content

Commit 5c5f44e

Browse files
ij-intelgregkh
authored andcommitted
serial: stm32: Clear prev values before setting RTS delays
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: 1bcda09 ("serial: stm32: add support for RS485 hardware control mode") Cc: stable <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ec5ad33 commit 5c5f44e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/tty/serial/stm32-usart.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE,
7272
*cr3 |= USART_CR3_DEM;
7373
over8 = *cr1 & USART_CR1_OVER8;
7474

75+
*cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK);
76+
7577
if (over8)
7678
rs485_deat_dedt = delay_ADE * baud * 8;
7779
else

0 commit comments

Comments
 (0)