devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Eddie Huang <eddie.huang@mediatek.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	devicetree@vger.kernel.org,
	Vladimir Murzin <vladimir.murzin@arm.com>,
	srv_heupstream@mediatek.com, Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	yh.chen@mediatek.com, Howard Chen <ibanezchen@gmail.com>,
	Ashwin Chaugule <ashwin.chaugule@linaro.org>,
	linux-serial@vger.kernel.org, Kumar Gala <galak@codeaurora.org>,
	"Joe.C" <yingjoe.chen@mediatek.com>, Jiri Slaby <jslaby@suse.cz>,
	linux-arm-kernel@lists.infradead.org,
	Alan Cox <alan@linux.intel.com>
Subject: Re: [PATCH v2 1/4] tty: serial: Add 8250 earlycon to support noinit option
Date: Sun, 01 Feb 2015 22:45:12 -0500	[thread overview]
Message-ID: <54CEF2C8.1050808@hurleysoftware.com> (raw)
In-Reply-To: <1422846994.5512.25.camel@mtksdaap41>

On 02/01/2015 10:16 PM, Eddie Huang wrote:
> Hi Peter,
> 
> On Sun, 2015-02-01 at 13:26 -0500, Peter Hurley wrote:
>> On 02/01/2015 11:27 AM, Peter Hurley wrote:
>>> Hi Eddie,
>>>
>>> On 01/12/2015 08:08 AM, Eddie Huang wrote:
>>>> Add earlycon support not only baudrate option, but also add noinit option.
>>>> If use noinit option, 8250 earlycon will not init serial hardware and use
>>>> loader setting.
>>>
>>> I see this went into Greg's tty-testing branch.
>>>
>>> The only point of this is to not program the divisor, right?
>>>
>>> I ask because early_serial8250_setup() could already handle this without
>>> extra options by simply not doing divisor programming if no baud option is
>>> present.
>>
>> Does the patch below work for your use-case?
>>
>> [ Note: the patch applies to 3.19-rcX. To test, your noinit patches need to be
>>   reverted first.
>> ]
>>
>> --- >% ---
>> From: Peter Hurley <peter@hurleysoftware.com>
>> Subject: [PATCH] serial: 8250_early: Assume uart already initialized if no
>>  baud option
>>
>> The <baud><parity><bit> option string is not supplied if the earlycon
>> is started via devicetree and OF_EARLYCON_DECLARE(). The option string
>> is also not required if started via kernel command line parameters of
>> the form:
>>   earlycon=uart,mmio,<addr>
>>   console=uart,mmio,<addr>
>>
>> If earlycon_device->baud is 0, then an option string was not supplied.
>> In this case, assume the uart has already been initialized by the
>> bootloader or firmware.
>>
>> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
>> ---
>>  drivers/tty/serial/8250/8250_early.c | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
>> index d7b831b..1701d00 100644
>> --- a/drivers/tty/serial/8250/8250_early.c
>> +++ b/drivers/tty/serial/8250/8250_early.c
>> @@ -149,12 +149,18 @@ static int __init early_serial8250_setup(struct earlycon_device *device,
>>  		return 0;
>>  
>>  	if (!device->baud) {
>> +		struct uart_port *port = &device->port;
>> +		unsigned int ier;
>> +
>>  		device->baud = probe_baud(&device->port);
>>  		snprintf(device->options, sizeof(device->options), "%u",
>>  			 device->baud);
>> -	}
>>  
>> -	init_port(device);
>> +		/* assume the device was initialized, only mask interrupts */
>> +		ier = serial8250_early_in(port, UART_IER);
>> +		serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
>> +	} else
>> +		init_port(device);
> Should add brace in else.

I don't do that unless I have to.

> Where is original line here.
>           early_device = device;

Whoops :)

I wrote the patch from a private branch which implements extensible console
matching (so a console can define its own match function) and a bunch of
other console cleanup and code removal. In that series, early_device becomes
unnecessary and is removed.

I'll respin proper patches on top of Greg's tty-testing branch with reverts
for the noinit options. I noticed that one of the noinit patches actually
has the linkage for the mtk earlycon, so I'll be sure to preserve that.

Regards,
Peter Hurley


  reply	other threads:[~2015-02-02  3:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 13:08 [PATCH v2 0/4] tty: serial: Add earlycon support to MT8173 SoC Eddie Huang
2015-01-12 13:08 ` [PATCH v2 1/4] tty: serial: Add 8250 earlycon to support noinit option Eddie Huang
2015-01-12 15:35   ` Arnd Bergmann
2015-01-12 16:08     ` Alan Cox
2015-01-13  1:05       ` Eddie Huang
     [not found]   ` <1421068104-30463-2-git-send-email-eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-02-01 16:27     ` Peter Hurley
     [not found]       ` <54CE53F3.5040709-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2015-02-01 18:26         ` Peter Hurley
2015-02-02  3:16           ` Eddie Huang
2015-02-02  3:45             ` Peter Hurley [this message]
2015-02-02  4:28               ` Greg Kroah-Hartman
2015-02-02  5:15                 ` Peter Hurley
2015-02-02  5:24                   ` Greg Kroah-Hartman
2015-02-02  5:33                     ` Eddie Huang
2015-02-02  5:43                       ` Peter Hurley
2015-02-02 18:46                         ` Greg Kroah-Hartman
2015-02-02  2:45       ` Eddie Huang
2015-02-02  3:27         ` Peter Hurley
2015-01-12 13:08 ` [PATCH v2 2/4] tty: serial: 8250_mtk: Add earlycon Eddie Huang
2015-01-12 13:08 ` [PATCH v2 3/4] arm64: dts: Add mediatek MT8173 earlycon support Eddie Huang
2015-01-12 13:08 ` [PATCH v2 4/4] Document: Modify 8250 earlycon kernel parameters Eddie Huang

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=54CEF2C8.1050808@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=alan@linux.intel.com \
    --cc=ashwin.chaugule@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=eddie.huang@mediatek.com \
    --cc=galak@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ibanezchen@gmail.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jslaby@suse.cz \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=vladimir.murzin@arm.com \
    --cc=will.deacon@arm.com \
    --cc=yh.chen@mediatek.com \
    --cc=yingjoe.chen@mediatek.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).