Skip to content

Commit f418ae7

Browse files
linosanfilippo-kunbusgregkh
authored andcommitted
serial: stm32: do not always set SER_RS485_RX_DURING_TX if RS485 is enabled
Before commit 07c30ea ("serial: Do not hold the port lock when setting rx-during-tx GPIO") the SER_RS485_RX_DURING_TX flag was only set if the rx-during-tx mode was not controlled by a GPIO. Now the flag is set unconditionally when RS485 is enabled. This results in an incorrect setting if the rx-during-tx GPIO is not asserted. Fix this by setting the flag only if the rx-during-tx mode is not controlled by a GPIO and thus restore the correct behaviour. Cc: stable@vger.kernel.org # 6.6+ Fixes: 07c30ea ("serial: Do not hold the port lock when setting rx-during-tx GPIO") Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Link: https://lore.kernel.org/r/20240216224709.9928-1-l.sanfilippo@kunbus.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8b79d4e commit f418ae7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/tty/serial/stm32-usart.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ static int stm32_usart_config_rs485(struct uart_port *port, struct ktermios *ter
251251
writel_relaxed(cr3, port->membase + ofs->cr3);
252252
writel_relaxed(cr1, port->membase + ofs->cr1);
253253

254-
rs485conf->flags |= SER_RS485_RX_DURING_TX;
254+
if (!port->rs485_rx_during_tx_gpio)
255+
rs485conf->flags |= SER_RS485_RX_DURING_TX;
256+
255257
} else {
256258
stm32_usart_clr_bits(port, ofs->cr3,
257259
USART_CR3_DEM | USART_CR3_DEP);

0 commit comments

Comments
 (0)