Merge patch series "serial: goldfish: Add debug uart support"

This series from Daniel Palmer <daniel@0x0f.com> improves debug UART
support on QEMU on M68K by adding debug uart support to the serial
driver.

Link: https://lore.kernel.org/r/20260309105110.672832-1-daniel@0x0f.com
This commit is contained in:
Tom Rini
2026-04-14 13:25:32 -06:00
4 changed files with 41 additions and 0 deletions

View File

@@ -42,6 +42,11 @@ ENTRY(_start)
/* Setup initial stack pointer */
move.l #CFG_SYS_INIT_SP_ADDR, %sp
/* Setup the debug uart if enabled */
#ifdef CONFIG_DEBUG_UART
bsr.l debug_uart_init
#endif
/*
* Allocate Global Data (GD)
* board_init_f_alloc_reserve(top) returns the new top of stack in %d0

View File

@@ -31,6 +31,16 @@ The minimal QEMU command line to get U-Boot up and running is:
Note that the `-nographic` option is used to redirect the console to stdio,
which connects to the emulated Goldfish TTY device.
Debugging U-Boot
----------------
If you need early debugging output enable `CONFIG_DEBUG_UART_GOLDFISH`.
The base address for the UART can be found by activating the QEMU monitor,
running `info qtree`, and then looking for the goldfish tty device and
taking the mmio address.
Baud rate doesn't matter.
Hardware Support
----------------
The following QEMU virt peripherals are supported in U-Boot:

View 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

View 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