From patchwork Sun Jul 2 16:30:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 9821699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41CA26035F for ; Sun, 2 Jul 2017 16:32:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 345F927FB7 for ; Sun, 2 Jul 2017 16:32:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2940A280DE; Sun, 2 Jul 2017 16:32:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF06827D4A for ; Sun, 2 Jul 2017 16:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752250AbdGBQcm (ORCPT ); Sun, 2 Jul 2017 12:32:42 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:39474 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751682AbdGBQad (ORCPT ); Sun, 2 Jul 2017 12:30:33 -0400 From: Paul Cercueil To: Ralf Baechle , Michael Turquette , Stephen Boyd , Rob Herring Cc: Paul Burton , Maarten ter Huurne , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, linux-clk@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 09/18] serial: 8250_ingenic: Parse earlycon options Date: Sun, 2 Jul 2017 18:30:07 +0200 Message-Id: <20170702163016.6714-10-paul@crapouillou.net> In-Reply-To: <20170702163016.6714-1-paul@crapouillou.net> References: <20170607200439.24450-2-paul@crapouillou.net> <20170702163016.6714-1-paul@crapouillou.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1499013031; bh=igT6oMtV/Cdn7qheH5e401KIl7i1NeEu5JVru1WdCbM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=EP0zHPL6htLsDfWS+f0PkGw4hY2Yv7kv7lpdENzjCQdJv05/q0ktWsPxXW9d3BkMD5+9npMjXB0oGvO6KWteKmJ4EqI1b4A2t91qN6lFrJ1XZ1bkozgMcRTTtkdWm6BhtTIQe2jLWZ6N0Qkp/JSV8H8UerP8VUqhR/xzLxNdgBw= Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the devicetree, it is possible to specify the baudrate, parity, bits, flow of the early console, by passing a configuration string like this: aliases { serial0 = &uart0; }; chosen { stdout-path = "serial0:57600n8"; }; This, for instance, will configure the early console for a baudrate of 57600 bps, no parity, and 8 bits per baud. This patches implements parsing of this configuration string in the 8250_ingenic driver, which previously just ignored it. Signed-off-by: Paul Cercueil --- drivers/tty/serial/8250/8250_ingenic.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) v2: Don't create temp. buffer, now that uart_parse_options takes a const char* v3: No change diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c index b31b2ca552d1..be4a07a24342 100644 --- a/drivers/tty/serial/8250/8250_ingenic.c +++ b/drivers/tty/serial/8250/8250_ingenic.c @@ -99,14 +99,22 @@ static int __init ingenic_early_console_setup(struct earlycon_device *dev, const char *opt) { struct uart_port *port = &dev->port; - unsigned int baud, divisor; + unsigned int divisor; + int baud = 115200; if (!dev->port.membase) return -ENODEV; + if (opt) { + unsigned int parity, bits, flow; /* unused for now */ + + uart_parse_options(opt, &baud, &parity, &bits, &flow); + } + ingenic_early_console_setup_clock(dev); - baud = dev->baud ?: 115200; + if (dev->baud) + baud = dev->baud; divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * baud); early_out(port, UART_IER, 0);