tty: serial: print earlycon info after match->setup
Subsystems (2)
PATCH v2 1/2 tty: serial: print earlycon info after match->setup
8250 devices may modify iotype in their own earlycon setup. For example:
8250_mtk and 8250_uniphier force iotype to be MMIO32. Print earlycon info after match->setup to reflect actual earlycon info.
---
Change:v1->v2: rename function
--- drivers/tty/serial/earlycon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/tty/serial/earlycon.c +8 -1
@@ -56,7 +56,6 @@ static void __init earlycon_init(struct earlycon_device *device, const char *name) {struct console *earlycon = device->con; -struct uart_port *port = &device->port;const char *s;size_t len;
@@ -70,6 +69,12 @@ static void __init earlycon_init(struct earlycon_device *device, len = s - name;strlcpy (earlycon->name, name,min (len +1 ,sizeof (earlycon->name))); earlycon->data = &early_console_dev; +} + +static void __init earlycon_print_info (struct earlycon_device *device) +{ +struct console *earlycon = device->con; +struct uart_port *port = &device->port;if (port->iotype ==UPIO_MEM || port->iotype ==UPIO_MEM16 || port->iotype ==UPIO_MEM32 || port->iotype ==UPIO_MEM32BE )
@@ -140,6 +145,7 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match)earlycon_init (&early_console_dev, match->name); err = match->setup (&early_console_dev, buf); +earlycon_print_info (&early_console_dev);if (err <0 )return err;if (!early_console_dev.con->write)
@@ -302,6 +308,7 @@ int __init of_setup_earlycon(const struct earlycon_id *match, }earlycon_init (&early_console_dev, match->name); err = match->setup (&early_console_dev, options); +earlycon_print_info (&early_console_dev);if (err <0 )return err;if (!early_console_dev.con->write)
Signature · 1 line
2.28.0.618.gf4bc123cb7-goog
PATCH v2 2/2 tty: serial: 8250_mtk: set regshift for mmio32
To use mmio32, we also need to set regshift.
---
Change:v1->v2: none
--- drivers/tty/serial/8250/8250_mtk.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/8250/8250_mtk.c +1 -0
@@ -669,6 +669,7 @@ static int __init early_mtk8250_setup(struct earlycon_device *device,return -ENODEV ; device->port.iotype =UPIO_MEM32 ; + device->port.regshift =2 ;return early_serial8250_setup (device,NULL ); }
Signature · 1 line
2.28.0.618.gf4bc123cb7-goog
Quoted 4 lines · Hsin-Yi Wang
8250 devices may modify iotype in their own earlycon setup. For example:
8250_mtk and 8250_uniphier force iotype to be MMIO32. Print earlycon info aftermatch->setupto reflect actual earlycon info.
Thanks for an update.
I prefer to see some flag that tells user that options were forced by the kernel itself (something like err > 0 returned from ->setup()), but I think it's matter of an additional fix. In principle user can check the command line and / or DT/ACPI vs. dmesg, although it will require an extra work.
Quoted 52 lines
Signed-off-by Hsin-Yi Wang <[email protected]>---
Change:v1->v2: rename function--- drivers/tty/serial/earlycon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/tty/serial/earlycon.c +8
-2@@ -56,7 +56,6 @@ static void __init earlycon_init(struct earlycon_device *device, const char *name) {struct console *earlycon = device->con; -struct uart_port *port = &device->port;const char *s;size_t len;@@ -70,6 +69,12 @@ static void __init earlycon_init(struct earlycon_device *device, len = s - name;strlcpy (earlycon->name, name,min (len +1 ,sizeof (earlycon->name))); earlycon->data = &early_console_dev; +} + +static void __init earlycon_print_info (struct earlycon_device *device) +{ +struct console *earlycon = device->con; +struct uart_port *port = &device->port;if (port->iotype ==UPIO_MEM || port->iotype ==UPIO_MEM16 || port->iotype ==UPIO_MEM32 || port->iotype ==UPIO_MEM32BE )@@ -140,6 +145,7 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match)earlycon_init (&early_console_dev, match->name); err = match->setup (&early_console_dev, buf); +earlycon_print_info (&early_console_dev);if (err <0 )return err;if (!early_console_dev.con->write)@@ -302,6 +308,7 @@ int __init of_setup_earlycon(const struct earlycon_id *match, }earlycon_init (&early_console_dev, match->name); err = match->setup (&early_console_dev, options); +earlycon_print_info (&early_console_dev);if (err <0 )return err;if (!early_console_dev.con->write) --2.28.0.618.gf4bc123cb7-goog
Signature · 2 lines
With Best Regards, Andy Shevchenko