* [PATCH 1/3] debug_ll: give PUTC_LL a common prototype
2026-06-01 12:29 [PATCH 0/3] debug_ll: Cleanup conflicts for multiple SoCs Sascha Hauer
@ 2026-06-01 12:29 ` Sascha Hauer
2026-06-01 12:29 ` [PATCH 2/3] debug_ll: Add Kconfig options for debug uarts that have none Sascha Hauer
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2026-06-01 12:29 UTC (permalink / raw)
To: BAREBOX
Some PUTC_LL() implementations expect an integer as argument and others
a char. For consistency change all to expect a char argument.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/mips/mach-ath79/include/mach/debug_ll_ar9331.h | 2 +-
arch/openrisc/include/asm/debug_ll.h | 2 +-
arch/powerpc/include/asm/debug_ll.h | 2 +-
include/mach/bcm283x/debug_ll.h | 4 ++--
include/mach/imx/debug_ll.h | 2 +-
include/mach/k3/debug_ll.h | 2 +-
include/mach/layerscape/debug_ll.h | 2 +-
include/mach/mxs/debug_ll.h | 2 +-
include/mach/omap/debug_ll.h | 2 +-
include/mach/rockchip/debug_ll.h | 2 +-
include/mach/stm32mp/debug_ll.h | 2 +-
include/mach/zynq/debug_ll.h | 2 +-
include/mach/zynqmp/debug_ll.h | 2 +-
13 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/mips/mach-ath79/include/mach/debug_ll_ar9331.h b/arch/mips/mach-ath79/include/mach/debug_ll_ar9331.h
index cd32e2d1d1..71978164c6 100644
--- a/arch/mips/mach-ath79/include/mach/debug_ll_ar9331.h
+++ b/arch/mips/mach-ath79/include/mach/debug_ll_ar9331.h
@@ -34,7 +34,7 @@ static inline u32 ar933x_debug_ll_readl(int offset)
return __raw_readl((u8 *)DEBUG_LL_UART_ADDR + offset);
}
-static inline void PUTC_LL(int ch)
+static inline void PUTC_LL(char ch)
{
u32 data;
diff --git a/arch/openrisc/include/asm/debug_ll.h b/arch/openrisc/include/asm/debug_ll.h
index 35d4360940..cd3b976e8a 100644
--- a/arch/openrisc/include/asm/debug_ll.h
+++ b/arch/openrisc/include/asm/debug_ll.h
@@ -26,7 +26,7 @@ static inline void debug_ll_init(void)
/* already configured */
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
debug_ll_ns16550_putc(DEBUG_LL_UART_BASE, c);
}
diff --git a/arch/powerpc/include/asm/debug_ll.h b/arch/powerpc/include/asm/debug_ll.h
index 910db2808d..0dc83b9cac 100644
--- a/arch/powerpc/include/asm/debug_ll.h
+++ b/arch/powerpc/include/asm/debug_ll.h
@@ -36,7 +36,7 @@ static inline void debug_ll_init(void)
debug_ll_ns16550_init(DEBUG_LL_UART_BASE, divisor);
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
debug_ll_ns16550_putc(DEBUG_LL_UART_BASE, c);
}
diff --git a/include/mach/bcm283x/debug_ll.h b/include/mach/bcm283x/debug_ll.h
index 8bbff4fd9a..a6a3b8f088 100644
--- a/include/mach/bcm283x/debug_ll.h
+++ b/include/mach/bcm283x/debug_ll.h
@@ -70,7 +70,7 @@ static inline void debug_ll_init(void)
debug_ll_ns16550_init(base, divisor);
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = IOMEM(BCM2836_MINIUART_BASE);
@@ -96,7 +96,7 @@ static inline void debug_ll_init(void)
/* Configured by ROM */
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = IOMEM(BCM2711_MINIUART_BASE);
diff --git a/include/mach/imx/debug_ll.h b/include/mach/imx/debug_ll.h
index 05e16a8f02..0f6500fd2e 100644
--- a/include/mach/imx/debug_ll.h
+++ b/include/mach/imx/debug_ll.h
@@ -117,7 +117,7 @@ static inline void imx9_uart_setup_ll(void)
lpuart32_setup(base + 0x10, 24000000);
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = IOMEM(IMX_UART_BASE(IMX_DEBUG_SOC,
CONFIG_DEBUG_IMX_UART_PORT));
diff --git a/include/mach/k3/debug_ll.h b/include/mach/k3/debug_ll.h
index 13321c6134..acbe6c230b 100644
--- a/include/mach/k3/debug_ll.h
+++ b/include/mach/k3/debug_ll.h
@@ -41,7 +41,7 @@ static inline void debug_ll_init(void)
/* already configured */
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = (void *)K3_UART_BASE(K3_DEBUG_SOC,
CONFIG_DEBUG_K3_UART_PORT);
diff --git a/include/mach/layerscape/debug_ll.h b/include/mach/layerscape/debug_ll.h
index c54a4810a4..9c2e84dcf8 100644
--- a/include/mach/layerscape/debug_ll.h
+++ b/include/mach/layerscape/debug_ll.h
@@ -72,7 +72,7 @@ static inline void ls102xa_debug_ll_init(void)
ls102xa_uart_setup(base);
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = IOMEM(LS_UART_BASE(CONFIG_DEBUG_LAYERSCAPE_UART_PORT));
diff --git a/include/mach/mxs/debug_ll.h b/include/mach/mxs/debug_ll.h
index 41658ba0c5..f38b1486a1 100644
--- a/include/mach/mxs/debug_ll.h
+++ b/include/mach/mxs/debug_ll.h
@@ -11,7 +11,7 @@
# define TXFE (1 << 7)
# define TXFF (1 << 5)
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = (void *)IMX_DBGUART_BASE;
diff --git a/include/mach/omap/debug_ll.h b/include/mach/omap/debug_ll.h
index a95c1bf140..c0af1abac7 100644
--- a/include/mach/omap/debug_ll.h
+++ b/include/mach/omap/debug_ll.h
@@ -60,7 +60,7 @@ static inline void omap_debug_ll_init(void)
debug_ll_write_reg(base, NS16550_MDR, 0);
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = (void *)OMAP_UART_BASE(OMAP_DEBUG_SOC,
CONFIG_DEBUG_OMAP_UART_PORT);
diff --git a/include/mach/rockchip/debug_ll.h b/include/mach/rockchip/debug_ll.h
index 941d1505e5..c2392d71e4 100644
--- a/include/mach/rockchip/debug_ll.h
+++ b/include/mach/rockchip/debug_ll.h
@@ -77,7 +77,7 @@ static inline void rockchip_debug_ll_init(void)
debug_ll_ns16550_init(base, divisor);
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = IOMEM(RK_UART_BASE(RK_DEBUG_SOC,
CONFIG_DEBUG_ROCKCHIP_UART_PORT));
diff --git a/include/mach/stm32mp/debug_ll.h b/include/mach/stm32mp/debug_ll.h
index 0d88910c13..c3ef3255c7 100644
--- a/include/mach/stm32mp/debug_ll.h
+++ b/include/mach/stm32mp/debug_ll.h
@@ -28,7 +28,7 @@ static inline void stm32_serial_putc(void *ctx, int c)
while ((readl(base + ISR_OFFSET) & USART_ISR_TXE) == 0);
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
stm32_serial_putc(IOMEM(DEBUG_LL_UART_ADDR), c);
}
diff --git a/include/mach/zynq/debug_ll.h b/include/mach/zynq/debug_ll.h
index 3105211c1b..1d322a6aa4 100644
--- a/include/mach/zynq/debug_ll.h
+++ b/include/mach/zynq/debug_ll.h
@@ -23,7 +23,7 @@
#define ZYNQ_UART_STS_TFUL (1 << 4)
#define ZYNQ_UART_TXDIS (1 << 5)
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
void __iomem *base = (void __iomem *)ZYNQ_DEBUG_LL_UART_BASE;
diff --git a/include/mach/zynqmp/debug_ll.h b/include/mach/zynqmp/debug_ll.h
index cc94d3ce54..c9e9547812 100644
--- a/include/mach/zynqmp/debug_ll.h
+++ b/include/mach/zynqmp/debug_ll.h
@@ -28,7 +28,7 @@ static inline void cdns_serial_putc(void *ctx, int c)
writel(c, base + 0x30);
}
-static inline void PUTC_LL(int c)
+static inline void PUTC_LL(char c)
{
cdns_serial_putc(IOMEM(ZYNQMP_DEBUG_LL_UART_BASE), c);
}
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/3] debug_ll: Add Kconfig options for debug uarts that have none
2026-06-01 12:29 [PATCH 0/3] debug_ll: Cleanup conflicts for multiple SoCs Sascha Hauer
2026-06-01 12:29 ` [PATCH 1/3] debug_ll: give PUTC_LL a common prototype Sascha Hauer
@ 2026-06-01 12:29 ` Sascha Hauer
2026-06-01 12:29 ` [PATCH 3/3] debug_ll: pl011: define PUTC_LL only when requested Sascha Hauer
2026-06-04 5:55 ` [PATCH 0/3] debug_ll: Cleanup conflicts for multiple SoCs Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2026-06-01 12:29 UTC (permalink / raw)
To: BAREBOX
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@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
^ permalink raw reply [flat|nested] 5+ messages in thread