linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, Jiri Slaby <jslaby@suse.com>
Subject: Re: [PATCH v2 2/2] serial: earlycon: allow to specify uartclk in earlycon kernel-parameter
Date: Tue, 20 Oct 2015 10:00:58 -0400	[thread overview]
Message-ID: <5626491A.8040908@hurleysoftware.com> (raw)
In-Reply-To: <1445312189-28876-3-git-send-email-yamada.masahiro@socionext.com>

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 <yamada.masahiro@socionext.com>
> ---
> 
> 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);
>  
> 

  reply	other threads:[~2015-10-20 14:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  3:36 [PATCH v2 0/2] serial: console: add two features Masahiro Yamada
     [not found] ` <1445312189-28876-1-git-send-email-yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
2015-10-20  3:36   ` [PATCH v2 1/2] serial: support register interface with 16-bit stride for console Masahiro Yamada
2015-10-20 13:42     ` Peter Hurley
2015-10-20  3:36 ` [PATCH v2 2/2] serial: earlycon: allow to specify uartclk in earlycon kernel-parameter Masahiro Yamada
2015-10-20 14:00   ` Peter Hurley [this message]
2015-10-21  1:20     ` Masahiro Yamada
2015-10-21 12:27       ` Peter Hurley
2015-10-21 15:31         ` Masahiro Yamada
2015-10-21 15:35           ` Peter Hurley
2015-10-22  3:58             ` Masahiro Yamada
2015-10-22 15:34       ` Rob Herring
2015-10-23 11:15         ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5626491A.8040908@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).