From patchwork Mon Aug 21 16:22:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 804090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tj4T/+/5"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xbf9m5xhfz9s78 for ; Tue, 22 Aug 2017 02:22:52 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OEwv7cR6UDSWEoxgb/fEclJf+4pKugUMQ5SWq3EUaik=; b=tj4T/+/5ltHQFI AbkB2hkSE84wx6j7jeJlH24kVBsKDq1D4pj2y5sIToxVWjBvcAgvraj6NvTuCIaU0Thiq93MKAxuS 3ZrkkFFAJ6YwEyUHW/+HuU1bPLqip141X6Dd/wHsXuNfGdOxsic56Ug6mW4WYNZ6THb1H239noGeT 68Bx9IKODVLzvW+vbCxhdI0TQTQbLEtOVzqBAazmK+QN6RfM7OgsfUCsNplD11wKRW7s5J53rLlNx +MqeuyqExDSAdaveGc8T0ISN3vtkKLcMASvP43aTILKHk98OMv56l7nPx879az/Aq0hOOWo+Nxze6 psVP/AjMV//LNX3auUmg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1djpTW-0008WO-Ca; Mon, 21 Aug 2017 16:22:50 +0000 Received: from smtprelay.synopsys.com ([198.182.47.9]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1djpTS-0008UF-VQ for linux-snps-arc@lists.infradead.org; Mon, 21 Aug 2017 16:22:49 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 7B6D224E0B23; Mon, 21 Aug 2017 09:22:22 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 57886C8D; Mon, 21 Aug 2017 09:22:22 -0700 (PDT) Received: from localhost.internal.synopsys.com (unknown [10.121.8.106]) by mailhost.synopsys.com (Postfix) with ESMTP id 8CC99C5C; Mon, 21 Aug 2017 09:22:20 -0700 (PDT) From: Eugeniy Paltsev To: linux-serial@vger.kernel.org Subject: [PATCH v3] earlycon: initialise baud field of earlycon device structure Date: Mon, 21 Aug 2017 19:22:13 +0300 Message-Id: <20170821162213.27102-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170821_092247_224569_E3C9EC91 X-CRM114-Status: UNSURE ( 8.39 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.47.9 listed in wl.mailspike.net] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , linux-snps-arc@lists.infradead.org, Eugeniy Paltsev , linux-kernel@vger.kernel.org, Jiri Slaby Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org For now baud field of earlycon structure device is't initialised at all in of_setup_earlycon (in oppositŠµ to register_earlycon). So when I use stdout-path to point earlycon device (like stdout-path = &serial or stdout-path = "serial:115200n8") baud field of earlycon device structure remains uninitialised and earlycon initialization is not performed correctly as of_setup_earlycon is used. When pass all arguments via bootargs (like bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8") initialization is performed correctly as register_earlycon is used. So initialise baud field of earlycon device structure by value of "current-speed" property from device tree or from options (if they exist) when we use of_setup_earlycon Signed-off-by: Eugeniy Paltsev --- Changes v2 -> v3: * Use simple_strtoul instead of kstrtoul as with kstrtoul we can't parse options string which includes arguments except baudrate (like "115200n8") Changes v1 -> v2: * Use standart property name "current-speed" instead of custom "baud" NOTE: I don't add parsing of the other standard options here because we don't have any place to store them. When we parce and set options of the 'real' uart device (using uart_parse_options + uart_set_options) we populate ktermios structure an pass it to port->ops->set_termios callback of uart_port structure. So it is processing by uart driver itself. But we don't register such callbacks for earlycon. So we are only able to parse baud value, which can be stored in baud field of earlycon_device structure. drivers/tty/serial/earlycon.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index c365154..82e813b 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -282,7 +282,12 @@ int __init of_setup_earlycon(const struct earlycon_id *match, } } + val = of_get_flat_dt_prop(node, "current-speed", NULL); + if (val) + early_console_dev.baud = be32_to_cpu(*val); + if (options) { + early_console_dev.baud = simple_strtoul(options, NULL, 0); strlcpy(early_console_dev.options, options, sizeof(early_console_dev.options)); }