serial: 8250_early: Assume uart already initialized if no baud option
authorPeter Hurley <peter@hurleysoftware.com>
Mon, 9 Mar 2015 20:27:16 +0000 (16:27 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Mar 2015 15:17:55 +0000 (16:17 +0100)
The <baud><parity><bit> option string is not supplied if the earlycon
is started via devicetree and OF_EARLYCON_DECLARE(). The option string
is also not required if started via kernel command line parameters of
the form:
  earlycon=uart,mmio,<addr>
  console=uart,mmio,<addr>

If earlycon_device->baud is 0, then an option string was not supplied.
In this case, assume the uart has already been initialized by the
bootloader or firmware.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_early.c

index d7b831bcf367ab5d6d2634ea9f8eea2b420c9c17..1701d00fd9f6dd20efa297fec1afe5dbfbfc338e 100644 (file)
@@ -149,12 +149,18 @@ static int __init early_serial8250_setup(struct earlycon_device *device,
                return 0;
 
        if (!device->baud) {
+               struct uart_port *port = &device->port;
+               unsigned int ier;
+
                device->baud = probe_baud(&device->port);
                snprintf(device->options, sizeof(device->options), "%u",
                         device->baud);
-       }
 
-       init_port(device);
+               /* assume the device was initialized, only mask interrupts */
+               ier = serial8250_early_in(port, UART_IER);
+               serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
+       } else
+               init_port(device);
 
        device->con->write = early_serial8250_write;
        return 0;