Message ID | 8c47aea3aa3cce4d7484b840ddb117cd16bcf1cc.1587347988.git.sean.wang@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] tty: serial: don't do termios for BTIF | expand |
On Mon, Apr 20, 2020 at 10:06:38AM +0800, sean.wang@mediatek.com wrote: > From: Sean Wang <sean.wang@mediatek.com> > > Bluetooth Interface (BTIF) is designed dedicatedly for MediaTek SOC with > BT in order to be instead of the UART interface between BT module and Host > CPU, and not exported to user space to access. > > As the UART design, BTIF will be an APB slave and can transmit or receive > data by MCU access, but doesn't provide termios function like baudrate and > flow control setup. > > Even LCR on offset 0xC that is just a FAKELCR > a. If FAKELCR[7] is equaled to 1, RBR(0x00), THR(0x00), IER(0x04) > will not be readable/writable. > > b. If FAKELCR is equaled to 0xBF, RBR(0x00), THR(0x00), IER(0x04), > IIR(0x08), and LSR(0x14) will not be readable/writable. > > So adding a new capability 'UART_CAP_NMOD' for the unusual unsupported > case. ... > +#define UART_CAP_NMOD (1 << 18) /* UART doesn't do termios */ I would rather spell it as NTIO or NO_TIO (as TIO is a well established prefix for termios IOCTLs).
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 33ad9d6de532..250337e4e7c8 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -82,6 +82,7 @@ struct serial8250_config { #define UART_CAP_MINI (1 << 17) /* Mini UART on BCM283X family lacks: * STOP PARITY EPAR SPAR WLEN5 WLEN6 */ +#define UART_CAP_NMOD (1 << 18) /* UART doesn't do termios */ #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 0325f2e53b74..da0a8711ee3d 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -286,7 +286,7 @@ static const struct serial8250_config uart_config[] = { .tx_loadsz = 16, .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, - .flags = UART_CAP_FIFO, + .flags = UART_CAP_FIFO | UART_CAP_NMOD, }, [PORT_NPCM] = { .name = "Nuvoton 16550", @@ -2544,6 +2544,9 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, unsigned long flags; unsigned int baud, quot, frac = 0; + if (up->capabilities & UART_CAP_NMOD) + return; + if (up->capabilities & UART_CAP_MINI) { termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR); if ((termios->c_cflag & CSIZE) == CS5 ||