Skip to content

Commit 4842215

Browse files
fugangduangregkh
authored andcommitted
tty: serial: fsl_lpuart: enable two stop bits for lpuart32
Add two stop bits support. User can run the command to enable two stop bits for test: stty cstopb -F /dev/ttyLPx Signed-off-by: Fugang Duan <[email protected]> Signed-off-by: Sherry Sun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d5c3894 commit 4842215

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/tty/serial/fsl_lpuart.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,11 +2049,12 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
20492049
{
20502050
struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
20512051
unsigned long flags;
2052-
unsigned long ctrl, old_ctrl, modem;
2052+
unsigned long ctrl, old_ctrl, bd, modem;
20532053
unsigned int baud;
20542054
unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
20552055

20562056
ctrl = old_ctrl = lpuart32_read(&sport->port, UARTCTRL);
2057+
bd = lpuart32_read(&sport->port, UARTBAUD);
20572058
modem = lpuart32_read(&sport->port, UARTMODIR);
20582059
/*
20592060
* only support CS8 and CS7, and for CS7 must enable PE.
@@ -2097,7 +2098,9 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
20972098
}
20982099

20992100
if (termios->c_cflag & CSTOPB)
2100-
termios->c_cflag &= ~CSTOPB;
2101+
bd |= UARTBAUD_SBNS;
2102+
else
2103+
bd &= ~UARTBAUD_SBNS;
21012104

21022105
/* parity must be enabled when CS7 to match 8-bits format */
21032106
if ((termios->c_cflag & CSIZE) == CS7)
@@ -2167,6 +2170,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
21672170
lpuart32_write(&sport->port, old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE),
21682171
UARTCTRL);
21692172

2173+
lpuart32_write(&sport->port, bd, UARTBAUD);
21702174
lpuart32_serial_setbrg(sport, baud);
21712175
lpuart32_write(&sport->port, modem, UARTMODIR);
21722176
lpuart32_write(&sport->port, ctrl, UARTCTRL);

0 commit comments

Comments
 (0)