Generic Linux architectural discussions
 help / color / mirror / Atom feed
* [PATCH 0/5] serial: Share legacy UART I/O port constants
@ 2026-12-05 12:23 Thorsten Blum
  2026-12-05 12:23 ` [PATCH 1/5] asm-generic: serial: Define legacy UART I/O port addresses Thorsten Blum
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-12-05 12:23 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm,
	Geert Uytterhoeven, Arnd Bergmann
  Cc: linux-alpha, linux-m68k, linux-arch, Thorsten Blum

The legacy UART I/O port addresses are hard-coded in many places,
including architecture code and serial drivers.

Define PORT_TTYS0 through PORT_TTYS3 in <asm-generic/serial.h> and start
by using them in Alpha and m68k code.

No functional change.

Thorsten Blum (5):
  asm-generic: serial: Define legacy UART I/O port addresses
  alpha/serial: Use shared legacy UART I/O port constants
  alpha: Use shared legacy UART I/O port constants
  m68k/serial: Use shared legacy UART I/O port constants
  m68k: q40: Use shared legacy UART I/O port constants

 arch/alpha/include/asm/serial.h | 12 ++++++------
 arch/alpha/kernel/smc37c669.c   |  5 +++--
 arch/alpha/kernel/smc37c93x.c   |  5 +++--
 arch/m68k/include/asm/serial.h  | 12 ++++++------
 arch/m68k/q40/config.c          | 10 +++++++---
 include/asm-generic/serial.h    |  6 ++++++
 6 files changed, 31 insertions(+), 19 deletions(-)


base-commit: 810cd143ca5511202e503b8ed6a963f680b47a05
prerequisite-patch-id: 9c149ece8f309f5bfb8631896d8563179b3c368c

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

* [PATCH 1/5] asm-generic: serial: Define legacy UART I/O port addresses
  2026-12-05 12:23 [PATCH 0/5] serial: Share legacy UART I/O port constants Thorsten Blum
@ 2026-12-05 12:23 ` Thorsten Blum
  2026-12-05 12:23 ` [PATCH 2/5] alpha/serial: Use shared legacy UART I/O port constants Thorsten Blum
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-12-05 12:23 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm,
	Geert Uytterhoeven, Arnd Bergmann
  Cc: linux-alpha, linux-m68k, linux-arch, Thorsten Blum

Define PORT_TTYS0 through PORT_TTYS3 in <asm-generic/serial.h> so serial
port tables and serial drivers can use names for these hard-coded
addresses.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 include/asm-generic/serial.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/asm-generic/serial.h b/include/asm-generic/serial.h
index ca9f7b6be3f0..23a4a72f7493 100644
--- a/include/asm-generic/serial.h
+++ b/include/asm-generic/serial.h
@@ -11,4 +11,10 @@
 
 #define BASE_BAUD (1843200 / 16)
 
+/* Legacy UART I/O port addresses */
+#define PORT_TTYS0 0x3F8
+#define PORT_TTYS1 0x2F8
+#define PORT_TTYS2 0x3E8
+#define PORT_TTYS3 0x2E8
+
 #endif /* __ASM_GENERIC_SERIAL_H */

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

* [PATCH 2/5] alpha/serial: Use shared legacy UART I/O port constants
  2026-12-05 12:23 [PATCH 0/5] serial: Share legacy UART I/O port constants Thorsten Blum
  2026-12-05 12:23 ` [PATCH 1/5] asm-generic: serial: Define legacy UART I/O port addresses Thorsten Blum
@ 2026-12-05 12:23 ` Thorsten Blum
  2026-12-05 12:23 ` [PATCH 3/5] alpha: " Thorsten Blum
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-12-05 12:23 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm,
	Geert Uytterhoeven, Arnd Bergmann
  Cc: linux-alpha, linux-m68k, linux-arch, Thorsten Blum

Replace the hard-coded port addresses in SERIAL_PORT_DFNS with
PORT_TTYS*. Drop the redundant ttyS comments and align the columns.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/alpha/include/asm/serial.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/alpha/include/asm/serial.h b/arch/alpha/include/asm/serial.h
index 7fa754cab5df..5e128cacca12 100644
--- a/arch/alpha/include/asm/serial.h
+++ b/arch/alpha/include/asm/serial.h
@@ -13,11 +13,11 @@
 #define STD_COM4_FLAGS UPF_BOOT_AUTOCONF
 #endif
 
