diff mbox

tty: amba-pl011: add support for 32-bit register access for earlycon

Message ID 1446855503-25881-1-git-send-email-timur@codeaurora.org (mailing list archive)
State New, archived
Headers show

Commit Message

Timur Tabi Nov. 7, 2015, 12:18 a.m. UTC
Add support the "mmio32" earlycon option for the pl011 device.  If
specified in the earlycon parameter, all reads/writes to pl011 registers
during early console will use 32-bit accessors.  Normally the function
uses 8-bit writes.

Normal console uses the "access_32b" field of the vendor data structure
to determine whether the registers needs 32-bit accessors.  Early console
is used before the vendor data is available, so we need a different
mechanism to choose the accessor.

Example:

	earlycon=pl011,mmio32,0x3ced1000

Signed-off-by: Timur Tabi <timur@codeaurora.org>
---

This patch applies on top of Russell's 12-part amba-pl011.c patchset.

 Documentation/kernel-parameters.txt | 5 ++++-
 drivers/tty/serial/amba-pl011.c     | 9 ++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

Comments

Greg KH Dec. 13, 2015, 6:06 a.m. UTC | #1
On Fri, Nov 06, 2015 at 06:18:23PM -0600, Timur Tabi wrote:
> Add support the "mmio32" earlycon option for the pl011 device.  If
> specified in the earlycon parameter, all reads/writes to pl011 registers
> during early console will use 32-bit accessors.  Normally the function
> uses 8-bit writes.
> 
> Normal console uses the "access_32b" field of the vendor data structure
> to determine whether the registers needs 32-bit accessors.  Early console
> is used before the vendor data is available, so we need a different
> mechanism to choose the accessor.
> 
> Example:
> 
> 	earlycon=pl011,mmio32,0x3ced1000
> 
> Signed-off-by: Timur Tabi <timur@codeaurora.org>
> ---
> 
> This patch applies on top of Russell's 12-part amba-pl011.c patchset.

Which I didn't apply, so can you resend this after he resends his?

thanks,

greg k-h
Timur Tabi Dec. 13, 2015, 3:34 p.m. UTC | #2
Greg Kroah-Hartman wrote:
>> >
>> >Example:
>> >
>> >	earlycon=pl011,mmio32,0x3ced1000
>> >
>> >Signed-off-by: Timur Tabi<timur@codeaurora.org>
>> >---
>> >
>> >This patch applies on top of Russell's 12-part amba-pl011.c patchset.
> Which I didn't apply, so can you resend this after he resends his?

Yes, I will resend all of my pl011-releated patches after Russell's 
patches are reworked and accepted.
Timur Tabi Dec. 17, 2015, 3:55 p.m. UTC | #3
On Sun, Dec 13, 2015 at 12:06 AM, Greg Kroah-Hartman <greg@kroah.com> wrote:

>> Example:
>>
>>       earlycon=pl011,mmio32,0x3ced1000
>>
>> Signed-off-by: Timur Tabi <timur@codeaurora.org>
>> ---
>>
>> This patch applies on top of Russell's 12-part amba-pl011.c patchset.
>
> Which I didn't apply, so can you resend this after he resends his?

I see that some of Russell's patches are now in tty-next.  Does that
make them official?  There was some disagreement about the usage of
access_32b vs uap->port.iotype for determining whether we need 32-bit
accessors or not.
Greg KH Dec. 17, 2015, 4:27 p.m. UTC | #4
On Thu, Dec 17, 2015 at 09:55:30AM -0600, Timur Tabi wrote:
> On Sun, Dec 13, 2015 at 12:06 AM, Greg Kroah-Hartman <greg@kroah.com> wrote:
> 
> >> Example:
> >>
> >>       earlycon=pl011,mmio32,0x3ced1000
> >>
> >> Signed-off-by: Timur Tabi <timur@codeaurora.org>
> >> ---
> >>
> >> This patch applies on top of Russell's 12-part amba-pl011.c patchset.
> >
> > Which I didn't apply, so can you resend this after he resends his?
> 
> I see that some of Russell's patches are now in tty-next.  Does that
> make them official?

