]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
serial: goldfish: Add debug uart support
authorDaniel Palmer <daniel@0x0f.com>
Mon, 9 Mar 2026 10:51:08 +0000 (19:51 +0900)
committerTom Rini <trini@konsulko.com>
Tue, 14 Apr 2026 19:25:13 +0000 (13:25 -0600)
Add debug support for the goldfish tty so it can be used for
early debugging. This will be really useful when adding support
for relocation to the m68k qemu virt machine.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Tested-by: Kuan-Wei Chiu <visitorckw@gmail.com>
drivers/serial/Kconfig
drivers/serial/serial_goldfish.c

index b84cb9ec781db429d238704636a4831b5c348c17..f6a696e6c94cfc7251413e96b94d4a78320a322e 100644 (file)
@@ -510,6 +510,14 @@ config DEBUG_UART_XTENSA_SEMIHOSTING
          start up driver model. The driver will be available until the real
          driver model serial is running.
 
+config DEBUG_UART_GOLDFISH
+       bool "Goldfish TTY"
+       help
+         Select this to enable the debug UART using the Goldfish TTY driver.
+         This provides basic serial output from the console without needing to
+         start up driver model. The driver will be available until the real
+         driver model serial is running.
+
 endchoice
 
 config DEBUG_UART_BASE
index 4ac2cfb62315f68f5684281c1a405ff70aee6d25..91dc040fcf2678d707b8b9dfda19a0ca2220d289 100644 (file)
@@ -115,3 +115,21 @@ U_BOOT_DRIVER(serial_goldfish) = {
        .priv_auto = sizeof(struct goldfish_tty_priv),
        .flags  = DM_FLAG_PRE_RELOC,
 };
+
+#ifdef CONFIG_DEBUG_UART_GOLDFISH
+
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+       void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
+
+       __raw_writel(ch, base + GOLDFISH_TTY_PUT_CHAR);
+}
+
+DEBUG_UART_FUNCS
+#endif