@@ -2049,11 +2049,12 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
2049
2049
{
2050
2050
struct lpuart_port * sport = container_of (port , struct lpuart_port , port );
2051
2051
unsigned long flags ;
2052
- unsigned long ctrl , old_ctrl , modem ;
2052
+ unsigned long ctrl , old_ctrl , bd , modem ;
2053
2053
unsigned int baud ;
2054
2054
unsigned int old_csize = old ? old -> c_cflag & CSIZE : CS8 ;
2055
2055
2056
2056
ctrl = old_ctrl = lpuart32_read (& sport -> port , UARTCTRL );
2057
+ bd = lpuart32_read (& sport -> port , UARTBAUD );
2057
2058
modem = lpuart32_read (& sport -> port , UARTMODIR );
2058
2059
/*
2059
2060
* 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,
2097
2098
}
2098
2099
2099
2100
if (termios -> c_cflag & CSTOPB )
2100
- termios -> c_cflag &= ~CSTOPB ;
2101
+ bd |= UARTBAUD_SBNS ;
2102
+ else
2103
+ bd &= ~UARTBAUD_SBNS ;
2101
2104
2102
2105
/* parity must be enabled when CS7 to match 8-bits format */
2103
2106
if ((termios -> c_cflag & CSIZE ) == CS7 )
@@ -2167,6 +2170,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
2167
2170
lpuart32_write (& sport -> port , old_ctrl & ~(UARTCTRL_TE | UARTCTRL_RE ),
2168
2171
UARTCTRL );
2169
2172
2173
+ lpuart32_write (& sport -> port , bd , UARTBAUD );
2170
2174
lpuart32_serial_setbrg (sport , baud );
2171
2175
lpuart32_write (& sport -> port , modem , UARTMODIR );
2172
2176
lpuart32_write (& sport -> port , ctrl , UARTCTRL );
0 commit comments