serial: 8250_exar: Move Exar pieces to custom ->startup()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 11 Oct 2019 11:56:10 +0000 (14:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 Oct 2019 19:02:04 +0000 (21:02 +0200)
There is a one more step to consolidate Exar bits under 8250_exar umbrella.
This time we introduce a custom ->startup() callback where the Exar specific
settings are applied.

Cc: Robert Middleton <robert.middleton@rm5248.com>
Cc: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Cc: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20191011115610.81507-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_exar.c
drivers/tty/serial/8250/8250_port.c

index 597eb9d..108cd55 100644 (file)
@@ -166,6 +166,23 @@ static void xr17v35x_set_divisor(struct uart_port *p, unsigned int baud,
        serial_port_out(p, 0x2, quot_frac);
 }
 
+static int xr17v35x_startup(struct uart_port *port)
+{
+       /*
+        * First enable access to IER [7:5], ISR [5:4], FCR [5:4],
+        * MCR [7:5] and MSR [7:0]
+        */
+       serial_port_out(port, UART_XR_EFR, UART_EFR_ECB);
+
+       /*
+        * Make sure all interrups are masked until initialization is
+        * complete and the FIFOs are cleared
+        */
+       serial_port_out(port, UART_IER, 0);
+
+       return serial8250_do_startup(port);
+}
+
 static void exar_shutdown(struct uart_port *port)
 {
        unsigned char lsr;
@@ -212,6 +229,8 @@ static int default_setup(struct exar8250 *priv, struct pci_dev *pcidev,
 
                port->port.get_divisor = xr17v35x_get_divisor;
                port->port.set_divisor = xr17v35x_set_divisor;
+
+               port->port.startup = xr17v35x_startup;
        } else {
                port->port.type = PORT_XR17D15X;
        }
index 8407166..9065591 100644 (file)
@@ -2114,20 +2114,6 @@ int serial8250_do_startup(struct uart_port *port)
        enable_rsa(up);
 #endif
 
-       if (port->type == PORT_XR17V35X) {
-               /*
-                * First enable access to IER [7:5], ISR [5:4], FCR [5:4],
-                * MCR [7:5] and MSR [7:0]
-                */
-               serial_port_out(port, UART_XR_EFR, UART_EFR_ECB);
-
-               /*
-                * Make sure all interrups are masked until initialization is
-                * complete and the FIFOs are cleared
-                */
-               serial_port_out(port, UART_IER, 0);
-       }
-
        /*
         * Clear the FIFO buffers and disable them.
         * (they will be reenabled in set_termios())