From 0f5b15374953f1e4b65722b3dbbef9ce14a3c018 Mon Sep 17 00:00:00 2001 From: "Jiri Slaby (SUSE)" Date: Tue, 30 Jan 2024 10:36:35 +0100 Subject: [PATCH] mxs: fix Signed-off-by: Jiri Slaby (SUSE) --- drivers/tty/serial/mxs-auart.c | 5 ++++- include/linux/serial_core.h | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 424db8466755..ec013d13cc3d 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -594,13 +594,16 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s) return; } - pending = uart_port_tx(&s->port, ch, + pending = uart_port_tx_no_stop(&s->port, ch, !(mxs_read(s, REG_STAT) & AUART_STAT_TXFF), mxs_write(ch, s, REG_DATA)); if (pending) mxs_set(AUART_INTR_TXIEN, s, REG_INTR); else mxs_clr(AUART_INTR_TXIEN, s, REG_INTR); + + if (uart_tx_stopped(&s->port)) + mxs_auart_stop_tx(&s->port); } static void mxs_auart_rx_char(struct mxs_auart_port *s) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index c5fa72c8f96e..18256fd765c9 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -769,7 +769,7 @@ struct uart_driver { void uart_write_wakeup(struct uart_port *port); -#define __uart_port_tx(uport, ch, tx_ready, put_char, tx_done, for_test, \ +#define __uart_port_tx(uport, ch, tx_ready, put_char, should_stop, tx_done, for_test, \ for_post) \ ({ \ struct uart_port *__port = (uport); \ @@ -799,7 +799,7 @@ void uart_write_wakeup(struct uart_port *port); if (pending < WAKEUP_CHARS) { \ uart_write_wakeup(__port); \ \ - if (pending == 0) \ + if (should_stop && pending == 0) \ __port->ops->stop_tx(__port); \ } \ \ @@ -834,7 +834,7 @@ void uart_write_wakeup(struct uart_port *port); */ #define uart_port_tx_limited(port, ch, count, tx_ready, put_char, tx_done) ({ \ unsigned int __count = (count); \ - __uart_port_tx(port, ch, tx_ready, put_char, tx_done, __count, \ + __uart_port_tx(port, ch, tx_ready, put_char, true, tx_done, __count, \ __count--); \ }) @@ -848,8 +848,10 @@ void uart_write_wakeup(struct uart_port *port); * See uart_port_tx_limited() for more details. */ #define uart_port_tx(port, ch, tx_ready, put_char) \ - __uart_port_tx(port, ch, tx_ready, put_char, ({}), true, ({})) + __uart_port_tx(port, ch, tx_ready, put_char, true, ({}), true, ({})) +#define uart_port_tx_no_stop(port, ch, tx_ready, put_char) \ + __uart_port_tx(port, ch, tx_ready, put_char, false, ({}), true, ({})) /* * Baud rate helpers. */ -- 2.43.0