From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753118AbbJTOBG (ORCPT ); Tue, 20 Oct 2015 10:01:06 -0400 Received: from mail-qg0-f54.google.com ([209.85.192.54]:34733 "EHLO mail-qg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753094AbbJTOBD (ORCPT ); Tue, 20 Oct 2015 10:01:03 -0400 Subject: Re: [PATCH v2 2/2] serial: earlycon: allow to specify uartclk in earlycon kernel-parameter To: Masahiro Yamada References: <1445312189-28876-1-git-send-email-yamada.masahiro@socionext.com> <1445312189-28876-3-git-send-email-yamada.masahiro@socionext.com> Cc: linux-serial@vger.kernel.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Jiri Slaby From: Peter Hurley Message-ID: <5626491A.8040908@hurleysoftware.com> Date: Tue, 20 Oct 2015 10:00:58 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1445312189-28876-3-git-send-email-yamada.masahiro@socionext.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/19/2015 11:36 PM, Masahiro Yamada wrote: > The input clock frequency varies from device to device, but the > earlycon uses the fixed frequency (BASE_BAUD * 16). It makes > impossible to set the correct divisor to the register. So the bootloader hasn't setup the serial port? > This commit allows to specify the input clock frequency from the > kernel-parameter. > > [Example] > > earlycon=uart8250,mmio32,0x43fb0000,115200,12288000 > > The input clock frequency (12288000, in this case) should be specified > after the baudrate. If not specified, the default (BASE_BAUD * 16) is > used. > > Signed-off-by: Masahiro Yamada > --- > > Changes in v2: None > > drivers/tty/serial/earlycon.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c > index 07f7393..8030765 100644 > --- a/drivers/tty/serial/earlycon.c > +++ b/drivers/tty/serial/earlycon.c > @@ -95,6 +95,13 @@ static int __init parse_options(struct earlycon_device *device, char *options) > length = min(strcspn(options, " ") + 1, > (size_t)(sizeof(device->options))); > strlcpy(device->options, options, length); > + options = strchr(options, ','); > + if (options) { > + options++; > + port->uartclk = simple_strtoul(options, NULL, 0); > + } > + if (!port->uartclk) > + port->uartclk = BASE_BAUD * 16; > } > > if (port->iotype == UPIO_MEM || port->iotype == UPIO_MEM16 || > @@ -122,7 +129,6 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match) > if (buf && !parse_options(&early_console_dev, buf)) > buf = NULL; > > - port->uartclk = BASE_BAUD * 16; > if (port->mapbase) > port->membase = earlycon_map(port->mapbase, 64); > >