{"id":2207115,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2207115/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260309023234.640209-1-daniel@0x0f.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260309023234.640209-1-daniel@0x0f.com>","list_archive_url":null,"date":"2026-03-09T02:32:34","name":"serial: goldfish: Add DEBUG_UART support","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"8c67f6d26e1c2438830af75e197faaef4a3c7713","submitter":{"id":74011,"url":"http://patchwork.ozlabs.org/api/1.2/people/74011/?format=json","name":"Daniel Palmer","email":"daniel@0x0f.com"},"delegate":{"id":14103,"url":"http://patchwork.ozlabs.org/api/1.2/users/14103/?format=json","username":"spectrum","first_name":"Angelo","last_name":"Dureghello","email":"sysamfw@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260309023234.640209-1-daniel@0x0f.com/mbox/","series":[{"id":494936,"url":"http://patchwork.ozlabs.org/api/1.2/series/494936/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=494936","date":"2026-03-09T02:32:34","name":"serial: goldfish: Add DEBUG_UART support","version":1,"mbox":"http://patchwork.ozlabs.org/series/494936/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2207115/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2207115/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=0x0f.com header.i=@0x0f.com header.a=rsa-sha256\n header.s=google header.b=LgUFo6Nh;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=0x0f.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=0x0f.com header.i=@0x0f.com header.b=\"LgUFo6Nh\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=0x0f.com","phobos.denx.de; spf=pass smtp.mailfrom=daniel@0x0f.com"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fTgzt4SZXz1xyl\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 09 Mar 2026 13:33:30 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 7902B8063E;\n\tMon,  9 Mar 2026 03:33:20 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id D0010807C0; Mon,  9 Mar 2026 03:33:18 +0100 (CET)","from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com\n [IPv6:2607:f8b0:4864:20::102e])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 43A6480517\n for <u-boot@lists.denx.de>; Mon,  9 Mar 2026 03:33:14 +0100 (CET)","by mail-pj1-x102e.google.com with SMTP id\n 98e67ed59e1d1-3598cab697eso4731581a91.1\n for <u-boot@lists.denx.de>; Sun, 08 Mar 2026 19:33:14 -0700 (PDT)","from shiro (p1766150-ipxg00e01sizuokaden.shizuoka.ocn.ne.jp.\n [153.167.218.150]) by smtp.googlemail.com with ESMTPSA id\n 98e67ed59e1d1-359bbbaf51bsm4637689a91.1.2026.03.08.19.33.12\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 08 Mar 2026 19:33:13 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=0x0f.com; s=google; t=1773023593; x=1773628393; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=Tr0GZ6OYcnyElUR8KXyH//zJbM8C3Lpxzg5eES+9eh0=;\n b=LgUFo6NhOw/bwXZopg+olQlrCydPLA+FwdpTtUGJEQZ5PuvfTM9VZ8LSJ0dVbs6rrp\n ClFR6Kt5sHPcYYabMyQ3ykl+r4qO5nZ6pj606Yh0K0qwFBx4zHyiH9nBDObmxaVvtGsS\n wvqYrweFhJB0QGEXyox+e8DS/r/F6cqn1EmVM=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1773023593; x=1773628393;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=Tr0GZ6OYcnyElUR8KXyH//zJbM8C3Lpxzg5eES+9eh0=;\n b=Qnr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1dcb:b0:359:85b0:4023 with SMTP id\n 98e67ed59e1d1-359be394911mr7475029a91.16.1773023593339;\n Sun, 08 Mar 2026 19:33:13 -0700 (PDT)","From":"Daniel Palmer <daniel@0x0f.com>","To":"visitorckw@gmail.com","Cc":"u-boot@lists.denx.de,\n\tDaniel Palmer <daniel@0x0f.com>","Subject":"[PATCH] serial: goldfish: Add DEBUG_UART support","Date":"Mon,  9 Mar 2026 11:32:34 +0900","Message-ID":"<20260309023234.640209-1-daniel@0x0f.com>","X-Mailer":"git-send-email 2.51.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Add debug support for the goldfish tty so it can be used for\nearly debugging. This will be really useful when adding support\nfor relocation etc.\n\nSigned-off-by: Daniel Palmer <daniel@0x0f.com>\n---\n doc/board/emulation/qemu-m68k.rst | 10 ++++++++++\n drivers/serial/Kconfig            |  8 ++++++++\n drivers/serial/serial_goldfish.c  | 18 ++++++++++++++++++\n 3 files changed, 36 insertions(+)","diff":"diff --git a/doc/board/emulation/qemu-m68k.rst b/doc/board/emulation/qemu-m68k.rst\nindex 6c4de54cf6a8..2f2e6bd6444a 100644\n--- a/doc/board/emulation/qemu-m68k.rst\n+++ b/doc/board/emulation/qemu-m68k.rst\n@@ -31,6 +31,16 @@ The minimal QEMU command line to get U-Boot up and running is:\n Note that the `-nographic` option is used to redirect the console to stdio,\n which connects to the emulated Goldfish TTY device.\n \n+Debugging U-Boot\n+----------------\n+\n+If you need early debugging output enable `CONFIG_DEBUG_UART_GOLDFISH`.\n+The base address for the UART can be found by activating the QEMU monitor,\n+running `info qtree`, and then looking for the goldfish tty device and\n+taking the mmio address.\n+\n+Baud rate doesn't matter.\n+\n Hardware Support\n ----------------\n The following QEMU virt peripherals are supported in U-Boot:\ndiff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig\nindex b84cb9ec781d..f6a696e6c94c 100644\n--- a/drivers/serial/Kconfig\n+++ b/drivers/serial/Kconfig\n@@ -510,6 +510,14 @@ config DEBUG_UART_XTENSA_SEMIHOSTING\n \t  start up driver model. The driver will be available until the real\n \t  driver model serial is running.\n \n+config DEBUG_UART_GOLDFISH\n+\tbool \"Goldfish TTY\"\n+\thelp\n+\t  Select this to enable the debug UART using the Goldfish TTY driver.\n+\t  This provides basic serial output from the console without needing to\n+\t  start up driver model. The driver will be available until the real\n+\t  driver model serial is running.\n+\n endchoice\n \n config DEBUG_UART_BASE\ndiff --git a/drivers/serial/serial_goldfish.c b/drivers/serial/serial_goldfish.c\nindex 4ac2cfb62315..58c494918786 100644\n--- a/drivers/serial/serial_goldfish.c\n+++ b/drivers/serial/serial_goldfish.c\n@@ -115,3 +115,21 @@ U_BOOT_DRIVER(serial_goldfish) = {\n \t.priv_auto = sizeof(struct goldfish_tty_priv),\n \t.flags\t= DM_FLAG_PRE_RELOC,\n };\n+\n+#ifdef CONFIG_DEBUG_UART_GOLDFISH\n+\n+#include <debug_uart.h>\n+\n+static inline void _debug_uart_init(void)\n+{\n+}\n+\n+static inline void _debug_uart_putc(int ch)\n+{\n+\tvoid *base = (void *)CONFIG_DEBUG_UART_BASE;\n+\n+\t__raw_writel(ch, base + GOLDFISH_TTY_PUT_CHAR);\n+}\n+\n+DEBUG_UART_FUNCS\n+#endif\n","prefixes":[]}