linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* earlycon issues in -next with amba-pl011 updates
@ 2015-08-10 23:23 Leif Lindholm
  2015-08-11  0:31 ` Peter Hurley
  2015-08-11  1:48 ` Jun Nie
  0 siblings, 2 replies; 24+ messages in thread
From: Leif Lindholm @ 2015-08-10 23:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

The kernelci.org bot picked up a complete boot failure (no output past
UEFI stub) with next-20150806 and Tyler bisected it down to somewhere
in
8cd90e5 uart: pl011: Add support to ZTE ZX296702 uart
09dcc7d uart: pl011: Improve LCRH register access decision
2c096a9 uart: pl011: Introduce register look up table
7b753f3 uart: pl011: Introduce register accessor

The issue only appears with earlycon on command line, for pl011
consoles.

Some investigation shows that the cause lies with
commit 7b753f318d14 ("uart: pl011: Introduce register accessor")
and
commit 2c096a9eedc6 ("uart: pl011: Introduce register look up table")

Specifically, the changes to pl011_putc() are incorrect:
The new pl011_ accessors take a (struct uart_amba_port *) input, but
pl011_putc() directly uses the incoming (struct uart_port *) for this.

Apart from ending up with an unintended/incorrect UART base address,
the introduction of the lookup table for register offsets also means
the accessors try to dereference (struct uart_amba_port *)->reg_lut.

The below is a hack that shows/resolves the issue, but some
refactoring of the original patches might be in order.

/
    Leif

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 2af09ab..452dbba 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2348,13 +2348,14 @@ static struct console amba_console = {
 
 static void pl011_putc(struct uart_port *port, int c)
 {
-	struct uart_amba_port *uap =
-	    container_of(port, struct uart_amba_port, port);
+	struct uart_amba_port uap;
+	uap.port = *port;
+	uap.reg_lut = arm_reg;
 
-	while (pl011_readw(uap, REG_FR) & UART01x_FR_TXFF)
+	while (pl011_readw(&uap, REG_FR) & UART01x_FR_TXFF)
 		;
-	pl011_writeb(uap, c, REG_DR);
-	while (pl011_readw(uap, REG_FR) & uap->fr_busy)
+	pl011_writeb(&uap, c, REG_DR);
+	while (pl011_readw(&uap, REG_FR) & UART01x_FR_BUSY)
 		;
 }
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2015-09-16  0:54 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10 23:23 earlycon issues in -next with amba-pl011 updates Leif Lindholm
2015-08-11  0:31 ` Peter Hurley
2015-08-11 10:07   ` Leif Lindholm
2015-08-11 12:40   ` Russell King - ARM Linux
2015-08-17 16:04     ` Peter Hurley
2015-08-11  1:48 ` Jun Nie
2015-09-03 10:23   ` Marc Zyngier
2015-09-03 15:52     ` Greg Kroah-Hartman
2015-09-03 16:08       ` Marc Zyngier
2015-09-03 17:49         ` Peter Hurley
2015-09-03 17:53           ` Greg Kroah-Hartman
2015-09-03 18:03             ` Peter Hurley
2015-09-03 18:16               ` Marc Zyngier
2015-09-03 18:21                 ` Peter Hurley
2015-09-03 18:00           ` Marc Zyngier
2015-09-03 18:15             ` Peter Hurley
2015-09-04 11:06         ` Will Deacon
2015-09-04 11:13           ` Russell King - ARM Linux
2015-09-05 14:54             ` Jun Nie
2015-09-04 16:15           ` Greg Kroah-Hartman
2015-09-04 16:16             ` Will Deacon
2015-09-05 14:42         ` Jun Nie
2015-09-09 19:54           ` Greg Kroah-Hartman
     [not found]             ` <CAKU3ayWkXxmF1cp=fOAL6kNKY3wY1u=XhPROKiLqkx4oZ9xZ0g@mail.gmail.com>
2015-09-16  0:54               ` Jun Nie

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).