Skip to content

Commit

Permalink
serial: stm32: Clear prev values before setting RTS delays
Browse files Browse the repository at this point in the history
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: [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]>
Signed-off-by: Valentin Caron <[email protected]>
Change-Id: I2f1f2c0675180f65c524948a9103d03abf8f4ee8
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/272029
Reviewed-by: CITOOLS <[email protected]>
Reviewed-by: CIBUILD <[email protected]>
Reviewed-by: Eric FOURMONT <[email protected]>
Domain-Review: Amelie DELAUNAY <[email protected]>
  • Loading branch information
ij-intel authored and fourmone committed Oct 26, 2022
1 parent ef0c423 commit 7f29f81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/tty/serial/stm32-usart.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 baud,
*cr3 |= USART_CR3_DEM;
over8 = *cr1 & USART_CR1_OVER8;

*cr1 &= ~(USART_CR1_DEDT_MASK | USART_CR1_DEAT_MASK);

/* Assertion time */
tmp = stm32_usart_config_delay_rs485(cr1, delay_ADE, baud, over8,
rs485_deat_dedt_max, rs485conf);
Expand Down

0 comments on commit 7f29f81

Please sign in to comment.