serial: meson: remove unneeded variable assignment in meson_serial_port_write
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 19 Apr 2017 20:17:44 +0000 (22:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 May 2017 14:34:56 +0000 (16:34 +0200)
There's no need to set AML_UART_TX_EN in each call to
meson_serial_port_write. In addition to meson_uart_startup
set this flag in meson_serial_console_setup and
meson_serial_early_console_setup.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/meson_uart.c

index e2e25da10f19bc8be4e2a5f793dfce6c3f767fe2..97e16db32468842c6778a57ad8046f5e6f8b7c2f 100644 (file)
@@ -124,6 +124,15 @@ static void meson_uart_stop_rx(struct uart_port *port)
        writel(val, port->membase + AML_UART_CONTROL);
 }
 
+static void meson_uart_enable_tx_engine(struct uart_port *port)
+{
+       u32 val;
+
+       val = readl(port->membase + AML_UART_CONTROL);
+       val |= AML_UART_TX_EN;
+       writel(val, port->membase + AML_UART_CONTROL);
+}
+
 static void meson_uart_shutdown(struct uart_port *port)
 {
        unsigned long flags;
@@ -499,7 +508,6 @@ static void meson_serial_port_write(struct uart_port *port, const char *s,
        }
 
        val = readl(port->membase + AML_UART_CONTROL);
-       val |= AML_UART_TX_EN;
        tmp = val & ~(AML_UART_TX_INT_EN | AML_UART_RX_INT_EN);
        writel(tmp, port->membase + AML_UART_CONTROL);
 
@@ -538,6 +546,8 @@ static int meson_serial_console_setup(struct console *co, char *options)
        if (!port || !port->membase)
                return -ENODEV;
 
+       meson_uart_enable_tx_engine(port);
+
        if (options)
                uart_parse_options(options, &baud, &parity, &bits, &flow);
 
@@ -576,6 +586,7 @@ meson_serial_early_console_setup(struct earlycon_device *device, const char *opt
        if (!device->port.membase)
                return -ENODEV;
 
+       meson_uart_enable_tx_engine(&device->port);
        device->con->write = meson_serial_early_console_write;
        return 0;
 }