ae1ef16a796d8794e3361691bf9dbeec79b8d6be
[oweals/openwrt.git] / target / linux / mediatek / patches-4.19 / 0900-bt-mtk-serial-fix.patch
1 diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
2 index ebfb0bd..2b9ba39 100644
3 --- a/drivers/tty/serial/8250/8250.h
4 +++ b/drivers/tty/serial/8250/8250.h
5 @@ -80,6 +80,7 @@  struct serial8250_config {
6  #define UART_CAP_MINI  (1 << 17)       /* Mini UART on BCM283X family lacks:
7                                          * STOP PARITY EPAR SPAR WLEN5 WLEN6
8                                          */
9 +#define UART_CAP_NMOD  (1 << 18)       /* UART doesn't do termios */
10  
11  #define UART_BUG_QUOT  (1 << 0)        /* UART has buggy quot LSB */
12  #define UART_BUG_TXEN  (1 << 1)        /* UART has buggy TX IIR status */
13 diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
14 index c39482b..e4a69a0 100644
15 --- a/drivers/tty/serial/8250/8250_port.c
16 +++ b/drivers/tty/serial/8250/8250_port.c
17 @@ -297,7 +297,7 @@ 
18                 .tx_loadsz      = 16,
19                 .fcr            = UART_FCR_ENABLE_FIFO |
20                                   UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
21 -               .flags          = UART_CAP_FIFO,
22 +               .flags          = UART_CAP_FIFO | UART_CAP_NMOD,
23         },
24         [PORT_NPCM] = {
25                 .name           = "Nuvoton 16550",
26 @@ -2663,6 +2663,11 @@  static unsigned int serial8250_get_baud_rate(struct uart_port *port,
27         unsigned long flags;
28         unsigned int baud, quot, frac = 0;
29  
30 +       if (up->capabilities & UART_CAP_NMOD) {
31 +               termios->c_cflag = 0;
32 +               return;
33 +       }
34 +
35         if (up->capabilities & UART_CAP_MINI) {
36                 termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR);
37                 if ((termios->c_cflag & CSIZE) == CS5 ||