serial: stm32: Remove unused struct stm32_port txdone element
Subsystems (2)
PATCH 1/2 serial: stm32: Remove unused struct stm32_port txdone element
The txdone element is only ever assigned, once, and never used. Drop it.
---
Cc: Alexandre Torgue <[email protected]>
Cc: Erwan Le Ray <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Jean Philippe Romain <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Johan Hovold <[email protected]>
Cc: Lukas Wunner <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Valentin Caron <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/tty/serial/stm32-usart.c | 1 - drivers/tty/serial/stm32-usart.h | 1 - 2 files changed, 2 deletions(-)
drivers/tty/serial/stm32-usart.c +0 -1
@@ -743,7 +743,6 @@ static void stm32_usart_transmit_chars(struct uart_port *port)stm32_usart_tx_interrupt_disable (port);if (!stm32_port->hw_flow_control && port->rs485.flags &SER_RS485_ENABLED ) { - stm32_port->txdone = true;stm32_usart_tc_interrupt_enable (port); } }
drivers/tty/serial/stm32-usart.h +0 -1
@@ -203,7 +203,6 @@ struct stm32_port {bool hw_flow_control;bool swap;/* swap RX & TX pins */ bool fifoen; -bool txdone;int rxftcfg;/* RX FIFO threshold CFG */ int txftcfg;/* TX FIFO threshold CFG */ bool wakeup_src;
Signature · 1 line
2.39.1
PATCH 2/2 serial: stm32: Re-assert RTS/DE GPIO in RS485 mode only if more data are transmitted
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.
---
Cc: Alexandre Torgue <[email protected]>
Cc: Erwan Le Ray <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Jean Philippe Romain <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Johan Hovold <[email protected]>
Cc: Lukas Wunner <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Valentin Caron <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/tty/serial/stm32-usart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/stm32-usart.c +3 -2
@@ -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); }
Signature · 1 line
2.39.1