-#define SERIAL_PORT_DFNS			\
-	/* UART CLK   PORT IRQ     FLAGS        */			\
-	{ 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },	/* ttyS0 */	\
-	{ 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },	/* ttyS1 */	\
-	{ 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },	/* ttyS2 */	\
-	{ 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },	/* ttyS3 */
+#define SERIAL_PORT_DFNS							\
+	/* UART	CLK		PORT		IRQ	FLAGS		*/	\
+	{ 0,	BASE_BAUD,	PORT_TTYS0,	4,	STD_COM_FLAGS	},	\
+	{ 0,	BASE_BAUD,	PORT_TTYS1,	3,	STD_COM_FLAGS	},	\
+	{ 0,	BASE_BAUD,	PORT_TTYS2,	4,	STD_COM_FLAGS	},	\
+	{ 0,	BASE_BAUD,	PORT_TTYS3,	3,	STD_COM4_FLAGS	},
 
 #endif /* _ASM_ALPHA_SERIAL_H */

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

* [PATCH 3/5] alpha: Use shared legacy UART I/O port constants
  2026-12-05 12:23 [PATCH 0/5] serial: Share legacy UART I/O port constants Thorsten Blum
  2026-12-05 12:23 ` [PATCH 1/5] asm-generic: serial: Define legacy UART I/O port addresses Thorsten Blum
  2026-12-05 12:23 ` [PATCH 2/5] alpha/serial: Use shared legacy UART I/O port constants Thorsten Blum
@ 2026-12-05 12:23 ` Thorsten Blum
  2026-12-05 12:23 ` [PATCH 4/5] m68k/serial: " Thorsten Blum
  2026-12-05 12:23 ` [PATCH 5/5] m68k: q40: " Thorsten Blum
  4 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-12-05 12:23 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm,
	Geert Uytterhoeven, Arnd Bergmann
  Cc: linux-alpha, linux-m68k, linux-arch, Thorsten Blum

In smc37c669 and smc37c93x, replace the hard-coded COM1 and COM2 port
addresses with PORT_TTYS0 and PORT_TTYS1.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/alpha/kernel/smc37c669.c | 5 +++--
 arch/alpha/kernel/smc37c93x.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/alpha/kernel/smc37c669.c b/arch/alpha/kernel/smc37c669.c
index a5a6ed97a6ce..720d6c6deecc 100644
--- a/arch/alpha/kernel/smc37c669.c
+++ b/arch/alpha/kernel/smc37c669.c
@@ -10,6 +10,7 @@
 
 #include <asm/hwrpb.h>
 #include <asm/io.h>
+#include <asm/serial.h>
 
 #include "proto.h"
 
@@ -106,9 +107,9 @@
 /*
 ** Default Device Function Mappings
 */
-#define COM1_BASE	0x3F8
+#define COM1_BASE	PORT_TTYS0
 #define COM1_IRQ	4
-#define COM2_BASE	0x2F8
+#define COM2_BASE	PORT_TTYS1
 #define COM2_IRQ	3
 #define PARP_BASE	0x3BC
 #define PARP_IRQ	7
diff --git a/arch/alpha/kernel/smc37c93x.c b/arch/alpha/kernel/smc37c93x.c
index 8028273f0d16..0a22efe784d7 100644
--- a/arch/alpha/kernel/smc37c93x.c
+++ b/arch/alpha/kernel/smc37c93x.c
@@ -11,6 +11,7 @@
 
 #include <asm/hwrpb.h>
 #include <asm/io.h>
+#include <asm/serial.h>
 
 #include "proto.h"
 
@@ -71,9 +72,9 @@
 /* default device addresses */
 #define KYBD_INTERRUPT		1
 #define MOUS_INTERRUPT		12
-#define COM2_BASE		0x2f8
+#define COM2_BASE		PORT_TTYS1
 #define COM2_INTERRUPT		3
-#define COM1_BASE		0x3f8
+#define COM1_BASE		PORT_TTYS0
 #define COM1_INTERRUPT		4
 #define PARP_BASE		0x3bc
 #define PARP_INTERRUPT		7

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

* [PATCH 4/5] m68k/serial: Use shared legacy UART I/O port constants
  2026-12-05 12:23 [PATCH 0/5] serial: Share legacy UART I/O port constants Thorsten Blum
                   ` (2 preceding siblings ...)
  2026-12-05 12:23 ` [PATCH 3/5] alpha: " Thorsten Blum
@ 2026-12-05 12:23 ` Thorsten Blum
  2026-12-05 12:23 ` [PATCH 5/5] m68k: q40: " Thorsten Blum
  4 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-12-05 12:23 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm,
	Geert Uytterhoeven, Arnd Bergmann, Thorsten Blum
  Cc: linux-alpha, linux-m68k, linux-arch

Replace the hard-coded port addresses in SERIAL_PORT_DFNS with
PORT_TTYS*. Drop the redundant ttyS comments and align the columns.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/m68k/include/asm/serial.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/m68k/include/asm/serial.h b/arch/m68k/include/asm/serial.h
index 866ef25a74a2..8f9847eb0b9d 100644
--- a/arch/m68k/include/asm/serial.h
+++ b/arch/m68k/include/asm/serial.h
@@ -14,12 +14,12 @@
 #endif
 
 #ifdef CONFIG_ISA
-#define SERIAL_PORT_DFNS			\
-	/* UART CLK   PORT IRQ     FLAGS        */			\
-	{ 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },	/* ttyS0 */	\
-	{ 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },	/* ttyS1 */	\
-	{ 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },	/* ttyS2 */	\
-	{ 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },	/* ttyS3 */
+#define SERIAL_PORT_DFNS							\
+	/* UART	CLK		PORT		IRQ	FLAGS		*/	\
+	{ 0,	BASE_BAUD,	PORT_TTYS0,	4,	STD_COM_FLAGS	},	\
+	{ 0,	BASE_BAUD,	PORT_TTYS1,	3,	STD_COM_FLAGS	},	\
+	{ 0,	BASE_BAUD,	PORT_TTYS2,	4,	STD_COM_FLAGS	},	\
+	{ 0,	BASE_BAUD,	PORT_TTYS3,	3,	STD_COM4_FLAGS	},
 #endif
 
 #endif /* _ASM_M68K_SERIAL_H */

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

* [PATCH 5/5] m68k: q40: Use shared legacy UART I/O port constants
  2026-12-05 12:23 [PATCH 0/5] serial: Share legacy UART I/O port constants Thorsten Blum
                   ` (3 preceding siblings ...)
  2026-12-05 12:23 ` [PATCH 4/5] m68k/serial: " Thorsten Blum
@ 2026-12-05 12:23 ` Thorsten Blum
  4 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-12-05 12:23 UTC (permalink / raw)
  To: Richard Henderson, Matt Turner, Magnus Lindholm,
	Geert Uytterhoeven, Arnd Bergmann, Thorsten Blum
  Cc: linux-alpha, linux-m68k, linux-arch

