linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Timur Tabi <timur@codeaurora.org>
Cc: Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	"graeme.gregory@linaro.org" <graeme.gregory@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>, Jakub Kicinski <moorray3@wp.pl>,
	GregKH <gregkh@linuxfoundation.org>,
	"nareshgbhat@gmail.com" <nareshgbhat@gmail.com>,
	"mlangsdo@redhat.com" <mlangsdo@redhat.com>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"rmk+kernel@arm.linux.org.uk" <rmk+kernel@arm.linux.org.uk>,
	Jiri Slaby <jslaby@suse.cz>, Dave P Martin <Dave.Martin@arm.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v5 05/11] drivers: PL011: refactor pl011_probe()
Date: Thu, 3 Sep 2015 17:54:22 +0100	[thread overview]
Message-ID: <55E87B3E.8070106@arm.com> (raw)
In-Reply-To: <CAOZdJXVgRQZhEfYY9YdpiQ=n1D56yYL84s42V4hd2=YX2k48ZA@mail.gmail.com>

Hi Timur,

(sorry for the delay, just found your email which arrived during my
vacation)

On 09/08/15 01:59, Timur Tabi wrote:
> On Thu, May 21, 2015 at 9:26 AM, Andre Przywara <andre.przywara@arm.com> wrote:
>> +static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
>> +{
>> +       struct uart_amba_port *uap;
>> +       struct vendor_data *vendor = id->data;
>> +       int portnr, ret;
>> +
>> +       portnr = pl011_find_free_port();
>> +       if (portnr < 0)
>> +               return portnr;
>> +
>> +       uap = devm_kzalloc(&dev->dev, sizeof(struct uart_amba_port),
>> +                          GFP_KERNEL);
>> +       if (!uap)
>> +               return -ENOMEM;
>> +
>> +       uap->clk = devm_clk_get(&dev->dev, NULL);
>> +       if (IS_ERR(uap->clk))
>> +               return PTR_ERR(uap->clk);
>> +
>> +       = vendor;
> 
> I'm having trouble with this.  Specifically, I can't get SBSA early
> console to work, because uap->vendor is uninitialized when
> pl011_early_write() is called.

I don't get where pl011_early_write() would need any kind of PL011 struct.
It only references structures defined in the serial core, so it's
completely dumb MMIO writes and reads, using only the base address
provided on the command line.
Are you by any chance mixing up early console and the normal console? To
me it looks like early console just uses the three tiny functions
defined just before the declaration and it does not touch vendor at all,
isn't it?

As for the broken part, any chance you were testing -next, which has
some patches that broke early console, as we learned today?[1]

Cheers,
Andre.
[1]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-September/367744.html

> 
> I don't have a non-SBSA system to test, but looking at the code, I'm
> not sure how early console is supposed to work any more.  In both SBSA
> and non-SBSA cases, uap->vendor is not initialized until the probe
> function is called.  Isn't that too late?  I thought early console was
> supposed to be running before the driver is probed.
> 
> If I make this change, then early console works on SBSA systems (with
> earlycon=pl011,<address>).  But of course, this only works for SBSA
> and breaks regular PL011.
> 
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2326,9 +2326,15 @@ static void pl011_early_write(struct console *con, const
>  static int __init pl011_early_console_setup(struct earlycon_device *device,
>                                             const char *opt)
>  {
> +       struct uart_amba_port *uap =
> +           container_of(&device->port, struct uart_amba_port, port);
> +
>         if (!device->port.membase)
>                 return -ENODEV;
> +       if (!uap->vendor)
> +               uap->vendor = &vendor_sbsa;
> +
>         device->con->write = pl011_early_write;
>         return 0;
>  }
> 

  reply	other threads:[~2015-09-03 16:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 16:26 [PATCH v5 00/11] drivers: PL011: add ARM SBSA Generic UART support Andre Przywara
2015-05-21 16:26 ` [PATCH v5 01/11] drivers: PL011: avoid potential unregister_driver call Andre Przywara
2015-05-21 16:26 ` [PATCH v5 02/11] drivers: PL011: refactor pl011_startup() Andre Przywara
2015-09-24 23:11   ` Timur Tabi
2015-09-25 15:21     ` Andre Przywara
2015-09-25 15:30       ` Russell King - ARM Linux
2015-05-21 16:26 ` [PATCH v5 03/11] drivers: PL011: refactor pl011_shutdown() Andre Przywara
2015-05-21 16:26 ` [PATCH v5 04/11] drivers: PL011: refactor pl011_set_termios() Andre Przywara
2015-05-21 16:26 ` [PATCH v5 05/11] drivers: PL011: refactor pl011_probe() Andre Przywara
2015-08-09  0:59   ` Timur Tabi
2015-09-03 16:54     ` Andre Przywara [this message]
2015-09-03 18:09       ` Timur Tabi
2015-05-21 16:26 ` [PATCH v5 06/11] drivers: PL011: replace UART_MIS reading with _RIS & _IMSC Andre Przywara
2015-05-21 16:26 ` [PATCH v5 07/11] drivers: PL011: move cts_event workaround into separate function Andre Przywara
2015-05-21 16:26 ` [PATCH v5 08/11] drivers: PL011: allow avoiding UART enabling/disabling Andre Przywara
2015-05-21 16:26 ` [PATCH v5 09/11] drivers: PL011: allow to supply fixed option string Andre Przywara
2015-05-21 16:26 ` [PATCH v5 10/11] drivers: PL011: add support for the ARM SBSA generic UART Andre Przywara
2015-05-21 16:26 ` [PATCH v5 11/11] drivers: PL011: add ACPI probing for SBSA UART Andre Przywara
2015-05-21 17:19 ` [PATCH v5 00/11] drivers: PL011: add ARM SBSA Generic UART support Mark Langsdorf
2015-05-21 17:45   ` Graeme Gregory
2015-05-22 13:14 ` Naresh Bhat

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=55E87B3E.8070106@arm.com \
    --to=andre.przywara@arm.com \
    --cc=Dave.Martin@arm.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=arnd@arndb.de \
    --cc=graeme.gregory@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mlangsdo@redhat.com \
    --cc=moorray3@wp.pl \
    --cc=nareshgbhat@gmail.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=timur@codeaurora.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 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).