Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty: serial: fsl_lpuart: add 7-bits format support on imx7ulp/imx8ulp/imx8qxp

imx7ulp/imx8ulp/imx8qxp lpuart IP support 7-bits format and have no
limitation on parity when CS7. Remove this limitation and add 7-bits
format support on imx7ulp/imx8ulp/imx8qxp.

Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com>
Link: https://lore.kernel.org/r/20241008094418.439706-1-ziniu.wang_1@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Luke Wang and committed by
Greg Kroah-Hartman
fd29e1e4 068d35a7

+16 -5
+16 -5
drivers/tty/serial/fsl_lpuart.c
··· 184 184 #define UARTCTRL_SBK 0x00010000 185 185 #define UARTCTRL_MA1IE 0x00008000 186 186 #define UARTCTRL_MA2IE 0x00004000 187 + #define UARTCTRL_M7 0x00000800 187 188 #define UARTCTRL_IDLECFG GENMASK(10, 8) 188 189 #define UARTCTRL_LOOPS 0x00000080 189 190 #define UARTCTRL_DOZEEN 0x00000040 ··· 2223 2222 modem = lpuart32_read(&sport->port, UARTMODIR); 2224 2223 sport->is_cs7 = false; 2225 2224 /* 2226 - * only support CS8 and CS7, and for CS7 must enable PE. 2225 + * only support CS8 and CS7 2227 2226 * supported mode: 2227 + * - (7,n,1) (imx only) 2228 2228 * - (7,e/o,1) 2229 2229 * - (8,n,1) 2230 2230 * - (8,m/s,1) ··· 2240 2238 2241 2239 if ((termios->c_cflag & CSIZE) == CS8 || 2242 2240 (termios->c_cflag & CSIZE) == CS7) 2243 - ctrl = old_ctrl & ~UARTCTRL_M; 2241 + ctrl = old_ctrl & ~(UARTCTRL_M | UARTCTRL_M7); 2244 2242 2245 2243 if (termios->c_cflag & CMSPAR) { 2246 2244 if ((termios->c_cflag & CSIZE) != CS8) { ··· 2267 2265 else 2268 2266 bd &= ~UARTBAUD_SBNS; 2269 2267 2270 - /* parity must be enabled when CS7 to match 8-bits format */ 2271 - if ((termios->c_cflag & CSIZE) == CS7) 2272 - termios->c_cflag |= PARENB; 2268 + /* 2269 + * imx support 7-bits format, no limitation on parity when CS7 2270 + * for layerscape, parity must be enabled when CS7 to match 8-bits format 2271 + */ 2272 + if ((termios->c_cflag & CSIZE) == CS7 && !(termios->c_cflag & PARENB)) { 2273 + if (is_imx7ulp_lpuart(sport) || 2274 + is_imx8ulp_lpuart(sport) || 2275 + is_imx8qxp_lpuart(sport)) 2276 + ctrl |= UARTCTRL_M7; 2277 + else 2278 + termios->c_cflag |= PARENB; 2279 + } 2273 2280 2274 2281 if ((termios->c_cflag & PARENB)) { 2275 2282 if (termios->c_cflag & CMSPAR) {