Unless Russell asks me to revert them, they will show up in the next
merge window.

> There was some disagreement about the usage of
> access_32b vs uap->port.iotype for determining whether we need 32-bit
> accessors or not.

There was?  I missed that, please send follow-on patches to resolve the
issue if there is one.

thanks,

greg k-h
Timur Tabi Dec. 17, 2015, 4:47 p.m. UTC | #5
Greg Kroah-Hartman wrote:
>> >There was some disagreement about the usage of
>> >access_32b vs uap->port.iotype for determining whether we need 32-bit
>> >accessors or not.
> There was?  I missed that, please send follow-on patches to resolve the
> issue if there is one.

I can submit a patch that provides an alternative implementation, but 
I'm pretty sure Russell won't like it.

For reference:

http://www.spinics.net/lists/linux-serial/msg19710.html

Russell said that UPIO_MEM is supposed to be literally only 8-bit 
access, but then Peter Hurley posted this:

http://www.spinics.net/lists/linux-serial/msg19930.html

which you applied.  So my patch would remove access_32b and use 
UPIO_MEM32/UPIO_MEM instead.  It would be a little weird having both 
patches in your tree, I guess.
Peter Hurley Dec. 17, 2015, 5:06 p.m. UTC | #6
On 12/17/2015 08:47 AM, Timur Tabi wrote:
> Greg Kroah-Hartman wrote:
>>> >There was some disagreement about the usage of
>>> >access_32b vs uap->port.iotype for determining whether we need 32-bit
>>> >accessors or not.
>> There was?  I missed that, please send follow-on patches to resolve the
>> issue if there is one.
> 
> I can submit a patch that provides an alternative implementation, but I'm pretty sure Russell won't like it.
> 
> For reference:
> 
> http://www.spinics.net/lists/linux-serial/msg19710.html
> 
> Russell said that UPIO_MEM is supposed to be literally only 8-bit access, but then Peter Hurley posted this:
> 
> http://www.spinics.net/lists/linux-serial/msg19930.html
> 
> which you applied.  So my patch would remove access_32b and use UPIO_MEM32/UPIO_MEM instead.  It would be a little weird having both patches in your tree, I guess.

I think it'll be ok if you just send a patch to use UPIO_MEM32
instead; I think that situation mostly had to do with inertia
and not wanting to rebase a series like that (which I can
appreciate).

The worst that happens is Russell objects, but I think there's a
good case for the simpler UPIO_MEM32 usage, which plays nice
with earlycon.

Regards,
Peter Hurley
diff mbox

Patch

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 22a4b68..2436f62 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -992,10 +992,13 @@  bytes respectively. Such letter suffixes can also be entirely omitted.
 			unspecified, the h/w is not initialized.
 
 		pl011,<addr>
+		pl011,mmio32,<addr>
 			Start an early, polled-mode console on a pl011 serial
 			port at the specified address. The pl011 serial port
 			must already be setup and configured. Options are not
-			yet supported.
+			yet supported.  If 'mmio32' is specified, then only
+			the driver will use only 32-bit accessors to read/write
+			the device registers.
 
 		msm_serial,<addr>
 			Start an early, polled-mode console on an msm serial
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 373b152..6643ed9 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2301,10 +2301,13 @@  static struct console amba_console = {
 
 static void pl011_putc(struct uart_port *port, int c)
 {
-	while (readl(port->membase + REG_FR) & UART01x_FR_TXFF)
+	while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF)
 		;
-	writeb(c, port->membase + REG_DR);
-	while (readl(port->membase + REG_FR) & UART01x_FR_BUSY)
+	if (port->iotype == UPIO_MEM32)
+		writel(c, port->membase + UART01x_DR);
+	else
+		writeb(c, port->membase + UART01x_DR);
+	while (readl(port->membase + UART01x_FR) & UART01x_FR_BUSY)
 		;
 }