]> git.baikalelectronics.ru Git - kernel.git/commitdiff
serial: 8250: create lsr_save_mask
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 24 Jun 2022 20:42:06 +0000 (23:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jun 2022 12:44:20 +0000 (14:44 +0200)
Allow drivers to alter LSR save mask.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220624204210.11112-3-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250.h
drivers/tty/serial/8250/8250_core.c
drivers/tty/serial/8250/8250_dw.c
include/linux/serial_8250.h

index 0ff5688ba90c958a5267fa7f2dcf470998eaa836..5cc967fe3b597f0d0f94d512a98df6d0b268e91e 100644 (file)
@@ -138,7 +138,7 @@ static inline u16 serial_lsr_in(struct uart_8250_port *up)
        u16 lsr = up->lsr_saved_flags;
 
        lsr |= serial_in(up, UART_LSR);
-       up->lsr_saved_flags = lsr & LSR_SAVE_FLAGS;
+       up->lsr_saved_flags = lsr & up->lsr_save_mask;
 
        return lsr;
 }
index 90ddc89248114c6e293bd3f2cbac025333709e55..57e86133af4fac5c57f55ba8b55e5aaeb84eb85f 100644 (file)
@@ -1007,6 +1007,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
                uart->port.rs485        = up->port.rs485;
                uart->rs485_start_tx    = up->rs485_start_tx;
                uart->rs485_stop_tx     = up->rs485_stop_tx;
+               uart->lsr_save_mask     = up->lsr_save_mask;
                uart->dma               = up->dma;
 
                /* Take tx_loadsz from fifosize if it wasn't set separately */
@@ -1094,6 +1095,9 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
                        ret = 0;
                }
 
+               if (!uart->lsr_save_mask)
+                       uart->lsr_save_mask = LSR_SAVE_FLAGS;   /* Use default LSR mask */
+
                /* Initialise interrupt backoff work if required */
                if (up->overrun_backoff_time_ms > 0) {
                        uart->overrun_backoff_time_ms =
index 4cc69bb612ab345988345957a2e3083bd8ae57f4..167a691c7b19787864d15185e94f488251cf37c6 100644 (file)
@@ -129,7 +129,7 @@ static void dw8250_tx_wait_empty(struct uart_port *p)
 
        while (tries--) {
                lsr = readb (p->membase + (UART_LSR << p->regshift));
-               up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
+               up->lsr_saved_flags |= lsr & up->lsr_save_mask;
 
                if (lsr & UART_LSR_TEMT)
                        break;
index 4565f25ba9a21209a6b60e23407d3bcb405f4391..8c7b793aa4d702e8b1ac4b75c15d7fc4f2b6adba 100644 (file)
@@ -120,6 +120,7 @@ struct uart_8250_port {
         */
 #define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS
        u16                     lsr_saved_flags;
+       u16                     lsr_save_mask;
 #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
        unsigned char           msr_saved_flags;