Linux IOMMU Development
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@sig21.net>
To: iommu@lists.linux.dev
Subject: Asrock X600 port80 UART
Date: Mon, 26 Jan 2026 16:02:40 +0100	[thread overview]
Message-ID: <aXeCECwwtHhhzedL@sig21.net> (raw)
In-Reply-To: <aXeAOtGQUdlNZF6V@sig21.net>

(I post this here for lack of a better place. Hope interested
persons can find it.)

The Asrock Deskmini X600 has a "UART1" connector (search for
"molex picoblade 1.25mm 4-pin cable" to find matching cables).
See https://www.asrock.com/mb/photo/X600M-STX%20R2.0(L2).png at
the bottom between the two SATA connectors.

Pin 1	GND
Pin 2	?
Pin 3	TX	+3.3V
Pin 4	+5V

The X600 has an nct6686d SuperIO chip which has a "PORT80 UART"
function to forward ioport 80 debug writes to the UART interface.
Apparently it is connected to the "UART1" connector, and I dumped
some of the nct6686d configuration registers to confirm the
port80 UART is enabled by strap settings with 115200 8N1
(actual speed is 2MHz / 17).

https://www.nuvoton.com/resource-files/NCT6686D_HW_Datasheet_V0_5.pdf

Connecting a 3.3V compatible USB-serial cable confirms there is
some binary output from firmware debug during boot. I wrote a
simple console driver to write kernel messages via port80 to
get output during suspend/resume/hibernate, it works well enough
with some binary output from firmware interspersed.

Use it with kernel command line options:

console=port80 console=tty0 no_console_suspend keep_bootcon debug

I think this patch is too much of a hack for inclusion in
the kernel, but here it is for anyone who wants it.

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index c883a28e0916..e09a8e987638 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -1037,6 +1037,12 @@ config OXP_EC
 
 source "drivers/platform/x86/tuxedo/Kconfig"
 
+config PORT80_CONSOLE
+	tristate "PC debug ioport 80 console"
+	help
+	  use PC debug ioport 80 as console output via port80-UART
+	  supported by some Nuvoton SuperIO chips like NCT6686D
+
 endif # X86_PLATFORM_DEVICES
 
 config P2SB
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index c7db2a88c11a..4e92ae18415d 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -163,3 +163,5 @@ obj-$(CONFIG_SEL3350_PLATFORM)		+= sel3350-platform.o
 
 # OneXPlayer
 obj-$(CONFIG_OXP_EC)			+= oxpec.o
+
+obj-$(CONFIG_PORT80_CONSOLE)		+= port80_cons.o
diff --git a/drivers/platform/x86/port80_cons.c b/drivers/platform/x86/port80_cons.c
new file mode 100644
index 000000000000..cfe71dd5a760
--- /dev/null
+++ b/drivers/platform/x86/port80_cons.c
@@ -0,0 +1,68 @@
+/* use PC debug ioport 80 as console output via port80-UART
+ * supported by some Nuvoton SuperIO chips like NCT6686D
+ */
+
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/serial_core.h>
+
+
+static uint delay = 200;
+module_param(delay, uint, 0644);
+MODULE_PARM_DESC(delay, "per charater output delay in us (default 200)");
+
+
+static void p80_putchar(u8 ch)
+{
+	if (ch == '\n') {
+		outb_p('\r', 0x80);
+		udelay(delay);
+	}
+	outb_p(ch, 0x80);
+	udelay(delay);
+}
+
+static void p80_write(struct console *con, const char *s, unsigned n)
+{
+	unsigned int i;
+
+	for (i = 0; i < n; i++, s++)
+		p80_putchar(*s);
+}
+
+static int __init p80_early_console_setup(struct earlycon_device *device,
+					     const char *opt)
+{
+	device->con->write = p80_write;
+	return 0;
+}
+
+EARLYCON_DECLARE(port80, p80_early_console_setup);
+
+
+static struct console p80cons = {
+	.name		= "port80",
+	.write		= p80_write,
+	.flags		= CON_PRINTBUFFER | CON_ANYTIME,
+};
+
+static int __init p80_init(void)
+{
+	register_console(&p80cons);
+	printk("registered port80 console\n");
+	return 0;
+}
+
+static void p80_exit(void)
+{
+	unregister_console(&p80cons);
+}
+
+module_init(p80_init);
+module_exit(p80_exit);
+
+MODULE_DESCRIPTION("Port80 console driver");
+MODULE_LICENSE("GPL v2");

  reply	other threads:[~2026-01-26 15:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26 14:54 AMD IOMMU issue with hibernate on Asrock X600 Johannes Stezenbach
2026-01-26 15:02 ` Johannes Stezenbach [this message]
2026-01-28  9:31 ` Johannes Stezenbach
2026-02-03  5:38   ` Vasant Hegde
2026-02-03 11:40     ` Johannes Stezenbach
2026-02-04 15:16       ` Johannes Stezenbach
2026-02-05 14:05         ` Johannes Stezenbach
2026-02-21 14:31           ` Vasant Hegde
2026-02-21 20:28             ` Johannes Stezenbach
2026-02-23  8:49               ` Vasant Hegde
2026-02-23  9:09                 ` Johannes Stezenbach
2026-02-24  8:56                   ` Vasant Hegde
2026-02-24  9:11                     ` Johannes Stezenbach
2026-03-05 16:50                       ` Vasant Hegde
2026-02-21 13:14         ` Vasant Hegde
2026-02-21 12:51       ` Vasant Hegde
2026-02-23  6:17         ` Naveen N Rao
2026-02-03  5:28 ` Vasant Hegde
2026-02-03 11:49   ` Johannes Stezenbach

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=aXeCECwwtHhhzedL@sig21.net \
    --to=js@sig21.net \
    --cc=iommu@lists.linux.dev \
    /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