diff mbox series

[5.10.y-cip,3/7] tty: serial: sh-sci: Fix end of transmission on SCI

Message ID 20230605110512.111017-4-biju.das.jz@bp.renesas.com (mailing list archive)
State New
Headers show
Series Add SCI support for RZ/G2L alike SoCs | expand

Commit Message

Biju Das June 5, 2023, 11:05 a.m. UTC
commit f06c2a9000ebecbb461196e59ce063f742272902 upstream.

We need to set TE to "0" (i.e., disable serial transmission) to
get the expected behavior of the end of serial transmission.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230412145053.114847-6-biju.das.jz@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/tty/serial/sh-sci.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Pavel Machek June 5, 2023, 3:27 p.m. UTC | #1
Hi!
> commit f06c2a9000ebecbb461196e59ce063f742272902 upstream.
> 
> We need to set TE to "0" (i.e., disable serial transmission) to
> get the expected behavior of the end of serial transmission.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Link: https://lore.kernel.org/r/20230412145053.114847-6-biju.das.jz@bp.renesas.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Should this be done in other cases when transmit is finished/stopped?
Could this be refactored so that this code goes to sci_stop_tx()?

This would be probably just a cleanup, so it should not prevent merge.

Thanks and best regards,
									Pavel
diff mbox series

Patch

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 39db677a84e7..6cc971de7831 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -842,6 +842,11 @@  static void sci_transmit_chars(struct uart_port *port)
 		} else if (!uart_circ_empty(xmit) && !stopped) {
 			c = xmit->buf[xmit->tail];
 			xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+		} else if (port->type == PORT_SCI && uart_circ_empty(xmit)) {
+			ctrl = serial_port_in(port, SCSCR);
+			ctrl &= ~SCSCR_TE;
+			serial_port_out(port, SCSCR, ctrl);
+			return;
 		} else {
 			break;
 		}