All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>
Subject: Re: [PATCH 3/3] tty/serial: 8250_early: Add support for PXA UARTs
Date: Tue, 27 Jan 2015 09:25:17 -0500	[thread overview]
Message-ID: <54C79FCD.9040802@hurleysoftware.com> (raw)
In-Reply-To: <CAL_Jsq+Jm=0YRJ_uc+wk0YopVGBgcfJia_W+X8oRViq=ATsx6A@mail.gmail.com>

On 01/27/2015 09:05 AM, Rob Herring wrote:
> On Tue, Jan 27, 2015 at 7:10 AM, Peter Hurley <peter@hurleysoftware.com> wrote:
>> On 01/26/2015 11:50 PM, Rob Herring wrote:
>>> The PXA variant of the 8250 UART adds a UART enable bit which must not
>>> be cleared. Make the earlycon support maintain this bit if it is set.
>>> This implies some initialization of the UART, but we cannot
>>> unconditionally set the bit as some other variants require this bit to
>>> be clear for other functions.
>>
>> So if the bootloader doesn't enable the uart, then earlycon doesn't work?
> 
> Correct. Some earlycon drivers rely on this fact and don't do any
> initialization. There is a patch posted also to skip init for the 8250
> earlycon. We could rely on that instead, but the 1st chunk is still
> needed.
> 
> The UART already being initialized should be pretty common for PXA
> based systems. More so than x86 UARTs. I think it is better to work
> under some conditions than none.

Ok.

>> Or is there some other piece that is enabling the uart after earlycon setup
>> (besides the driver, of course)?
>>
>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>> Cc: Jiri Slaby <jslaby@suse.cz>
>>> Cc: linux-serial@vger.kernel.org
>>> ---
>>>  drivers/tty/serial/8250/8250_early.c | 8 +++++---
>>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
>>> index ce2a8ab..c31a22b 100644
>>> --- a/drivers/tty/serial/8250/8250_early.c
>>> +++ b/drivers/tty/serial/8250/8250_early.c
>>> @@ -93,10 +93,10 @@ static void __init early_serial8250_write(struct console *console,
>>>       struct uart_port *port = &early_device->port;
>>>       unsigned int ier;
>>>
>>> -     /* Save the IER and disable interrupts */
>>> +     /* Save the IER and disable interrupts preserving the UUE bit */
>>>       ier = serial8250_early_in(port, UART_IER);
>>>       if (ier)
>>> -             serial8250_early_out(port, UART_IER, 0);
>>> +             serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
>>>
>>>       uart_console_write(port, s, count, serial_putc);
>>>
>>> @@ -127,9 +127,11 @@ static void __init init_port(struct earlycon_device *device)
>>>       struct uart_port *port = &device->port;
>>>       unsigned int divisor;
>>>       unsigned char c;
>>> +     unsigned int ier;
>>>
>>>       serial8250_early_out(port, UART_LCR, 0x3);      /* 8n1 */
>>> -     serial8250_early_out(port, UART_IER, 0);        /* no interrupt */
>>> +     ier = serial8250_early_in(port, UART_IER);
>>> +     serial8250_early_out(port, UART_IER, ier & UART_IER_UUE); /* no interrupt */
>>
>> The trailing comment seems no longer relevant; how about below?
> 
> It is because we are still disabling interrupts.

I realize that, which is why my suggested replacement comment includes
that information. It's not obvious what effect UART_IER_UUE has from
just looking at the code.

>>         /* Mask interrupts (preserve XScale's uart enable bit) */
>>         serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
>>
>> OTOH, if the uart is disabled, shouldn't earlycon be disabled?
> 
> There's no way I can detect that.

Right, sorry.

[ I was about to write, "If UART_IER_UEE is not set, ..." which of course is true
  for every other non-PXA 8250-base uart :)
]

Regards,
Peter Hurley

WARNING: multiple messages have this Message-ID (diff)
From: peter@hurleysoftware.com (Peter Hurley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] tty/serial: 8250_early: Add support for PXA UARTs
Date: Tue, 27 Jan 2015 09:25:17 -0500	[thread overview]
Message-ID: <54C79FCD.9040802@hurleysoftware.com> (raw)
In-Reply-To: <CAL_Jsq+Jm=0YRJ_uc+wk0YopVGBgcfJia_W+X8oRViq=ATsx6A@mail.gmail.com>

On 01/27/2015 09:05 AM, Rob Herring wrote:
> On Tue, Jan 27, 2015 at 7:10 AM, Peter Hurley <peter@hurleysoftware.com> wrote:
>> On 01/26/2015 11:50 PM, Rob Herring wrote:
>>> The PXA variant of the 8250 UART adds a UART enable bit which must not
>>> be cleared. Make the earlycon support maintain this bit if it is set.
>>> This implies some initialization of the UART, but we cannot
>>> unconditionally set the bit as some other variants require this bit to
>>> be clear for other functions.
>>
>> So if the bootloader doesn't enable the uart, then earlycon doesn't work?
> 
> Correct. Some earlycon drivers rely on this fact and don't do any
> initialization. There is a patch posted also to skip init for the 8250
> earlycon. We could rely on that instead, but the 1st chunk is still
> needed.
> 
> The UART already being initialized should be pretty common for PXA
> based systems. More so than x86 UARTs. I think it is better to work
> under some conditions than none.

