All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
@ 2015-11-07  0:18 ` Timur Tabi
  0 siblings, 0 replies; 14+ messages in thread
From: Timur Tabi @ 2015-11-07  0:18 UTC (permalink / raw)
  To: linux-serial, linux-arm-kernel, Andrew.Jackson, andre.przywara,
	jun.nie, peter, Linus Walleij, Greg Kroah-Hartman, jslaby,
	rmk+kernel

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

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)
 		;
 }
 
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
@ 2015-11-07  0:18 ` Timur Tabi
  0 siblings, 0 replies; 14+ messages in thread
From: Timur Tabi @ 2015-11-07  0:18 UTC (permalink / raw)
  To: linux-arm-kernel

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

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)
 		;
 }
 
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* Re: [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
  2015-11-07  0:18 ` Timur Tabi
@ 2015-12-13  6:06   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2015-12-13  6:06 UTC (permalink / raw)
  To: Timur Tabi
  Cc: peter, andre.przywara, Linus Walleij, Andrew.Jackson,
	linux-serial, jslaby, rmk+kernel, jun.nie, linux-arm-kernel

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

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

* [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
@ 2015-12-13  6:06   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2015-12-13  6:06 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* Re: [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
  2015-12-13  6:06   ` Greg Kroah-Hartman
@ 2015-12-13 15:34     ` Timur Tabi
  -1 siblings, 0 replies; 14+ messages in thread
From: Timur Tabi @ 2015-12-13 15:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: peter, andre.przywara, Linus Walleij, Andrew.Jackson,
	linux-serial, jslaby, rmk+kernel, jun.nie, linux-arm-kernel

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.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

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

* [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
@ 2015-12-13 15:34     ` Timur Tabi
  0 siblings, 0 replies; 14+ messages in thread
From: Timur Tabi @ 2015-12-13 15:34 UTC (permalink / raw)
  To: linux-arm-kernel

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.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

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

* Re: [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
  2015-12-13  6:06   ` Greg Kroah-Hartman
@ 2015-12-17 15:55     ` Timur Tabi
  -1 siblings, 0 replies; 14+ messages in thread
From: Timur Tabi @ 2015-12-17 15:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Peter Hurley, Andre Przywara, Timur Tabi, Andrew Jackson, cov,
	linux-serial, jslaby, Russell King, Jun Nie, Linus Walleij,
	linux-arm-kernel

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.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
@ 2015-12-17 15:55     ` Timur Tabi
  0 siblings, 0 replies; 14+ messages in thread
From: Timur Tabi @ 2015-12-17 15:55 UTC (permalink / raw)
  To: linux-arm-kernel

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.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

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

* Re: [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
  2015-12-17 15:55     ` Timur Tabi
@ 2015-12-17 16:27       ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2015-12-17 16:27 UTC (permalink / raw)
  To: Timur Tabi
  Cc: Peter Hurley, Andre Przywara, Linus Walleij, Andrew Jackson, cov,
	linux-serial, jslaby, Russell King, Jun Nie, linux-arm-kernel

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

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

* [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
@ 2015-12-17 16:27       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2015-12-17 16:27 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* Re: [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
  2015-12-17 16:27       ` Greg Kroah-Hartman
@ 2015-12-17 16:47         ` Timur Tabi
  -1 siblings, 0 replies; 14+ messages in thread
From: Timur Tabi @ 2015-12-17 16:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Peter Hurley, Andre Przywara, Linus Walleij, Andrew Jackson, cov,
	linux-serial, jslaby, Russell King, Jun Nie, linux-arm-kernel

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.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

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

* [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
@ 2015-12-17 16:47         ` Timur Tabi
  0 siblings, 0 replies; 14+ messages in thread
From: Timur Tabi @ 2015-12-17 16:47 UTC (permalink / raw)
  To: linux-arm-kernel

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.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

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

* Re: [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
  2015-12-17 16:47         ` Timur Tabi
@ 2015-12-17 17:06           ` Peter Hurley
  -1 siblings, 0 replies; 14+ messages in thread
From: Peter Hurley @ 2015-12-17 17:06 UTC (permalink / raw)
  To: Timur Tabi, Greg Kroah-Hartman
  Cc: Andre Przywara, Linus Walleij, Andrew Jackson, cov, linux-serial,
	jslaby, Russell King, Jun Nie, linux-arm-kernel

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

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

* [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon
@ 2015-12-17 17:06           ` Peter Hurley
  0 siblings, 0 replies; 14+ messages in thread
From: Peter Hurley @ 2015-12-17 17:06 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

end of thread, other threads:[~2015-12-17 17:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07  0:18 [PATCH] tty: amba-pl011: add support for 32-bit register access for earlycon Timur Tabi
2015-11-07  0:18 ` Timur Tabi
2015-12-13  6:06 ` Greg Kroah-Hartman
2015-12-13  6:06   ` Greg Kroah-Hartman
2015-12-13 15:34   ` Timur Tabi
2015-12-13 15:34     ` Timur Tabi
2015-12-17 15:55   ` Timur Tabi
2015-12-17 15:55     ` Timur Tabi
2015-12-17 16:27     ` Greg Kroah-Hartman
2015-12-17 16:27       ` Greg Kroah-Hartman
2015-12-17 16:47       ` Timur Tabi
2015-12-17 16:47         ` Timur Tabi
2015-12-17 17:06         ` Peter Hurley
2015-12-17 17:06           ` Peter Hurley

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.