[PATCH 2/3] debug_ll: Add Kconfig options for debug uarts that have none

Sascha Hauer s.hauer at pengutronix.de
Mon Jun 1 05:29:54 PDT 2026


Some SoCs include its debug_ll.h header file only by testing if
support for that SoC is compiled in. That doesn't work when barebox is
built for multiple SoCs as this leads to multiple definitions of
PUTC_LL.

Add a debug UART Kconfig option for all SoCs that do not yet have one.
The debug UART selection is a choice which makes sure only a single
debug UART is selected which also means we can include the SoC specific
debug_ll.h files using #if defined / elif defined.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/include/asm/debug_ll.h | 69 ++++++++++++++---------------------------
 common/Kconfig.debug_ll         | 28 +++++++++++++++++
 2 files changed, 52 insertions(+), 45 deletions(-)

diff --git a/arch/arm/include/asm/debug_ll.h b/arch/arm/include/asm/debug_ll.h
index fd7715c743..a645a6e910 100644
--- a/arch/arm/include/asm/debug_ll.h
+++ b/arch/arm/include/asm/debug_ll.h
@@ -3,66 +3,45 @@
 #ifndef __ASM_DEBUG_LL_H__
 #define __ASM_DEBUG_LL_H__
 
-#ifdef CONFIG_DEBUG_IMX_UART
+#if defined CONFIG_DEBUG_IMX_UART
 #include <mach/imx/debug_ll.h>
-#endif
-
-#ifdef CONFIG_DEBUG_ROCKCHIP_UART
+#elif defined CONFIG_DEBUG_ROCKCHIP_UART
 #include <mach/rockchip/debug_ll.h>
-#endif
-
-#ifdef CONFIG_DEBUG_OMAP_UART
+#elif defined CONFIG_DEBUG_OMAP_UART
 #include <mach/omap/debug_ll.h>
-#endif
-
-#ifdef CONFIG_DEBUG_ZYNQMP_UART
+#elif defined CONFIG_DEBUG_ZYNQMP_UART
 #include <mach/zynqmp/debug_ll.h>
-#endif
-
-#ifdef CONFIG_DEBUG_STM32MP_UART
+#elif defined CONFIG_DEBUG_STM32MP_UART
 #include <mach/stm32mp/debug_ll.h>
-#endif
-
-#if defined(CONFIG_DEBUG_VEXPRESS_UART) || \
-    defined(CONFIG_DEBUG_QEMU_ARM32_VIRT)
+#elif defined CONFIG_DEBUG_VEXPRESS_UART || defined CONFIG_DEBUG_QEMU_ARM32_VIRT
 #include <mach/vexpress/debug_ll.h>
-#endif
-
-#ifdef CONFIG_DEBUG_BCM283X_UART
+#elif defined CONFIG_DEBUG_BCM283X_UART
 #include <mach/bcm283x/debug_ll.h>
-#endif
-
-#ifdef CONFIG_DEBUG_LAYERSCAPE_UART
+#elif defined CONFIG_DEBUG_LAYERSCAPE_UART
 #include <mach/layerscape/debug_ll.h>
-#endif
-
-#ifdef CONFIG_DEBUG_SEMIHOSTING
+#elif defined CONFIG_DEBUG_SEMIHOSTING
 #include <debug_ll/semihosting.h>
-#endif
-
-#ifdef CONFIG_DEBUG_QEMU_ARM64_VIRT
+#elif defined CONFIG_DEBUG_AT91_UART
+#include <mach/at91/debug_ll.h>
+#elif defined CONFIG_DEBUG_QEMU_ARM64_VIRT
 #define DEBUG_LL_UART_ADDR		0x9000000
 #include <debug_ll/pl011.h>
-#elif defined CONFIG_ARCH_MVEBU
+#elif defined CONFIG_DEBUG_AM62X_UART
+#include <mach/k3/debug_ll.h>
+#elif defined CONFIG_DEBUG_MVEBU_UART
 #include <mach/mvebu/debug_ll.h>
-#elif defined CONFIG_ARCH_ZYNQ
-#include <mach/zynq/debug_ll.h>
-#elif defined CONFIG_ARCH_VERSATILE
+#elif defined CONFIG_DEBUG_CLPS711X_UART
+#include <mach/clps711x/debug_ll.h>
+#elif defined CONFIG_DEBUG_MXS_UART
+#include <mach/mxs/debug_ll.h>
+#elif defined CONFIG_DEBUG_VERSATILE_UART
 #include <mach/versatile/debug_ll.h>
-#elif defined CONFIG_ARCH_TEGRA
+#elif defined CONFIG_DEBUG_TEGRA_UART
 #include <mach/tegra/debug_ll.h>
-#elif defined CONFIG_ARCH_SOCFPGA
+#elif defined CONFIG_DEBUG_ZYNQ_UART
+#include <mach/zynq/debug_ll.h>
+#elif defined CONFIG_DEBUG_SOCFPGA_UART
 #include <mach/socfpga/debug_ll.h>
-#elif defined CONFIG_ARCH_PXA
-#include <mach/pxa/debug_ll.h>
-#elif defined CONFIG_ARCH_MXS
-#include <mach/mxs/debug_ll.h>
-#elif defined CONFIG_ARCH_CLPS711X
-#include <mach/clps711x/debug_ll.h>
-#elif defined CONFIG_ARCH_AT91
-#include <mach/at91/debug_ll.h>
-#elif defined CONFIG_ARCH_K3
-#include <mach/k3/debug_ll.h>
 #endif
 
 #endif
diff --git a/common/Kconfig.debug_ll b/common/Kconfig.debug_ll
index 715b1978f8..3f06e2eef4 100644
--- a/common/Kconfig.debug_ll
+++ b/common/Kconfig.debug_ll
@@ -312,6 +312,10 @@ config DEBUG_RPI4_MINI_UART
 	  Say Y here if you want low-level debugging support on
 	  RaspberryPi 4 board mini UART.
 
+config DEBUG_ZYNQ_UART
+	bool "Zynq debug UART"
+	depends on ARCH_ZYNQ
+
 config DEBUG_ZYNQMP_UART
 	bool "Zynqmp Debug UART"
 	depends on ARCH_ZYNQMP
@@ -390,6 +394,30 @@ config DEBUG_OPENRISC_NS16550
 	bool "OpenRISC NS16550 console"
 	depends on OPENRISC
 
+config DEBUG_MVEBU_UART
+	bool "mvebu console"
+	depends on ARCH_MVEBU
+
+config DEBUG_CLPS711X_UART
+	bool "CLPS711x debug UART"
+	depends on ARCH_CLPS711X
+
+config DEBUG_MXS_UART
+	bool "MXS debug UART"
+	depends on ARCH_MXS
+
+config DEBUG_VERSATILE_UART
+	bool "Versatile debug UART"
+	depends on ARCH_VERSATILE
+
+config DEBUG_TEGRA_UART
+	bool "Tegra debug UART"
+	depends on ARCH_TEGRA
+
+config DEBUG_SOCFPGA_UART
+	bool "SoCFPGA debug UART"
+	depends on ARCH_SOCFPGA
+
 endchoice
 
 config DEBUG_LL_NS16550

-- 
2.47.3




More information about the barebox mailing list