* [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra
@ 2016-01-12 10:33 Jon Hunter
[not found] ` <1452594809-17972-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Jon Hunter @ 2016-01-12 10:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Frank Rowand, Grant Likely,
Arnd Bergmann
Cc: paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter
For Tegra the early console is support by passing the console information
via the boot parameter earlycon. This series allows us to use the
device-tree "stdout-path" property for early console (as well as the
console) on Tegra.
Jon Hunter (3):
serial: earlycon: Add device-tree support for other IO types
serial: 8250_early: Add support for regshift
serial: 8250_early: Add earlycon support for Tegra
drivers/of/fdt.c | 26 +++++++++++++++++++++++-
drivers/tty/serial/8250/8250_early.c | 38 ++++++++++++++++++++++++++----------
drivers/tty/serial/earlycon.c | 6 ++++--
include/linux/serial_core.h | 3 ++-
4 files changed, 59 insertions(+), 14 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] serial: earlycon: Add device-tree support for other IO types
[not found] ` <1452594809-17972-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-01-12 10:33 ` Jon Hunter
2016-01-12 10:33 ` [PATCH 2/3] serial: 8250_early: Add support for regshift Jon Hunter
` (3 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Jon Hunter @ 2016-01-12 10:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Frank Rowand, Grant Likely,
Arnd Bergmann
Cc: paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter
When early console are registered via device-tree, currently it is assumed
that the console iotype is UPIO_MEM and the regshift is 0. This is not the
case for all devices and so add support for reading the device-tree
properties "reg-io-width" and "reg-shift" so that the appropriate iotype
and regshift can be specified for a given device.
Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/of/fdt.c | 26 +++++++++++++++++++++++++-
drivers/tty/serial/earlycon.c | 6 ++++--
include/linux/serial_core.h | 3 ++-
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 655f79db7899..f69406e42631 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -827,7 +827,9 @@ static int __init early_init_dt_scan_chosen_serial(void)
return -ENODEV;
while (match->compatible[0]) {
+ const __be32 *prop;
u64 addr;
+ u8 iotype, regshift;
if (fdt_node_check_compatible(fdt, offset, match->compatible)) {
match++;
@@ -838,7 +840,29 @@ static int __init early_init_dt_scan_chosen_serial(void)
if (addr == OF_BAD_ADDR)
return -ENXIO;
- of_setup_earlycon(addr, match->data);
+ prop = fdt_getprop(fdt, offset, "reg-shift", NULL);
+ regshift = prop ? be32_to_cpup(prop) : 0;
+
+ prop = fdt_getprop(fdt, offset, "reg-io-width", NULL);
+ if (prop) {
+ switch (be32_to_cpup(prop)) {
+ case 1:
+ iotype = UPIO_MEM;
+ break;
+ case 2:
+ iotype = UPIO_MEM16;
+ break;
+ case 4:
+ iotype = UPIO_MEM32;
+ break;
+ default:
+ return -EINVAL;
+ }
+ } else {
+ iotype = UPIO_MEM;
+ }
+
+ of_setup_earlycon(addr, iotype, regshift, match->data);
return 0;
}
return -ENODEV;
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 3f2423690d01..2fd2f19d7091 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -204,17 +204,19 @@ static int __init param_setup_earlycon(char *buf)
}
early_param("earlycon", param_setup_earlycon);
-int __init of_setup_earlycon(unsigned long addr,
+int __init of_setup_earlycon(unsigned long addr, unsigned char iotype,
+ unsigned char regshift,
int (*setup)(struct earlycon_device *, const char *))
{
int err;
struct uart_port *port = &early_console_dev.port;
spin_lock_init(&port->lock);
- port->iotype = UPIO_MEM;
+ port->iotype = iotype;
port->mapbase = addr;
port->uartclk = BASE_BAUD * 16;
port->membase = earlycon_map(addr, SZ_4K);
+ port->regshift = regshift;
early_console_dev.con->data = &early_console_dev;
err = setup(&early_console_dev, NULL);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index e03d6ba5e5b4..e0e1c7ef2856 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -346,7 +346,8 @@ struct earlycon_id {
} __aligned(32);
extern int setup_earlycon(char *buf);
-extern int of_setup_earlycon(unsigned long addr,
+extern int of_setup_earlycon(unsigned long addr, unsigned char iotype,
+ unsigned char regshift,
int (*setup)(struct earlycon_device *, const char *));
#define EARLYCON_DECLARE(_name, func) \
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] serial: 8250_early: Add support for regshift
[not found] ` <1452594809-17972-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-01-12 10:33 ` [PATCH 1/3] serial: earlycon: Add device-tree support for other IO types Jon Hunter
@ 2016-01-12 10:33 ` Jon Hunter
[not found] ` <1452594809-17972-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-01-12 10:33 ` [PATCH 3/3] serial: 8250_early: Add earlycon support for Tegra Jon Hunter
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Jon Hunter @ 2016-01-12 10:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Frank Rowand, Grant Likely,
Arnd Bergmann
Cc: paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter
The 8250 early console assumes a default regshift for each iotype. This
does not work for all devices. For example, Tegra UARTs use a iotype of
UPIO_MEM with a regshift of 2 because the registers are 32-bit aligned
and permit byte access.
If the regshift is specified (for example, via device-tree), then use the
value provided and otherwise revert to the defaults assumed for each
iotype.
Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Please note that today for Tegra, early console is supported by passing
the boot parameter "earlycon=uart8250,mmio32,0xXXXXXXXX". While this works
and we could use UPIO_MEM32 for tegra, this would mean changing all the
DT source files for Tegra to add the "reg-io-width" property. IMO it seems
better to make early console for 8250 work in the same way as the normal
8250 console and support regshift.
drivers/tty/serial/8250/8250_early.c | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index af62131af21e..758054957788 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -41,15 +41,15 @@ static unsigned int __init serial8250_early_in(struct uart_port *port, int offse
{
switch (port->iotype) {
case UPIO_MEM:
- return readb(port->membase + offset);
+ return readb(port->membase + (offset << port->regshift));
case UPIO_MEM16:
- return readw(port->membase + (offset << 1));
+ return readw(port->membase + (offset << port->regshift));
case UPIO_MEM32:
- return readl(port->membase + (offset << 2));
+ return readl(port->membase + (offset << port->regshift));
case UPIO_MEM32BE:
- return ioread32be(port->membase + (offset << 2));
+ return ioread32be(port->membase + (offset << port->regshift));
case UPIO_PORT:
- return inb(port->iobase + offset);
+ return inb(port->iobase + (offset << port->regshift));
default:
return 0;
}
@@ -59,19 +59,19 @@ static void __init serial8250_early_out(struct uart_port *port, int offset, int
{
switch (port->iotype) {
case UPIO_MEM:
- writeb(value, port->membase + offset);
+ writeb(value, port->membase + (offset << port->regshift));
break;
case UPIO_MEM16:
- writew(value, port->membase + (offset << 1));
+ writew(value, port->membase + (offset << port->regshift));
break;
case UPIO_MEM32:
- writel(value, port->membase + (offset << 2));
+ writel(value, port->membase + (offset << port->regshift));
break;
case UPIO_MEM32BE:
- iowrite32be(value, port->membase + (offset << 2));
+ iowrite32be(value, port->membase + (offset << port->regshift));
break;
case UPIO_PORT:
- outb(value, port->iobase + offset);
+ outb(value, port->iobase + (offset << port->regshift));
break;
}
}
@@ -128,6 +128,22 @@ int __init early_serial8250_setup(struct earlycon_device *device,
if (!(device->port.membase || device->port.iobase))
return -ENODEV;
+ /*
+ * If regshift is not specified, then assume the
+ * following defaults for the below iotypes.
+ */
+ if (!device->port.regshift) {
+ switch (device->port.iotype) {
+ case UPIO_MEM16:
+ device->port.regshift = 1;
+ break;
+ case UPIO_MEM32:
+ case UPIO_MEM32BE:
+ device->port.regshift = 2;
+ break;
+ }
+ }
+
if (!device->baud) {
struct uart_port *port = &device->port;
unsigned int ier;
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] serial: 8250_early: Add earlycon support for Tegra
[not found] ` <1452594809-17972-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-01-12 10:33 ` [PATCH 1/3] serial: earlycon: Add device-tree support for other IO types Jon Hunter
2016-01-12 10:33 ` [PATCH 2/3] serial: 8250_early: Add support for regshift Jon Hunter
@ 2016-01-12 10:33 ` Jon Hunter
2016-01-12 10:56 ` [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra Arnd Bergmann
2016-01-13 16:03 ` Thierry Reding
4 siblings, 0 replies; 11+ messages in thread
From: Jon Hunter @ 2016-01-12 10:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rob Herring, Frank Rowand, Grant Likely,
Arnd Bergmann
Cc: paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jon Hunter
Declare an OF early console for Tegra so that the early console device
can be specified via the "stdout-path" property in device-tree.
Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/tty/serial/8250/8250_early.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index 758054957788..23283a1392a8 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -161,3 +161,5 @@ EARLYCON_DECLARE(uart8250, early_serial8250_setup);
EARLYCON_DECLARE(uart, early_serial8250_setup);
OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup);
OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup);
+OF_EARLYCON_DECLARE(tegra20_uart, "nvidia,tegra20-uart",
+ early_serial8250_setup);
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra
[not found] ` <1452594809-17972-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
` (2 preceding siblings ...)
2016-01-12 10:33 ` [PATCH 3/3] serial: 8250_early: Add earlycon support for Tegra Jon Hunter
@ 2016-01-12 10:56 ` Arnd Bergmann
2016-01-13 16:03 ` Thierry Reding
4 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2016-01-12 10:56 UTC (permalink / raw)
To: Jon Hunter
Cc: Greg Kroah-Hartman, Rob Herring, Frank Rowand, Grant Likely,
paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On Tuesday 12 January 2016 10:33:26 Jon Hunter wrote:
> For Tegra the early console is support by passing the console information
> via the boot parameter earlycon. This series allows us to use the
> device-tree "stdout-path" property for early console (as well as the
> console) on Tegra.
>
Hi Jon,
I like this version, nice work!
Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] serial: 8250_early: Add support for regshift
[not found] ` <1452594809-17972-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-01-12 16:15 ` Peter Hurley
[not found] ` <569526B1.3030000-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Peter Hurley @ 2016-01-12 16:15 UTC (permalink / raw)
To: Jon Hunter, Greg Kroah-Hartman, Rob Herring, Frank Rowand,
Grant Likely, Arnd Bergmann
Cc: paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
Hi Jon,
On 01/12/2016 02:33 AM, Jon Hunter wrote:
> The 8250 early console assumes a default regshift for each iotype. This
> does not work for all devices. For example, Tegra UARTs use a iotype of
> UPIO_MEM with a regshift of 2 because the registers are 32-bit aligned
> and permit byte access.
>
> If the regshift is specified (for example, via device-tree), then use the
> value provided and otherwise revert to the defaults assumed for each
> iotype.
>
> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> Please note that today for Tegra, early console is supported by passing
> the boot parameter "earlycon=uart8250,mmio32,0xXXXXXXXX". While this works
> and we could use UPIO_MEM32 for tegra, this would mean changing all the
> DT source files for Tegra to add the "reg-io-width" property. IMO it seems
> better to make early console for 8250 work in the same way as the normal
> 8250 console and support regshift.
>
> drivers/tty/serial/8250/8250_early.c | 36 ++++++++++++++++++++++++++----------
> 1 file changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
> index af62131af21e..758054957788 100644
> --- a/drivers/tty/serial/8250/8250_early.c
> +++ b/drivers/tty/serial/8250/8250_early.c
> @@ -41,15 +41,15 @@ static unsigned int __init serial8250_early_in(struct uart_port *port, int offse
> {
> switch (port->iotype) {
> case UPIO_MEM:
> - return readb(port->membase + offset);
> + return readb(port->membase + (offset << port->regshift));
> case UPIO_MEM16:
> - return readw(port->membase + (offset << 1));
> + return readw(port->membase + (offset << port->regshift));
> case UPIO_MEM32:
> - return readl(port->membase + (offset << 2));
> + return readl(port->membase + (offset << port->regshift));
> case UPIO_MEM32BE:
> - return ioread32be(port->membase + (offset << 2));
> + return ioread32be(port->membase + (offset << port->regshift));
> case UPIO_PORT:
> - return inb(port->iobase + offset);
> + return inb(port->iobase + (offset << port->regshift));
> default:
> return 0;
> }
> @@ -59,19 +59,19 @@ static void __init serial8250_early_out(struct uart_port *port, int offset, int
> {
> switch (port->iotype) {
> case UPIO_MEM:
> - writeb(value, port->membase + offset);
> + writeb(value, port->membase + (offset << port->regshift));
> break;
> case UPIO_MEM16:
> - writew(value, port->membase + (offset << 1));
> + writew(value, port->membase + (offset << port->regshift));
> break;
> case UPIO_MEM32:
> - writel(value, port->membase + (offset << 2));
> + writel(value, port->membase + (offset << port->regshift));
> break;
> case UPIO_MEM32BE:
> - iowrite32be(value, port->membase + (offset << 2));
> + iowrite32be(value, port->membase + (offset << port->regshift));
> break;
> case UPIO_PORT:
> - outb(value, port->iobase + offset);
> + outb(value, port->iobase + (offset << port->regshift));
> break;
> }
> }
> @@ -128,6 +128,22 @@ int __init early_serial8250_setup(struct earlycon_device *device,
> if (!(device->port.membase || device->port.iobase))
> return -ENODEV;
>
> + /*
> + * If regshift is not specified, then assume the
> + * following defaults for the below iotypes.
> + */
> + if (!device->port.regshift) {
> + switch (device->port.iotype) {
> + case UPIO_MEM16:
> + device->port.regshift = 1;
> + break;
> + case UPIO_MEM32:
> + case UPIO_MEM32BE:
> + device->port.regshift = 2;
> + break;
> + }
> + }
Since the earlycon command line parsing sets port->regshift, the only possible
path requiring defaults would be DT, but 8250 DT should not have default
regshift based on the iotype; the 8250 port driver doesn't.
Regards,
Peter Hurley
> +
> if (!device->baud) {
> struct uart_port *port = &device->port;
> unsigned int ier;
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] serial: 8250_early: Add support for regshift
[not found] ` <569526B1.3030000-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
@ 2016-01-12 18:28 ` Jon Hunter
[not found] ` <569545B8.5000200-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Jon Hunter @ 2016-01-12 18:28 UTC (permalink / raw)
To: Peter Hurley, Greg Kroah-Hartman, Rob Herring, Frank Rowand,
Grant Likely, Arnd Bergmann
Cc: paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
Hi Peter,
On 12/01/16 16:15, Peter Hurley wrote:
> Hi Jon,
>
> On 01/12/2016 02:33 AM, Jon Hunter wrote:
>> The 8250 early console assumes a default regshift for each iotype. This
>> does not work for all devices. For example, Tegra UARTs use a iotype of
>> UPIO_MEM with a regshift of 2 because the registers are 32-bit aligned
>> and permit byte access.
>>
>> If the regshift is specified (for example, via device-tree), then use the
>> value provided and otherwise revert to the defaults assumed for each
>> iotype.
>>
>> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>> ---
>> Please note that today for Tegra, early console is supported by passing
>> the boot parameter "earlycon=uart8250,mmio32,0xXXXXXXXX". While this works
>> and we could use UPIO_MEM32 for tegra, this would mean changing all the
>> DT source files for Tegra to add the "reg-io-width" property. IMO it seems
>> better to make early console for 8250 work in the same way as the normal
>> 8250 console and support regshift.
>>
>> drivers/tty/serial/8250/8250_early.c | 36 ++++++++++++++++++++++++++----------
>> 1 file changed, 26 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
>> index af62131af21e..758054957788 100644
>> --- a/drivers/tty/serial/8250/8250_early.c
>> +++ b/drivers/tty/serial/8250/8250_early.c
>> @@ -41,15 +41,15 @@ static unsigned int __init serial8250_early_in(struct uart_port *port, int offse
>> {
>> switch (port->iotype) {
>> case UPIO_MEM:
>> - return readb(port->membase + offset);
>> + return readb(port->membase + (offset << port->regshift));
>> case UPIO_MEM16:
>> - return readw(port->membase + (offset << 1));
>> + return readw(port->membase + (offset << port->regshift));
>> case UPIO_MEM32:
>> - return readl(port->membase + (offset << 2));
>> + return readl(port->membase + (offset << port->regshift));
>> case UPIO_MEM32BE:
>> - return ioread32be(port->membase + (offset << 2));
>> + return ioread32be(port->membase + (offset << port->regshift));
>> case UPIO_PORT:
>> - return inb(port->iobase + offset);
>> + return inb(port->iobase + (offset << port->regshift));
>> default:
>> return 0;
>> }
>> @@ -59,19 +59,19 @@ static void __init serial8250_early_out(struct uart_port *port, int offset, int
>> {
>> switch (port->iotype) {
>> case UPIO_MEM:
>> - writeb(value, port->membase + offset);
>> + writeb(value, port->membase + (offset << port->regshift));
>> break;
>> case UPIO_MEM16:
>> - writew(value, port->membase + (offset << 1));
>> + writew(value, port->membase + (offset << port->regshift));
>> break;
>> case UPIO_MEM32:
>> - writel(value, port->membase + (offset << 2));
>> + writel(value, port->membase + (offset << port->regshift));
>> break;
>> case UPIO_MEM32BE:
>> - iowrite32be(value, port->membase + (offset << 2));
>> + iowrite32be(value, port->membase + (offset << port->regshift));
>> break;
>> case UPIO_PORT:
>> - outb(value, port->iobase + offset);
>> + outb(value, port->iobase + (offset << port->regshift));
>> break;
>> }
>> }
>> @@ -128,6 +128,22 @@ int __init early_serial8250_setup(struct earlycon_device *device,
>> if (!(device->port.membase || device->port.iobase))
>> return -ENODEV;
>>
>> + /*
>> + * If regshift is not specified, then assume the
>> + * following defaults for the below iotypes.
>> + */
>> + if (!device->port.regshift) {
>> + switch (device->port.iotype) {
>> + case UPIO_MEM16:
>> + device->port.regshift = 1;
>> + break;
>> + case UPIO_MEM32:
>> + case UPIO_MEM32BE:
>> + device->port.regshift = 2;
>> + break;
>> + }
>> + }
>
> Since the earlycon command line parsing sets port->regshift, the only possible
> path requiring defaults would be DT, but 8250 DT should not have default
> regshift based on the iotype; the 8250 port driver doesn't.
Ah, I see, I missed that. However, for command line parsing, I only see
regshift being set to 2 for mmio32 (and I guess it will be 0 otherwise).
Is mmio16 not supported for command line parsing?
Ok, I will drop the above hunk.
Cheers
Jon
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] serial: 8250_early: Add support for regshift
[not found] ` <569545B8.5000200-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-01-12 18:43 ` Peter Hurley
0 siblings, 0 replies; 11+ messages in thread
From: Peter Hurley @ 2016-01-12 18:43 UTC (permalink / raw)
To: Jon Hunter, Greg Kroah-Hartman, Rob Herring, Frank Rowand,
Grant Likely, Arnd Bergmann
Cc: paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On 01/12/2016 10:28 AM, Jon Hunter wrote:
> Hi Peter,
>
> On 12/01/16 16:15, Peter Hurley wrote:
>> Hi Jon,
>>
>> On 01/12/2016 02:33 AM, Jon Hunter wrote:
>>> The 8250 early console assumes a default regshift for each iotype. This
>>> does not work for all devices. For example, Tegra UARTs use a iotype of
>>> UPIO_MEM with a regshift of 2 because the registers are 32-bit aligned
>>> and permit byte access.
>>>
>>> If the regshift is specified (for example, via device-tree), then use the
>>> value provided and otherwise revert to the defaults assumed for each
>>> iotype.
>>>
>>> Signed-off-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>> ---
>>> Please note that today for Tegra, early console is supported by passing
>>> the boot parameter "earlycon=uart8250,mmio32,0xXXXXXXXX". While this works
>>> and we could use UPIO_MEM32 for tegra, this would mean changing all the
>>> DT source files for Tegra to add the "reg-io-width" property. IMO it seems
>>> better to make early console for 8250 work in the same way as the normal
>>> 8250 console and support regshift.
>>>
>>> drivers/tty/serial/8250/8250_early.c | 36 ++++++++++++++++++++++++++----------
>>> 1 file changed, 26 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
>>> index af62131af21e..758054957788 100644
>>> --- a/drivers/tty/serial/8250/8250_early.c
>>> +++ b/drivers/tty/serial/8250/8250_early.c
>>> @@ -41,15 +41,15 @@ static unsigned int __init serial8250_early_in(struct uart_port *port, int offse
>>> {
>>> switch (port->iotype) {
>>> case UPIO_MEM:
>>> - return readb(port->membase + offset);
>>> + return readb(port->membase + (offset << port->regshift));
>>> case UPIO_MEM16:
>>> - return readw(port->membase + (offset << 1));
>>> + return readw(port->membase + (offset << port->regshift));
>>> case UPIO_MEM32:
>>> - return readl(port->membase + (offset << 2));
>>> + return readl(port->membase + (offset << port->regshift));
>>> case UPIO_MEM32BE:
>>> - return ioread32be(port->membase + (offset << 2));
>>> + return ioread32be(port->membase + (offset << port->regshift));
>>> case UPIO_PORT:
>>> - return inb(port->iobase + offset);
>>> + return inb(port->iobase + (offset << port->regshift));
>>> default:
>>> return 0;
>>> }
>>> @@ -59,19 +59,19 @@ static void __init serial8250_early_out(struct uart_port *port, int offset, int
>>> {
>>> switch (port->iotype) {
>>> case UPIO_MEM:
>>> - writeb(value, port->membase + offset);
>>> + writeb(value, port->membase + (offset << port->regshift));
>>> break;
>>> case UPIO_MEM16:
>>> - writew(value, port->membase + (offset << 1));
>>> + writew(value, port->membase + (offset << port->regshift));
>>> break;
>>> case UPIO_MEM32:
>>> - writel(value, port->membase + (offset << 2));
>>> + writel(value, port->membase + (offset << port->regshift));
>>> break;
>>> case UPIO_MEM32BE:
>>> - iowrite32be(value, port->membase + (offset << 2));
>>> + iowrite32be(value, port->membase + (offset << port->regshift));
>>> break;
>>> case UPIO_PORT:
>>> - outb(value, port->iobase + offset);
>>> + outb(value, port->iobase + (offset << port->regshift));
>>> break;
>>> }
>>> }
>>> @@ -128,6 +128,22 @@ int __init early_serial8250_setup(struct earlycon_device *device,
>>> if (!(device->port.membase || device->port.iobase))
>>> return -ENODEV;
>>>
>>> + /*
>>> + * If regshift is not specified, then assume the
>>> + * following defaults for the below iotypes.
>>> + */
>>> + if (!device->port.regshift) {
>>> + switch (device->port.iotype) {
>>> + case UPIO_MEM16:
>>> + device->port.regshift = 1;
>>> + break;
>>> + case UPIO_MEM32:
>>> + case UPIO_MEM32BE:
>>> + device->port.regshift = 2;
>>> + break;
>>> + }
>>> + }
>>
>> Since the earlycon command line parsing sets port->regshift, the only possible
>> path requiring defaults would be DT, but 8250 DT should not have default
>> regshift based on the iotype; the 8250 port driver doesn't.
>
> Ah, I see, I missed that. However, for command line parsing, I only see
> regshift being set to 2 for mmio32 (and I guess it will be 0 otherwise).
Exactly. Currently unrepresented is 8-bit wide, 32-bit aligned mmio.
> Is mmio16 not supported for command line parsing?
In Greg's tty-next branch @
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
commit bd94c4077a0b2ecc35562c294f80f3659ecd8499
Author: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
Date: Wed Oct 28 12:46:05 2015 +0900
serial: support 16-bit register interface for console
Currently, 8-bit (MMIO) and 32-bit (MMIO32) register interfaces are
supported for the 8250 console, but the 16-bit (MMIO16) is not.
The 8250 UART device on my board is connected to a 16-bit bus and
my main motivation is to use earlycon with it.
(Refer to arch/arm/boot/dts/uniphier-support-card.dtsi)
Signed-off-by: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
Reviewed-by: Peter Hurley <peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Regards,
Peter Hurley
> Ok, I will drop the above hunk.
>
> Cheers
> Jon
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra
[not found] ` <1452594809-17972-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
` (3 preceding siblings ...)
2016-01-12 10:56 ` [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra Arnd Bergmann
@ 2016-01-13 16:03 ` Thierry Reding
2016-01-13 17:21 ` Jon Hunter
4 siblings, 1 reply; 11+ messages in thread
From: Thierry Reding @ 2016-01-13 16:03 UTC (permalink / raw)
To: Jon Hunter
Cc: Greg Kroah-Hartman, Rob Herring, Frank Rowand, Grant Likely,
Arnd Bergmann, paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]
On Tue, Jan 12, 2016 at 10:33:26AM +0000, Jon Hunter wrote:
> For Tegra the early console is support by passing the console information
> via the boot parameter earlycon. This series allows us to use the
> device-tree "stdout-path" property for early console (as well as the
> console) on Tegra.
>
> Jon Hunter (3):
> serial: earlycon: Add device-tree support for other IO types
> serial: 8250_early: Add support for regshift
> serial: 8250_early: Add earlycon support for Tegra
>
> drivers/of/fdt.c | 26 +++++++++++++++++++++++-
> drivers/tty/serial/8250/8250_early.c | 38 ++++++++++++++++++++++++++----------
> drivers/tty/serial/earlycon.c | 6 ++++--
> include/linux/serial_core.h | 3 ++-
> 4 files changed, 59 insertions(+), 14 deletions(-)
The series:
Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Jon, do you have plans on adding the stdout-path properties to existing
device tree files?
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra
2016-01-13 16:03 ` Thierry Reding
@ 2016-01-13 17:21 ` Jon Hunter
[not found] ` <569687B2.9090609-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Jon Hunter @ 2016-01-13 17:21 UTC (permalink / raw)
To: Thierry Reding
Cc: Greg Kroah-Hartman, Rob Herring, Frank Rowand, Grant Likely,
Arnd Bergmann, paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On 13/01/16 16:03, Thierry Reding wrote:
> * PGP Signed by an unknown key
>
> On Tue, Jan 12, 2016 at 10:33:26AM +0000, Jon Hunter wrote:
>> For Tegra the early console is support by passing the console information
>> via the boot parameter earlycon. This series allows us to use the
>> device-tree "stdout-path" property for early console (as well as the
>> console) on Tegra.
>>
>> Jon Hunter (3):
>> serial: earlycon: Add device-tree support for other IO types
>> serial: 8250_early: Add support for regshift
>> serial: 8250_early: Add earlycon support for Tegra
>>
>> drivers/of/fdt.c | 26 +++++++++++++++++++++++-
>> drivers/tty/serial/8250/8250_early.c | 38 ++++++++++++++++++++++++++----------
>> drivers/tty/serial/earlycon.c | 6 ++++--
>> include/linux/serial_core.h | 3 ++-
>> 4 files changed, 59 insertions(+), 14 deletions(-)
>
> The series:
>
> Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Thanks. However, Peter Hurley also has a series he just refreshed from
early last year that includes similar changes to patches 1 and 2 [0]. So
I will probably drop these and just re-post patch 3 once his series is
merged.
> Jon, do you have plans on adding the stdout-path properties to existing
> device tree files?
I think that it would be a good idea and so I could include that in a
series with patch #3.
Cheers
Jon
[0] http://marc.info/?t=145262776100005&r=1&w=2
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra
[not found] ` <569687B2.9090609-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-01-13 17:32 ` Thierry Reding
0 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2016-01-13 17:32 UTC (permalink / raw)
To: Jon Hunter
Cc: Greg Kroah-Hartman, Rob Herring, Frank Rowand, Grant Likely,
Arnd Bergmann, paul.burton-1AXoQHu6uovQT0dZR+AlfA, Mark Rutland,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]
On Wed, Jan 13, 2016 at 05:21:54PM +0000, Jon Hunter wrote:
>
> On 13/01/16 16:03, Thierry Reding wrote:
> > * PGP Signed by an unknown key
> >
> > On Tue, Jan 12, 2016 at 10:33:26AM +0000, Jon Hunter wrote:
> >> For Tegra the early console is support by passing the console information
> >> via the boot parameter earlycon. This series allows us to use the
> >> device-tree "stdout-path" property for early console (as well as the
> >> console) on Tegra.
> >>
> >> Jon Hunter (3):
> >> serial: earlycon: Add device-tree support for other IO types
> >> serial: 8250_early: Add support for regshift
> >> serial: 8250_early: Add earlycon support for Tegra
> >>
> >> drivers/of/fdt.c | 26 +++++++++++++++++++++++-
> >> drivers/tty/serial/8250/8250_early.c | 38 ++++++++++++++++++++++++++----------
> >> drivers/tty/serial/earlycon.c | 6 ++++--
> >> include/linux/serial_core.h | 3 ++-
> >> 4 files changed, 59 insertions(+), 14 deletions(-)
> >
> > The series:
> >
> > Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> Thanks. However, Peter Hurley also has a series he just refreshed from
> early last year that includes similar changes to patches 1 and 2 [0]. So
> I will probably drop these and just re-post patch 3 once his series is
> merged.
Okay, sounds fine.
> > Jon, do you have plans on adding the stdout-path properties to existing
> > device tree files?
>
> I think that it would be a good idea and so I could include that in a
> series with patch #3.
Sounds good.
Thanks,
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-01-13 17:32 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-12 10:33 [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra Jon Hunter
[not found] ` <1452594809-17972-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-01-12 10:33 ` [PATCH 1/3] serial: earlycon: Add device-tree support for other IO types Jon Hunter
2016-01-12 10:33 ` [PATCH 2/3] serial: 8250_early: Add support for regshift Jon Hunter
[not found] ` <1452594809-17972-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-01-12 16:15 ` Peter Hurley
[not found] ` <569526B1.3030000-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2016-01-12 18:28 ` Jon Hunter
[not found] ` <569545B8.5000200-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-01-12 18:43 ` Peter Hurley
2016-01-12 10:33 ` [PATCH 3/3] serial: 8250_early: Add earlycon support for Tegra Jon Hunter
2016-01-12 10:56 ` [PATCH 0/3] serial: earlycon: Add device-tree support for earlycon on Tegra Arnd Bergmann
2016-01-13 16:03 ` Thierry Reding
2016-01-13 17:21 ` Jon Hunter
[not found] ` <569687B2.9090609-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-01-13 17:32 ` Thierry Reding
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.