debug_ll: Cleanup conflicts for multiple SoCs
Subsystems (10)
Sascha Hauer
maintainercover debug_ll: Cleanup conflicts for multiple SoCs
This cleans up some problems we have with debug_ll when it comes to multi SoC images. debug_ll relies on having exactly one PUTC_LL() implementation available. Most SoCs have their own DEBUG_*_UART Kconfig option and the Kconfig choice around them makes sure only a single debug UART can be selected. Some SoCs do not have a dedicated option though and provide PUTC_LL() whenever the SoC is enabled which can to multiple definitions of PUTC_LL(). Fix that by adding a DEBUG_*_UART option to the SoC that currently do not have one.
Another problem is that pl011.h provides PUTC_LL() and debug_ll_pl011_putc(). The former is needed when included indirectly from debug_ll.h, the latter is needed by board code to specify a putc() to the PBL console. This too ends up in multiple definitions of PUTC_LL().
Both problems are fixed in this series
---
Sascha Hauer (3):
debug_ll: give PUTC_LL a common prototype
debug_ll: Add Kconfig options for debug uarts that have none
debug_ll: pl011: define PUTC_LL only when requested
arch/arm/include/asm/debug_ll.h | 69 ++++++++-------------- .../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 +- common/Kconfig.debug_ll | 28 +++++++++ include/debug_ll.h | 2 + include/debug_ll/pl011.h | 6 +- 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 +- 17 files changed, 69 insertions(+), 64 deletions(-)
---
base-commit: 81fbe2e8d0d445032498a0bfecf9fd270f00985a
change-id: 20260601-debug-ll-conflicts-a5aeab40b99b
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>
Sascha Hauer
maintainerPATCH 1/3 debug_ll: give PUTC_LL a common prototype
Some PUTC_LL() implementations expect an integer as argument and others a char. For consistency change all to expect a char argument.
--- 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(-)
arch/mips/mach-ath79/include/mach/debug_ll_ar9331.h +1 -1
@@ -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;
arch/openrisc/include/asm/debug_ll.h +1 -1
@@ -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); }
arch/powerpc/include/asm/debug_ll.h +1 -1
@@ -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); }
include/mach/bcm283x/debug_ll.h +2 -2
@@ -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 );
include/mach/imx/debug_ll.h +1 -1
@@ -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 ));
include/mach/k3/debug_ll.h +1 -1
@@ -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 );
include/mach/layerscape/debug_ll.h +1 -1
@@ -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 ));
include/mach/mxs/debug_ll.h +1 -1
@@ -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 ;
include/mach/omap/debug_ll.h +1 -1
@@ -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 );
include/mach/rockchip/debug_ll.h +1 -1
@@ -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 ));
include/mach/stm32mp/debug_ll.h +1 -1
@@ -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); }
include/mach/zynq/debug_ll.h +1 -1
@@ -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 ;
include/mach/zynqmp/debug_ll.h +1 -1
@@ -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); }
Signature · 1 line
2.47.3
Sascha Hauer
maintainerPATCH 2/3 debug_ll: Add Kconfig options for debug uarts that have none
In reply to Sascha HauerSome 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.
--- arch/arm/include/asm/debug_ll.h | 69 ++++++++++++++--------------------------- common/Kconfig.debug_ll | 28 +++++++++++++++++ 2 files changed, 52 insertions(+), 45 deletions(-)
arch/arm/include/asm/debug_ll.h +24 -45
@@ -3,66 +3,45 @@#ifndef __ASM_DEBUG_LL_H__#define __ASM_DEBUG_LL_H__ -#ifdef CONFIG_DEBUG_IMX_UART +#if definedCONFIG_DEBUG_IMX_UART #include <mach/imx/debug_ll.h> -#endif - -#ifdef CONFIG_DEBUG_ROCKCHIP_UART +#elif definedCONFIG_DEBUG_ROCKCHIP_UART #include <mach/rockchip/debug_ll.h> -#endif - -#ifdef CONFIG_DEBUG_OMAP_UART +#elif definedCONFIG_DEBUG_OMAP_UART #include <mach/omap/debug_ll.h> -#endif - -#ifdef CONFIG_DEBUG_ZYNQMP_UART +#elif definedCONFIG_DEBUG_ZYNQMP_UART #include <mach/zynqmp/debug_ll.h> -#endif - -#ifdef CONFIG_DEBUG_STM32MP_UART +#elif definedCONFIG_DEBUG_STM32MP_UART #include <mach/stm32mp/debug_ll.h> -#endif - -#if defined(CONFIG_DEBUG_VEXPRESS_UART ) || \ - defined(CONFIG_DEBUG_QEMU_ARM32_VIRT ) +#elif definedCONFIG_DEBUG_VEXPRESS_UART || definedCONFIG_DEBUG_QEMU_ARM32_VIRT #include <mach/vexpress/debug_ll.h> -#endif - -#ifdef CONFIG_DEBUG_BCM283X_UART +#elif definedCONFIG_DEBUG_BCM283X_UART #include <mach/bcm283x/debug_ll.h> -#endif - -#ifdef CONFIG_DEBUG_LAYERSCAPE_UART +#elif definedCONFIG_DEBUG_LAYERSCAPE_UART #include <mach/layerscape/debug_ll.h> -#endif - -#ifdef CONFIG_DEBUG_SEMIHOSTING +#elif definedCONFIG_DEBUG_SEMIHOSTING #include <debug_ll/semihosting.h> -#endif - -#ifdef CONFIG_DEBUG_QEMU_ARM64_VIRT +#elif definedCONFIG_DEBUG_AT91_UART +#include <mach/at91/debug_ll.h> +#elif definedCONFIG_DEBUG_QEMU_ARM64_VIRT #define DEBUG_LL_UART_ADDR 0x9000000#include <debug_ll/pl011.h> -#elif definedCONFIG_ARCH_MVEBU +#elif definedCONFIG_DEBUG_AM62X_UART +#include <mach/k3/debug_ll.h> +#elif definedCONFIG_DEBUG_MVEBU_UART #include <mach/mvebu/debug_ll.h> -#elif definedCONFIG_ARCH_ZYNQ -#include <mach/zynq/debug_ll.h> -#elif definedCONFIG_ARCH_VERSATILE +#elif definedCONFIG_DEBUG_CLPS711X_UART +#include <mach/clps711x/debug_ll.h> +#elif definedCONFIG_DEBUG_MXS_UART +#include <mach/mxs/debug_ll.h> +#elif definedCONFIG_DEBUG_VERSATILE_UART #include <mach/versatile/debug_ll.h> -#elif definedCONFIG_ARCH_TEGRA +#elif definedCONFIG_DEBUG_TEGRA_UART #include <mach/tegra/debug_ll.h> -#elif definedCONFIG_ARCH_SOCFPGA +#elif definedCONFIG_DEBUG_ZYNQ_UART +#include <mach/zynq/debug_ll.h> +#elif definedCONFIG_DEBUG_SOCFPGA_UART #include <mach/socfpga/debug_ll.h> -#elif definedCONFIG_ARCH_PXA -#include <mach/pxa/debug_ll.h> -#elif definedCONFIG_ARCH_MXS -#include <mach/mxs/debug_ll.h> -#elif definedCONFIG_ARCH_CLPS711X -#include <mach/clps711x/debug_ll.h> -#elif definedCONFIG_ARCH_AT91 -#include <mach/at91/debug_ll.h> -#elif definedCONFIG_ARCH_K3 -#include <mach/k3/debug_ll.h> #endif #endif
common/Kconfig.debug_ll +28 -0
@@ -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
Signature · 1 line
2.47.3
Sascha Hauer
maintainerPATCH 3/3 debug_ll: pl011: define PUTC_LL only when requested
In reply to Sascha Hauerpl011.h is mainly included from include/debug_ll.h to provide the PUTC_LL() implementation. It is also included by some boards to get debug_ll_pl011_putc(). If a board includes it and at the same time DEBUG_LL is enabled for another board we end up with conflicting definitions of PUTC_LL(). To prevent this add a #define DEFINE_PUTC_LL to include/debug_ll.h. A debug_ll.h file now may only provide PUTC_LL() when this define is set.
--- include/debug_ll.h | 2 ++ include/debug_ll/pl011.h | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-)
include/debug_ll.h +2 -0
@@ -19,7 +19,9 @@* this initialization. Depending on the PUTC_LL implementation the board might * also hang in PUTC_LL without proper initialization. */ +#define DEFINE_PUTC_LL #include <asm/debug_ll.h> +#undef DEFINE_PUTC_LL#endif #if defined (CONFIG_DEBUG_LL )
include/debug_ll/pl011.h +1 -5
@@ -16,11 +16,7 @@ static inline void debug_ll_pl011_putc(void __iomem *base, int c)writel (c, base + UART01x_DR); } -#ifdef CONFIG_DEBUG_LL - -#ifndef DEBUG_LL_UART_ADDR -#error DEBUG_LL_UART_ADDR is undefined! -#endif +#if defined(CONFIG_DEBUG_LL ) && defined(DEFINE_PUTC_LL )static inline void PUTC_LL (char c) {
Signature · 1 line
2.47.3
Quoted 10 lines · Sascha Hauer
This cleans up some problems we have with
debug_llwhen it comes to multi SoC images.debug_llrelies on having exactly onePUTC_LL()implementation available. Most SoCs have their own DEBUG_*_UARTKconfigoption and theKconfigchoice around them makes sure only a single debug UART can be selected. Some SoCs do not have a dedicated option though and providePUTC_LL()whenever the SoC is enabled which can to multiple definitions ofPUTC_LL(). Fix that by adding a DEBUG_*_UART option to the SoC that currently do not have one.[...]
Applied, thanks!
[1/3] debug_ll: give PUTC_LL a common prototype
https://git.pengutronix.de/cgit/barebox/commit/?id=1bc53b756011 (link may not be stable)
[2/3] debug_ll: Add Kconfig options for debug uarts that have none
https://git.pengutronix.de/cgit/barebox/commit/?id=b804a356447f (link may not be stable)
[3/3] debug_ll: pl011: define PUTC_LL only when requested
https://git.pengutronix.de/cgit/barebox/commit/?id=cc145f79779f (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>