Replace the hard-coded port addresses with PORT_TTYS*.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/m68k/q40/config.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index ed59a742baae..934f7a63d75e 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -24,6 +24,7 @@
 
 #include <asm/io.h>
 #include <asm/bootinfo.h>
+#include <asm/serial.h>
 #include <asm/setup.h>
 #include <asm/irq.h>
 #include <asm/traps.h>
@@ -124,9 +125,12 @@ static void q40_get_model(char *model)
 	sprintf(model, "Q40");
 }
 
-static unsigned int serports[] =
-{
-	0x3f8,0x2f8,0x3e8,0x2e8,0
+static unsigned int serports[] = {
+	PORT_TTYS0,
+	PORT_TTYS1,
+	PORT_TTYS2,
+	PORT_TTYS3,
+	0,
 };
 
 static void __init q40_disable_irqs(void)

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

end of thread, other threads:[~2026-12-05 12:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 12:23 [PATCH 0/5] serial: Share legacy UART I/O port constants Thorsten Blum
2026-12-05 12:23 ` [PATCH 1/5] asm-generic: serial: Define legacy UART I/O port addresses Thorsten Blum
2026-12-05 12:23 ` [PATCH 2/5] alpha/serial: Use shared legacy UART I/O port constants Thorsten Blum
2026-12-05 12:23 ` [PATCH 3/5] alpha: " Thorsten Blum
2026-12-05 12:23 ` [PATCH 4/5] m68k/serial: " Thorsten Blum
2026-12-05 12:23 ` [PATCH 5/5] m68k: q40: " Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox