From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932390AbbCIU3u (ORCPT ); Mon, 9 Mar 2015 16:29:50 -0400 Received: from mail-qg0-f51.google.com ([209.85.192.51]:42008 "EHLO mail-qg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932155AbbCIU1n (ORCPT ); Mon, 9 Mar 2015 16:27:43 -0400 From: Peter Hurley To: Greg Kroah-Hartman Cc: Andrew Morton , Jiri Slaby , Rob Herring , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Peter Hurley Subject: [PATCH v3 -next 05/11] serial: 8250_early: Assume uart already initialized if no baud option Date: Mon, 9 Mar 2015 16:27:16 -0400 Message-Id: <1425932842-21812-6-git-send-email-peter@hurleysoftware.com> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1425932842-21812-1-git-send-email-peter@hurleysoftware.com> References: <1425932842-21812-1-git-send-email-peter@hurleysoftware.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 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, console=uart,mmio, 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 Signed-off-by: Peter Hurley --- drivers/tty/serial/8250/8250_early.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c index d7b831b..1701d00 100644 --- a/drivers/tty/serial/8250/8250_early.c +++ b/drivers/tty/serial/8250/8250_early.c @@ -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; -- 2.3.1