Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752556AbdHOT0w (ORCPT ); Tue, 15 Aug 2017 15:26:52 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:36546 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbdHOT0u (ORCPT ); Tue, 15 Aug 2017 15:26:50 -0400 MIME-Version: 1.0 In-Reply-To: <20170815172141.29115-1-Eugeniy.Paltsev@synopsys.com> References: <20170815172141.29115-1-Eugeniy.Paltsev@synopsys.com> From: Rob Herring Date: Tue, 15 Aug 2017 14:26:28 -0500 Message-ID: Subject: Re: [PATCH] earlycon: initialise baud field of earlycon device structure To: Eugeniy Paltsev Cc: "linux-serial@vger.kernel.org" , arcml , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , Jiri Slaby Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v7FJQw35012871 Content-Length: 2683 Lines: 72 On Tue, Aug 15, 2017 at 12:21 PM, Eugeniy Paltsev wrote: > 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. Because the console driver is supposed to parse the option string. That allows in theory for the options to be specific for each console. Maybe your earlycon driver is failing to do that. > 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 baud value > from device tree or from options (if they exist) when we use > of_setup_earlycon > > Signed-off-by: Eugeniy Paltsev > --- > drivers/tty/serial/earlycon.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c > index c365154..6c2e2b6 100644 > --- a/drivers/tty/serial/earlycon.c > +++ b/drivers/tty/serial/earlycon.c > @@ -240,6 +240,7 @@ int __init of_setup_earlycon(const struct earlycon_id *match, > { > int err; > struct uart_port *port = &early_console_dev.port; > + unsigned long baud; > const __be32 *val; > bool big_endian; > u64 addr; > @@ -282,7 +283,15 @@ int __init of_setup_earlycon(const struct earlycon_id *match, > } > } > > + val = of_get_flat_dt_prop(node, "baud", NULL); No, we already have a defined way to set the baud, we don't need a property in addition. Plus you didn't document it. > + if (val) > + early_console_dev.baud = be32_to_cpu(*val); > + > if (options) { > + err = kstrtoul(options, 10, &baud); > + if (!err) > + early_console_dev.baud = baud; This seems fine to do here, but then we should also parse the other standard options here too. And we should make sure we're not doing it twice. > + > strlcpy(early_console_dev.options, options, > sizeof(early_console_dev.options)); > } > -- > 2.9.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-serial" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html