Linux-Serial Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] tty: serial: print earlycon info after match->setup
@ 2020-09-11  9:39 Hsin-Yi Wang
  2020-09-11  9:39 ` [PATCH 2/2] tty: serial: 8250_mtk: set regshift for mmio32 Hsin-Yi Wang
  2020-09-14 16:06 ` [PATCH 1/2] tty: serial: print earlycon info after match->setup Andy Shevchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Hsin-Yi Wang @ 2020-09-11  9:39 UTC (permalink / raw)
  To: linux-serial
  Cc: Greg Kroah-Hartman, Jiri Slaby, Matthias Brugger, Serge Semin,
	Changqi Hu, Frank Wunderlich, Hsin-Yi Wang, Andy Shevchenko,
	linux-arm-kernel, linux-mediatek, linux-kernel,
	Enric Balletbo i Serra

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.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
 drivers/tty/serial/earlycon.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 2ae9190b64bb9..22f0876f72d49 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -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_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_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_info(&early_console_dev);
 	if (err < 0)
 		return err;
 	if (!early_console_dev.con->write)
-- 
2.28.0.618.gf4bc123cb7-goog


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

* [PATCH 2/2] tty: serial: 8250_mtk: set regshift for mmio32
  2020-09-11  9:39 [PATCH 1/2] tty: serial: print earlycon info after match->setup Hsin-Yi Wang
@ 2020-09-11  9:39 ` Hsin-Yi Wang
  2020-09-14 16:06 ` [PATCH 1/2] tty: serial: print earlycon info after match->setup Andy Shevchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Hsin-Yi Wang @ 2020-09-11  9:39 UTC (permalink / raw)
  To: linux-serial
  Cc: Greg Kroah-Hartman, Jiri Slaby, Matthias Brugger, Serge Semin,
	Changqi Hu, Frank Wunderlich, Hsin-Yi Wang, Andy Shevchenko,
	linux-arm-kernel, linux-mediatek, linux-kernel,
	Enric Balletbo i Serra

To use mmio32, we also need to set regshift.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
 drivers/tty/serial/8250/8250_mtk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index 7b0dec14c8b80..41f4120abdf29 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -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);
 }
-- 
2.28.0.618.gf4bc123cb7-goog


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

* Re: [PATCH 1/2] tty: serial: print earlycon info after match->setup
  2020-09-11  9:39 [PATCH 1/2] tty: serial: print earlycon info after match->setup Hsin-Yi Wang
  2020-09-11  9:39 ` [PATCH 2/2] tty: serial: 8250_mtk: set regshift for mmio32 Hsin-Yi Wang
@ 2020-09-14 16:06 ` Andy Shevchenko
  2020-09-14 17:27   ` Hsin-Yi Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2020-09-14 16:06 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: linux-serial, Greg Kroah-Hartman, Jiri Slaby, Matthias Brugger,
	Serge Semin, Changqi Hu, Frank Wunderlich, linux-arm-kernel,
	linux-mediatek, linux-kernel, Enric Balletbo i Serra

On Fri, Sep 11, 2020 at 05:39:26PM +0800, Hsin-Yi Wang wrote:
> 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.

But this means you do something which user didn't ask for...

> +static void __init earlycon_info(struct earlycon_device *device)

Can it be earlycon_pr_info() or earlycon_print_info() ?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 1/2] tty: serial: print earlycon info after match->setup
  2020-09-14 16:06 ` [PATCH 1/2] tty: serial: print earlycon info after match->setup Andy Shevchenko
@ 2020-09-14 17:27   ` Hsin-Yi Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Hsin-Yi Wang @ 2020-09-14 17:27 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-serial, Greg Kroah-Hartman, Jiri Slaby, Matthias Brugger,
	Serge Semin, Changqi Hu, Frank Wunderlich,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	moderated list:ARM/Mediatek SoC support, lkml,
	Enric Balletbo i Serra

On Tue, Sep 15, 2020 at 12:06 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Fri, Sep 11, 2020 at 05:39:26PM +0800, Hsin-Yi Wang wrote:
> > 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.
>
> But this means you do something which user didn't ask for...
>
8250_uniphier states that it can only use mmio32
https://elixir.bootlin.com/linux/v5.9-rc4/source/drivers/tty/serial/8250/8250_uniphier.c#L46

For MTK, may be the same case. So they are set in the driver.

> > +static void __init earlycon_info(struct earlycon_device *device)
>
> Can it be earlycon_pr_info() or earlycon_print_info() ?
>
Sure. I'll send a v2.

> --
> With Best Regards,
> Andy Shevchenko
>
>

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11  9:39 [PATCH 1/2] tty: serial: print earlycon info after match->setup Hsin-Yi Wang
2020-09-11  9:39 ` [PATCH 2/2] tty: serial: 8250_mtk: set regshift for mmio32 Hsin-Yi Wang
2020-09-14 16:06 ` [PATCH 1/2] tty: serial: print earlycon info after match->setup Andy Shevchenko
2020-09-14 17:27   ` Hsin-Yi Wang

Linux-Serial Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-serial/0 linux-serial/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-serial linux-serial/ https://lore.kernel.org/linux-serial \
		linux-serial@vger.kernel.org
	public-inbox-index linux-serial

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-serial


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git