Skip to content

Commit 4f39aca

Browse files
linosanfilippo-kunbusgregkh
authored andcommitted
serial: amba-pl011: fix high priority character transmission in rs486 mode
In RS485 mode the transmission of a high priority character fails since it is written to the data register before the transmitter is enabled. Fix this in pl011_tx_chars() by enabling RS485 transmission before writing the character. Fixes: 8d47923 ("serial: amba-pl011: add RS485 support") Cc: stable@vger.kernel.org Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Link: https://lore.kernel.org/r/20230108181735.10937-1-LinoSanfilippo@gmx.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e8914b5 commit 4f39aca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/tty/serial/amba-pl011.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,10 @@ static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq)
14661466
struct circ_buf *xmit = &uap->port.state->xmit;
14671467
int count = uap->fifosize >> 1;
14681468

1469+
if ((uap->port.rs485.flags & SER_RS485_ENABLED) &&
1470+
!uap->rs485_tx_started)
1471+
pl011_rs485_tx_start(uap);
1472+
14691473
if (uap->port.x_char) {
14701474
if (!pl011_tx_char(uap, uap->port.x_char, from_irq))
14711475
return true;
@@ -1477,10 +1481,6 @@ static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq)
14771481
return false;
14781482
}
14791483

1480-
if ((uap->port.rs485.flags & SER_RS485_ENABLED) &&
1481-
!uap->rs485_tx_started)
1482-
pl011_rs485_tx_start(uap);
1483-
14841484
/* If we are using DMA mode, try to send some characters. */
14851485
if (pl011_dma_tx_irq(uap))
14861486
return true;

0 commit comments

Comments
 (0)