The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] x86/serial: Use generic BASE_BAUD in asm/serial.h
@ 2026-07-17  7:31 Thorsten Blum
  2026-07-17  9:06 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-07-17  7:31 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Arnd Bergmann
  Cc: Thorsten Blum, linux-kernel, linux-arch

Include asm-generic/serial.h and use the generic BASE_BAUD definition
instead of redefining it. Update the comment accordingly.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/x86/include/asm/serial.h | 9 +--------
 include/asm-generic/serial.h  | 7 ++-----
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/arch/x86/include/asm/serial.h b/arch/x86/include/asm/serial.h
index ece8299d2695..b623f6d70f64 100644
--- a/arch/x86/include/asm/serial.h
+++ b/arch/x86/include/asm/serial.h
@@ -2,14 +2,7 @@
 #ifndef _ASM_X86_SERIAL_H
 #define _ASM_X86_SERIAL_H
 
-/*
- * This assumes you have a 1.8432 MHz clock for your UART.
- *
- * It'd be nice if someone built a serial card with a 24.576 MHz
- * clock, since the 16550A is capable of handling a top speed of 1.5
- * megabits/second; but this requires a faster clock.
- */
-#define BASE_BAUD (1843200/16)
+#include <asm-generic/serial.h>
 
 /* Standard COM flags (except for COM4, because of the 8514 problem) */
 #ifdef CONFIG_SERIAL_8250_DETECT_IRQ
diff --git a/include/asm-generic/serial.h b/include/asm-generic/serial.h
index ca9f7b6be3f0..53b04e607972 100644
--- a/include/asm-generic/serial.h
+++ b/include/asm-generic/serial.h
@@ -3,12 +3,9 @@
 #define __ASM_GENERIC_SERIAL_H
 
 /*
- * This should not be an architecture specific #define, oh well.
- *
- * Traditionally, it just describes i8250 and related serial ports
- * that have this clock rate.
+ * Default base baud for i8250 and related serial ports using a
+ * 1.8432 MHz UART clock.
  */
-
 #define BASE_BAUD (1843200 / 16)
 
 #endif /* __ASM_GENERIC_SERIAL_H */

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

* Re: [PATCH] x86/serial: Use generic BASE_BAUD in asm/serial.h
  2026-07-17  7:31 [PATCH] x86/serial: Use generic BASE_BAUD in asm/serial.h Thorsten Blum
@ 2026-07-17  9:06 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2026-07-17  9:06 UTC (permalink / raw)
  To: Thorsten Blum, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin
  Cc: linux-kernel, Linux-Arch

On Fri, Jul 17, 2026, at 09:31, Thorsten Blum wrote:
>  /*
> - * This should not be an architecture specific #define, oh well.
> - *
> - * Traditionally, it just describes i8250 and related serial ports
> - * that have this clock rate.
> + * Default base baud for i8250 and related serial ports using a
> + * 1.8432 MHz UART clock.
>   */

You remove the important bit here, which is that we shouldn't need
the definition in the first place.

Among the current references

arch/arc/include/asm/serial.h:#define BASE_BAUD arc_early_base_baud()
arch/arm/mach-omap1/board-ams-delta.c:          .uartclk        = BASE_BAUD * 16,
arch/loongarch/include/asm/serial.h:#define BASE_BAUD 0
arch/openrisc/include/asm/serial.h:#define BASE_BAUD (cpuinfo_or1k[smp_processor_id()].clock_frequency/16)
arch/powerpc/include/asm/serial.h:#define BASE_BAUD ( 1843200 / 16 )
arch/powerpc/kernel/legacy_serial.c:    u32 clock = BASE_BAUD * 16;
arch/x86/boot/early_serial_console.c:#define BASE_BAUD (1843200/16)
arch/x86/boot/early_serial_console.c:   return BASE_BAUD / quot;
arch/xtensa/platforms/iss/include/platform/serial.h:#define BASE_BAUD 0
arch/xtensa/platforms/xt2000/include/platform/serial.h:#define BASE_BAUD ( DUART16552_XTAL_FREQ / 16 )
arch/xtensa/platforms/xtfpga/include/platform/serial.h:#define BASE_BAUD (*(long *)XTFPGA_CLKFRQ_VADDR / 16)
drivers/tty/serial/earlycon.c:          port->uartclk = BASE_BAUD * 16;
include/asm-generic/serial.h:#define BASE_BAUD (1843200 / 16)

the only thing actually using it is the earlycon="..." command line
parsing. As far as I can tell, everyone sets it to the generic
value, except for loongarch/xtensa-iss using 0 to make 8250-early not
override the default from the boot loader and arc/openrisc trying
to do runtime detection. The arc/openrisc case can probably be fixed
by just defining the clocks correctly in the dts files and using
chosen/stdout-path instead of the open-coded earlycon settings.
There is probably also a better solution to deal with the
BASE_BAUD=0 case in an architecture-independent way.

I should also dig out my old series that turns the architecture
specific SERIAL_PORT_DFNS macro into a regular driver.

     Arnd

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

end of thread, other threads:[~2026-07-17  9:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17  7:31 [PATCH] x86/serial: Use generic BASE_BAUD in asm/serial.h Thorsten Blum
2026-07-17  9:06 ` Arnd Bergmann

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