Patch "serial: stm32: Re-assert RTS/DE GPIO in RS485 mode only if more data are transmitted" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    serial: stm32: Re-assert RTS/DE GPIO in RS485 mode only if more data are transmitted

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     serial-stm32-re-assert-rts-de-gpio-in-rs485-mode-onl.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f4a972cb265182e1f7587627db871b147679d416
Author: Marek Vasut <marex@xxxxxxx>
Date:   Thu Feb 23 05:22:52 2023 +0100

    serial: stm32: Re-assert RTS/DE GPIO in RS485 mode only if more data are transmitted
    
    [ Upstream commit c47527cbcc3c50800f34b8c684f29721f75de246 ]
    
    The stm32_usart_transmit_chars() may be called with empty or stopped
    transmit queue, and no XON/OFF character pending. This can happen at
    the end of transmission, where this last call is used to either handle
    the XON/XOFF x_char, or disable TX interrupt if queue is empty or
    stopped.
    
    If that occurs, do not assert the RS485 RTS/DE GPIO anymore, as the
    GPIO would remain asserted past the end of transmission and that would
    block the RS485 bus after the transmission.
    
    Only assert the RS485 RTS/DE GPIO if there is either pending XON/XOFF
    x_char, or at least one character in running transmit queue.
    
    Fixes: d7c76716169d ("serial: stm32: Use TC interrupt to deassert GPIO RTS in RS485 mode")
    Signed-off-by: Marek Vasut <marex@xxxxxxx>
    Link: https://lore.kernel.org/r/20230223042252.95480-2-marex@xxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 767ff9fdb2e58..84700016932d6 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -693,8 +693,9 @@ static void stm32_usart_transmit_chars(struct uart_port *port)
 	int ret;
 
 	if (!stm32_port->hw_flow_control &&
-	    port->rs485.flags & SER_RS485_ENABLED) {
-		stm32_port->txdone = false;
+	    port->rs485.flags & SER_RS485_ENABLED &&
+	    (port->x_char ||
+	     !(uart_circ_empty(xmit) || uart_tx_stopped(port)))) {
 		stm32_usart_tc_interrupt_disable(port);
 		stm32_usart_rs485_rts_enable(port);
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux