From: Wig Cheng <onlywig@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Michal Orzel <michal.orzel@amd.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
John Ernberg <john.ernberg@actia.se>, Peng Fan <peng.fan@nxp.com>,
Wig Cheng <onlywig@gmail.com>
Subject: [PATCH v2 2/4] xen/arm64: add early printk for the classic i.MX UART
Date: Tue, 18 Aug 2026 10:52:22 +0800 [thread overview]
Message-ID: <20260818025224.4165503-3-onlywig@gmail.com> (raw)
In-Reply-To: <20260818025224.4165503-1-onlywig@gmail.com>
Add an early printk implementation for the classic i.MX UART IP,
selectable via EARLY_UART_CHOICE_IMX_UART. The UART is expected to be
fully initialized by the bootloader.
Signed-off-by: Wig Cheng <onlywig@gmail.com>
---
xen/arch/arm/Kconfig.debug | 12 +++++++++
xen/arch/arm/arm64/debug-imx-uart.inc | 37 +++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
create mode 100644 xen/arch/arm/arm64/debug-imx-uart.inc
diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index 5a03b220ac..63a34b813a 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -44,6 +44,14 @@ choice
Say Y here if you wish the early printk to direct their
output to a i.MX LPUART.
+ config EARLY_UART_CHOICE_IMX_UART
+ select EARLY_UART_IMX_UART
+ depends on ARM_64
+ bool "Early printk via i.MX UART"
+ help
+ Say Y here if you wish the early printk to direct their
+ output to the classic i.MX UART (i.MX8M family).
+
config EARLY_UART_CHOICE_LINFLEX
select EARLY_UART_LINFLEX
depends on ARM_64
@@ -97,6 +105,9 @@ config EARLY_UART_EXYNOS4210
config EARLY_UART_IMX_LPUART
select EARLY_PRINTK
bool
+config EARLY_UART_IMX_UART
+ select EARLY_PRINTK
+ bool
config EARLY_UART_LINFLEX
select EARLY_PRINTK
bool
@@ -185,6 +196,7 @@ config EARLY_PRINTK_INC
default "debug-cadence.inc" if EARLY_UART_CADENCE
default "debug-exynos4210.inc" if EARLY_UART_EXYNOS4210
default "debug-imx-lpuart.inc" if EARLY_UART_IMX_LPUART
+ default "debug-imx-uart.inc" if EARLY_UART_IMX_UART
default "debug-linflex.inc" if EARLY_UART_LINFLEX
default "debug-meson.inc" if EARLY_UART_MESON
default "debug-mvebu.inc" if EARLY_UART_MVEBU
diff --git a/xen/arch/arm/arm64/debug-imx-uart.inc b/xen/arch/arm/arm64/debug-imx-uart.inc
new file mode 100644
index 0000000000..19b1679020
--- /dev/null
+++ b/xen/arch/arm/arm64/debug-imx-uart.inc
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Early printk for the classic i.MX UART IP (i.MX8M family).
+ * The UART is expected to be fully initialized by the bootloader.
+ *
+ * Copyright 2026 Open-EP (E-Paper) Community
+ */
+
+#include <asm/imx-uart.h>
+
+/*
+ * Wait for the UART to be ready to transmit
+ * xb: register which contains the UART base address
+ * c: scratch register
+ */
+.macro early_uart_ready xb, c
+1:
+ ldr w\c, [\xb, #UTS] /* <- Test register */
+ tst w\c, #UTS_TXFULL /* Check TX FIFO full bit */
+ b.ne 1b /* Wait until there is room */
+.endm
+
+/*
+ * UART transmit character
+ * xb: register which contains the UART base address
+ * wt: register which contains the character to transmit
+ */
+.macro early_uart_transmit xb, wt
+ str \wt, [\xb, #URTX0] /* -> Transmitter register */
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
--
2.43.0
next prev parent reply other threads:[~2026-08-18 2:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 2:52 [PATCH v2 0/4] xen/arm: add i.MX8M platform and UART support Wig Cheng
2026-08-18 2:52 ` [PATCH v2 1/4] xen/char: add classic i.MX UART driver Wig Cheng
2026-08-18 7:06 ` Orzel, Michal
2026-08-18 7:13 ` Orzel, Michal
2026-08-18 7:18 ` Orzel, Michal
2026-08-18 2:52 ` Wig Cheng [this message]
2026-08-18 7:18 ` [PATCH v2 2/4] xen/arm64: add early printk for the classic i.MX UART Orzel, Michal
2026-08-18 2:52 ` [PATCH v2 3/4] xen/arm: add i.MX8M platform support Wig Cheng
2026-08-18 7:18 ` Orzel, Michal
2026-08-18 2:52 ` [PATCH v2 4/4] MAINTAINERS: add myself as reviewer of i.MX8M related patches Wig Cheng
2026-08-18 7:19 ` Orzel, Michal
2026-08-18 6:28 ` [PATCH v2 0/4] xen/arm: add i.MX8M platform and UART support Orzel, Michal
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=20260818025224.4165503-3-onlywig@gmail.com \
--to=onlywig@gmail.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=john.ernberg@actia.se \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=peng.fan@nxp.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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