From patchwork Sun Feb 1 18:26:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hurley X-Patchwork-Id: 5757301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CE6EA9F269 for ; Sun, 1 Feb 2015 18:29:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5C59201F5 for ; Sun, 1 Feb 2015 18:29:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3CD8201F4 for ; Sun, 1 Feb 2015 18:28:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YHzEZ-00066j-R8; Sun, 01 Feb 2015 18:26:59 +0000 Received: from mail-qa0-f54.google.com ([209.85.216.54]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YHzEX-00064i-AY for linux-arm-kernel@lists.infradead.org; Sun, 01 Feb 2015 18:26:57 +0000 Received: by mail-qa0-f54.google.com with SMTP id w8so26468152qac.13 for ; Sun, 01 Feb 2015 10:26:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=tdtosiD71+dD+Lbaot95Fgg2h9advzSF/sTgogWjLa8=; b=DiyIOj+dumDIShH7ErgaBJxavUUOjruDgrja9Ik1mVjXIQlht5YsJtGBnmAk45s0bZ +3V2p+bHToXAL+ZvKX/OLkGmYb0mCovPBU0YZXnz0kI7WhSAXELuVlMluozfa4aNZ3gX zBJ5zpcyhuXp/koc+3SSn6vrNjx1zC6RqQXpOaYZ/IAUaIzjQm3KzVxwn+8nH4zaPxjk ZSfgc4iCoO+by5FLaKjBXT4GuYgwrFNUJmAQPpVjVxjwCrezPQ8qkmmnVY/sHNx+L7KI V2eZpHC95kZ+oYJ4A/rCEElYcgxPD+Y/r5enqUGQT307CTQwQBQOgDwrtH9LvKbtGSxp MAHQ== X-Gm-Message-State: ALoCoQk6uGq1xFEGJpWM82dkwIzWbNRCOyLNEOvd4OW5PU9HlV1aW8n7N8MtVBBLlnt74+6OS2tI X-Received: by 10.224.23.6 with SMTP id p6mr34623025qab.55.1422815195280; Sun, 01 Feb 2015 10:26:35 -0800 (PST) Received: from [192.168.1.139] (h96-61-87-245.cntcnh.dsl.dynamic.tds.net. [96.61.87.245]) by mx.google.com with ESMTPSA id m74sm16053966qgd.17.2015.02.01.10.26.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Feb 2015 10:26:34 -0800 (PST) Message-ID: <54CE6FD9.5030606@hurleysoftware.com> Date: Sun, 01 Feb 2015 13:26:33 -0500 From: Peter Hurley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Eddie Huang Subject: Re: [PATCH v2 1/4] tty: serial: Add 8250 earlycon to support noinit option References: <1421068104-30463-1-git-send-email-eddie.huang@mediatek.com> <1421068104-30463-2-git-send-email-eddie.huang@mediatek.com> <54CE53F3.5040709@hurleysoftware.com> In-Reply-To: <54CE53F3.5040709@hurleysoftware.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150201_102657_442840_108BBDD7 X-CRM114-Status: GOOD ( 18.61 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , linux-doc@vger.kernel.org, Catalin Marinas , Will Deacon , Jiri Slaby , Jonathan Corbet , yh.chen@mediatek.com, Howard Chen , linux-serial@vger.kernel.org, "Joe.C" , devicetree@vger.kernel.org, Vladimir Murzin , Pawel Moll , Ian Campbell , Rob Herring , Matthias Brugger , linux-arm-kernel@lists.infradead.org, Alan Cox , srv_heupstream@mediatek.com, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Ashwin Chaugule , Kumar Gala X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 02/01/2015 11:27 AM, Peter Hurley wrote: > Hi Eddie, > > On 01/12/2015 08:08 AM, Eddie Huang wrote: >> Add earlycon support not only baudrate option, but also add noinit option. >> If use noinit option, 8250 earlycon will not init serial hardware and use >> loader setting. > > I see this went into Greg's tty-testing branch. > > The only point of this is to not program the divisor, right? > > I ask because early_serial8250_setup() could already handle this without > extra options by simply not doing divisor programming if no baud option is > present. Does the patch below work for your use-case? [ Note: the patch applies to 3.19-rcX. To test, your noinit patches need to be reverted first. ] --- >% --- From: Peter Hurley Subject: [PATCH] serial: 8250_early: Assume uart already initialized if no baud option 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. 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;