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>,
	Rob Herring <robh@kernel.org>, Stefan Agner <stefan@agner.ch>
Cc: linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux Kernel Mailing List <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: Wed, 21 Oct 2015 08:27:23 -0400	[thread overview]
Message-ID: <562784AB.4040709@hurleysoftware.com> (raw)
In-Reply-To: <CAK7LNAQYbg4L9dX4riQ8Zb_NN7pbhx60aXwb4rZJgdTz-pocsQ@mail.gmail.com>

On 10/20/2015 09:20 PM, Masahiro Yamada wrote:
> Hi Peter,
> (+ Rob Herring, Stefan Agner)
> 
> 2015-10-20 23:00 GMT+09:00 Peter Hurley <peter@hurleysoftware.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?
> 
> It does.
> I use U-boot and the serial port is already set up by U-boot.
> 
> 
> But, earlycon setup functions update hardware registers.
> See  early_serial8250_setup(), ingenic_early_console_setup(), etc.
> 
> 
> Without port->uartclk set to a valid value,
> the init code in earlycon setup does not make sense.
> 
> 
> What I want to clarify is,
> what should we do in the earlycon setup function?
> 
> Currently, I see
>  [1] set device->con->write callback
>  [2] initialize UART port registers
> 
> 
> For [2], we need to know baudrate and input clock frequency.
> (and the latter is missing, that's why my patch is here.)
> 
> 
> In order to be independent of a boot loader, we also need
>   [3]  pinctrl (pin-muxing)
> 
> But, it is difficult to handle pinctrl in the earlycon framework.
> 
> 
> If we depend on a boot loader, [2] is meaningless.   [1] is enough.

The 8250 earlycon doesn't try to initialize the hardware (other than
masking interrupts) if the baud rate is uninitialized
(!device->baud in early_serial8250_setup()).

Rather than initializing the h/w to a default of 115200 in
ingenic_early_console_setup() when device->baud == 0, it should just
mask interrupts. That way the bootloader initialization will be
preserved when the options are unspecified on the command line, such as:

	earlycon=jz4740_uart,mmio32,0x43fb0000


Regards,
Peter Hurley

PS - Apologies for not reviewing the Ingenic 8250 driver at submission
time.

  reply	other threads:[~2015-10-21 12:27 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
2015-10-21  1:20     ` Masahiro Yamada
2015-10-21 12:27       ` Peter Hurley [this message]
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=562784AB.4040709@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=robh@kernel.org \
    --cc=stefan@agner.ch \
    --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).