Skip to contentSkip to conversation

serial: 8250: move mmp|pxa uart earlycon code and add xscale earlycon

PATCH In review Jisheng Zhang 2 participants 4 messages Jul 11, 2024 – Jan 21, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover serial: 8250: move mmp|pxa uart earlycon code and add xscale earlycon

There are two other drivers that bind to "mrvl,mmp-uart": the 8250_of and the 8250_pxa. The previous one is generic and the latter is binded to ARCH_PXA || ARCH_MMP. Now we may have pxa programming compatible HW to support, making use of the generic 8250_of seems a good idea. However, there's no earlycon support if we go with this solution. So move the mmp|pxa-uart earlycon code to core 8250_early.c.

patch2 adds xscale earlycon support too, only build test since I have no xscale machine any more.

Since v1:
- split the patch into two as suggested by Greg

Jisheng Zhang (2):
serial: 8250: move mmp|pxa uart earlycon code
serial: 8250_early: add xscale earlycon support

 drivers/tty/serial/8250/8250_early.c | 11 +++++++++++
 drivers/tty/serial/8250/8250_pxa.c   | 16 ----------------
 2 files changed, 11 insertions(+), 16 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/2 serial: 8250: move mmp|pxa uart earlycon code

There are two other drivers that bind to "mrvl,mmp-uart": the 8250_of and the 8250_pxa. The previous one is generic and the latter is binded to ARCH_PXA || ARCH_MMP. Now we may have pxa programming compatible HW to support, making use of the generic 8250_of seems a good idea. However, there's no earlycon support if we go with this solution. So move the mmp|pxa-uart earlycon code to core 8250_early.c.

---
 drivers/tty/serial/8250/8250_early.c | 10 ++++++++++
 drivers/tty/serial/8250/8250_pxa.c   | 16 ----------------
 2 files changed, 10 insertions(+), 16 deletions(-)
drivers/tty/serial/8250/8250_early.c +10 -0
index e3f482fd3de4..2ab61d6673d2 100644
@@ -171,6 +171,16 @@ OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup);
 OF_EARLYCON_DECLARE(uart, "nvidia,tegra20-uart", early_serial8250_setup);
 OF_EARLYCON_DECLARE(uart, "snps,dw-apb-uart", early_serial8250_setup);
 
+static int __init early_serial8250_rs2_setup(struct earlycon_device *device,
+					     const char *options)
+{
+	device->port.regshift = 2;
+
+	return early_serial8250_setup(device, options);
+}
+OF_EARLYCON_DECLARE(uart, "mrvl,mmp-uart", early_serial8250_rs2_setup);
+OF_EARLYCON_DECLARE(uart, "mrvl,pxa-uart", early_serial8250_rs2_setup);
+
 #ifdef CONFIG_SERIAL_8250_OMAP
 
 static int __init early_omap8250_setup(struct earlycon_device *device,
drivers/tty/serial/8250/8250_pxa.c +0 -16
index ba96fa913e7f..b5d937f6f3f9 100644
@@ -165,22 +165,6 @@ static struct platform_driver serial_pxa_driver = {
 
 module_platform_driver(serial_pxa_driver);
 
-#ifdef CONFIG_SERIAL_8250_CONSOLE
-static int __init early_serial_pxa_setup(struct earlycon_device *device,
-				  const char *options)
-{
-	struct uart_port *port = &device->port;
-
-	if (!(device->port.membase || device->port.iobase))
-		return -ENODEV;
-
-	port->regshift = 2;
-	return early_serial8250_setup(device, NULL);
-}
-OF_EARLYCON_DECLARE(early_pxa, "mrvl,pxa-uart", early_serial_pxa_setup);
-OF_EARLYCON_DECLARE(mmp, "mrvl,mmp-uart", early_serial_pxa_setup);
-#endif
-
 MODULE_AUTHOR("Sergei Ianovich");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:pxa2xx-uart");
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/2 serial: 8250_early: add xscale earlycon support

In reply to Jisheng Zhang

After commit 3a50365d8c79 ("serial: 8250: Add OF support for Xscale variant"), 8250_of can support the xscale variant. Now, let's add the earlycon support for xscale too.

---
 drivers/tty/serial/8250/8250_early.c | 1 +
 1 file changed, 1 insertion(+)
drivers/tty/serial/8250/8250_early.c +1 -0
index 2ab61d6673d2..6176083d0341 100644
@@ -178,6 +178,7 @@ static int __init early_serial8250_rs2_setup(struct earlycon_device *device,
 
 	return early_serial8250_setup(device, options);
 }
+OF_EARLYCON_DECLARE(uart, "intel,xscale-uart", early_serial8250_rs2_setup);
 OF_EARLYCON_DECLARE(uart, "mrvl,mmp-uart", early_serial8250_rs2_setup);
 OF_EARLYCON_DECLARE(uart, "mrvl,pxa-uart", early_serial8250_rs2_setup);
 
Signature · 1 line
2.43.0
Reviewed-by on the v2 series
#3 lore raw
In reply to Jisheng Zhang

Hi Greg, Jisheng:

how is this patch going, hope it isn't lost..
generally this patch looks good.

Quoted 13 lines · Jisheng Zhang

There are two other drivers that bind to "mrvl,mmp-uart": the 8250_of and the 8250_pxa. The previous one is generic and the latter is binded to ARCH_PXA || ARCH_MMP. Now we may have pxa programming compatible HW to support, making use of the generic 8250_of seems a good idea. However, there's no earlycon support if we go with this solution. So move the mmp|pxa-uart earlycon code to core 8250_early.c.

patch2 adds xscale earlycon support too, only build test since I have no xscale machine any more.

Since v1:
- split the patch into two as suggested by Greg

Quoted 11 lines

Jisheng Zhang (2):
serial: 8250: move mmp|pxa uart earlycon code
serial: 8250_early: add xscale earlycon support

 drivers/tty/serial/8250/8250_early.c | 11 +++++++++++
 drivers/tty/serial/8250/8250_pxa.c   | 16 ----------------
 2 files changed, 11 insertions(+), 16 deletions(-)
Signature · 1 line
2.43.0
Signature · 3 lines
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55