From: Daniel Palmer <daniel@0x0f.com>
To: visitorckw@gmail.com
Cc: u-boot@lists.denx.de, Daniel Palmer <daniel@0x0f.com>
Subject: [PATCH v2 1/3] serial: goldfish: Add debug uart support
Date: Mon, 9 Mar 2026 19:51:08 +0900 [thread overview]
Message-ID: <20260309105110.672832-1-daniel@0x0f.com> (raw)
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>
---
drivers/serial/Kconfig | 8 ++++++++
drivers/serial/serial_goldfish.c | 18 ++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index b84cb9ec781d..f6a696e6c94c 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -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
diff --git a/drivers/serial/serial_goldfish.c b/drivers/serial/serial_goldfish.c
index 4ac2cfb62315..91dc040fcf26 100644
--- a/drivers/serial/serial_goldfish.c
+++ b/drivers/serial/serial_goldfish.c
@@ -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
--
2.51.0
next reply other threads:[~2026-03-09 10:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 10:51 Daniel Palmer [this message]
2026-03-09 10:51 ` [PATCH v2 2/3] m68k: m680x0: Initialise the debug uart Daniel Palmer
2026-03-10 5:58 ` Kuan-Wei Chiu
2026-03-10 8:31 ` Angelo Dureghello
2026-03-09 10:51 ` [PATCH v2 3/3] doc: board: virt: m68k: Detail how to use " Daniel Palmer
2026-03-10 6:07 ` [PATCH v2 1/3] serial: goldfish: Add debug uart support Kuan-Wei Chiu
2026-03-10 16:25 ` Tom Rini
2026-03-11 4:08 ` Kuan-Wei Chiu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260309105110.672832-1-daniel@0x0f.com \
--to=daniel@0x0f.com \
--cc=u-boot@lists.denx.de \
--cc=visitorckw@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox