1 From 5f1a35c3f5c17cc6229873248a56784fcd03db1c Mon Sep 17 00:00:00 2001
2 From: Fugang Duan <fugang.duan@nxp.com>
3 Date: Fri, 27 Sep 2019 15:18:41 +0800
4 Subject: [PATCH] serial: fsl_lpuart: enable two stop bits
6 Add two stop bits support.
7 User can run the command to enable two stop bits
8 for test: stty cstopb -F /dev/ttyLPx
10 Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
12 drivers/tty/serial/fsl_lpuart.c | 8 ++++++--
13 1 file changed, 6 insertions(+), 2 deletions(-)
15 --- a/drivers/tty/serial/fsl_lpuart.c
16 +++ b/drivers/tty/serial/fsl_lpuart.c
17 @@ -2111,11 +2111,12 @@ lpuart32_set_termios(struct uart_port *p
19 struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
21 - unsigned long ctrl, old_ctrl, modem;
22 + unsigned long ctrl, old_ctrl, bd, modem;
24 unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
26 ctrl = old_ctrl = lpuart32_read(&sport->port, UARTCTRL);
27 + bd = lpuart32_read(&sport->port, UARTBAUD);
28 modem = lpuart32_read(&sport->port, UARTMODIR);
30 * only support CS8 and CS7, and for CS7 must enable PE.
31 @@ -2152,7 +2153,9 @@ lpuart32_set_termios(struct uart_port *p
34 if (termios->c_cflag & CSTOPB)
35 - termios->c_cflag &= ~CSTOPB;
36 + bd |= UARTBAUD_SBNS;
38 + bd &= ~UARTBAUD_SBNS;
40 /* parity must be enabled when CS7 to match 8-bits format */
41 if ((termios->c_cflag & CSIZE) == CS7)
42 @@ -2222,6 +2225,7 @@ lpuart32_set_termios(struct uart_port *p
43 lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE),
46 + lpuart32_write(&sport->port, bd, UARTBAUD);
47 lpuart32_serial_setbrg(sport, baud);
48 lpuart32_write(&sport->port, modem, UARTMODIR);
49 lpuart32_write(&sport->port, ctrl, UARTCTRL);