Ok.

>> Or is there some other piece that is enabling the uart after earlycon setup
>> (besides the driver, of course)?
>>
>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>> Cc: Jiri Slaby <jslaby@suse.cz>
>>> Cc: linux-serial at vger.kernel.org
>>> ---
>>>  drivers/tty/serial/8250/8250_early.c | 8 +++++---
>>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
>>> index ce2a8ab..c31a22b 100644
>>> --- a/drivers/tty/serial/8250/8250_early.c
>>> +++ b/drivers/tty/serial/8250/8250_early.c
>>> @@ -93,10 +93,10 @@ static void __init early_serial8250_write(struct console *console,
>>>       struct uart_port *port = &early_device->port;
>>>       unsigned int ier;
>>>
>>> -     /* Save the IER and disable interrupts */
>>> +     /* Save the IER and disable interrupts preserving the UUE bit */
>>>       ier = serial8250_early_in(port, UART_IER);
>>>       if (ier)
>>> -             serial8250_early_out(port, UART_IER, 0);
>>> +             serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
>>>
>>>       uart_console_write(port, s, count, serial_putc);
>>>
>>> @@ -127,9 +127,11 @@ static void __init init_port(struct earlycon_device *device)
>>>       struct uart_port *port = &device->port;
>>>       unsigned int divisor;
>>>       unsigned char c;
>>> +     unsigned int ier;
>>>
>>>       serial8250_early_out(port, UART_LCR, 0x3);      /* 8n1 */
>>> -     serial8250_early_out(port, UART_IER, 0);        /* no interrupt */
>>> +     ier = serial8250_early_in(port, UART_IER);
>>> +     serial8250_early_out(port, UART_IER, ier & UART_IER_UUE); /* no interrupt */
>>
>> The trailing comment seems no longer relevant; how about below?
> 
> It is because we are still disabling interrupts.

I realize that, which is why my suggested replacement comment includes
that information. It's not obvious what effect UART_IER_UUE has from
just looking at the code.

>>         /* Mask interrupts (preserve XScale's uart enable bit) */
>>         serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
>>
>> OTOH, if the uart is disabled, shouldn't earlycon be disabled?
> 
> There's no way I can detect that.

Right, sorry.

[ I was about to write, "If UART_IER_UEE is not set, ..." which of course is true
  for every other non-PXA 8250-base uart :)
]

Regards,
Peter Hurley

  reply	other threads:[~2015-01-27 14:25 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27  4:50 [PATCH 1/3] tty/serial: of_serial: add DT alias ID handling Rob Herring
2015-01-27  4:50 ` Rob Herring
2015-01-27  4:50 ` [PATCH 2/3] tty/serial: of_serial: add support for PXA/MMP uarts Rob Herring
2015-01-27  4:50   ` Rob Herring
2015-01-27 12:44   ` Peter Hurley
2015-01-27 12:44     ` Peter Hurley
2015-01-27 14:30     ` Rob Herring
2015-01-27 14:30       ` Rob Herring
2015-01-27 15:09       ` Peter Hurley
2015-01-27 15:09         ` Peter Hurley
2015-01-27 16:44         ` Rob Herring
2015-01-27 16:44           ` Rob Herring
2015-01-27 19:43           ` Peter Hurley
2015-01-27 19:43             ` Peter Hurley
2015-01-28 14:21             ` Rob Herring
2015-01-28 14:21               ` Rob Herring
2015-01-28 17:06               ` Peter Hurley
2015-01-28 17:06                 ` Peter Hurley
2015-01-28 17:37           ` Peter Hurley
2015-01-28 17:37             ` Peter Hurley
2015-01-30 19:51             ` Rob Herring
2015-01-30 19:51               ` Rob Herring
2015-01-30 20:24               ` Peter Hurley
2015-01-30 20:24                 ` Peter Hurley
2015-02-01 17:07                 ` Peter Hurley
2015-02-01 17:07                   ` Peter Hurley
2015-01-27  4:50 ` [PATCH 3/3] tty/serial: 8250_early: Add support for PXA UARTs Rob Herring
2015-01-27  4:50   ` Rob Herring
2015-01-27 13:10   ` Peter Hurley
2015-01-27 13:10     ` Peter Hurley
2015-01-27 14:05     ` Rob Herring
2015-01-27 14:05       ` Rob Herring
2015-01-27 14:25       ` Peter Hurley [this message]
2015-01-27 14:25         ` Peter Hurley

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=54C79FCD.9040802@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.