[PATCH master] ARM: layerscape: fix layerscape multiarch build with DEBUG_LL

Ahmad Fatoum a.fatoum at pengutronix.de
Thu May 16 23:22:14 PDT 2024


Layerscape was added recently into the CONFIG_ARCH_MULTIARCH (really
multiplatform), but the required changes to DBEUG_LL was omitted, which
breaks DEBUG_LL use for other platforms that aren't layerscape.

Fix this, so DEBUG_LL may be used for either layerscape or other enabled
platforms.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/boards/ls1021aiot/lowlevel.c |  2 ++
 arch/arm/boards/ls1028ardb/lowlevel.c |  1 +
 arch/arm/boards/ls1046ardb/lowlevel.c |  1 +
 arch/arm/boards/tqmls1046a/lowlevel.c |  1 +
 arch/arm/include/asm/debug_ll.h       |  6 ++++--
 common/Kconfig.debug_ll               | 10 +++++++++-
 include/mach/layerscape/debug_ll.h    | 14 ++++++++++++++
 7 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/ls1021aiot/lowlevel.c b/arch/arm/boards/ls1021aiot/lowlevel.c
index 6bba528635a8..d2d4237c3d48 100644
--- a/arch/arm/boards/ls1021aiot/lowlevel.c
+++ b/arch/arm/boards/ls1021aiot/lowlevel.c
@@ -8,6 +8,8 @@
 #include <common.h>
 #include <clock.h>
 #include <debug_ll.h>
+#include <mach/layerscape/debug_ll.h>
+#include <debug_ll.h>
 #include <soc/fsl/fsl_ddr_sdram.h>
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
diff --git a/arch/arm/boards/ls1028ardb/lowlevel.c b/arch/arm/boards/ls1028ardb/lowlevel.c
index e903d9d30196..de6f53d7dc2e 100644
--- a/arch/arm/boards/ls1028ardb/lowlevel.c
+++ b/arch/arm/boards/ls1028ardb/lowlevel.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include <common.h>
+#include <mach/layerscape/debug_ll.h>
 #include <debug_ll.h>
 #include <ddr_spd.h>
 #include <image-metadata.h>
diff --git a/arch/arm/boards/ls1046ardb/lowlevel.c b/arch/arm/boards/ls1046ardb/lowlevel.c
index 56b8320eddb4..c2d3a526bc06 100644
--- a/arch/arm/boards/ls1046ardb/lowlevel.c
+++ b/arch/arm/boards/ls1046ardb/lowlevel.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include <common.h>
+#include <mach/layerscape/debug_ll.h>
 #include <debug_ll.h>
 #include <ddr_spd.h>
 #include <image-metadata.h>
diff --git a/arch/arm/boards/tqmls1046a/lowlevel.c b/arch/arm/boards/tqmls1046a/lowlevel.c
index 9fcb52ea3902..2551a18ec634 100644
--- a/arch/arm/boards/tqmls1046a/lowlevel.c
+++ b/arch/arm/boards/tqmls1046a/lowlevel.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 #include <common.h>
+#include <mach/layerscape/debug_ll.h>
 #include <debug_ll.h>
 #include <soc/fsl/fsl_ddr_sdram.h>
 #include <soc/fsl/immap_lsch2.h>
diff --git a/arch/arm/include/asm/debug_ll.h b/arch/arm/include/asm/debug_ll.h
index 0cc3d28662a3..999f1cb831a8 100644
--- a/arch/arm/include/asm/debug_ll.h
+++ b/arch/arm/include/asm/debug_ll.h
@@ -31,6 +31,10 @@
 #include <mach/bcm283x/debug_ll.h>
 #endif
 
+#ifdef CONFIG_DEBUG_LAYERSCAPE_UART
+#include <mach/layerscape/debug_ll.h>
+#endif
+
 #ifdef CONFIG_DEBUG_QEMU_ARM64_VIRT
 #define DEBUG_LL_UART_ADDR		0x9000000
 #include <debug_ll/pl011.h>
@@ -40,8 +44,6 @@
 #include <mach/zynq/debug_ll.h>
 #elif defined CONFIG_ARCH_VERSATILE
 #include <mach/versatile/debug_ll.h>
-#elif defined CONFIG_ARCH_LAYERSCAPE
-#include <mach/layerscape/debug_ll.h>
 #elif defined CONFIG_ARCH_TEGRA
 #include <mach/tegra/debug_ll.h>
 #elif defined CONFIG_ARCH_SOCFPGA
diff --git a/common/Kconfig.debug_ll b/common/Kconfig.debug_ll
index bdc1a7f3a6dc..29265bfad0f5 100644
--- a/common/Kconfig.debug_ll
+++ b/common/Kconfig.debug_ll
@@ -139,6 +139,14 @@ config DEBUG_IMX9_UART
 	depends on ARCH_IMX93
 	select DEBUG_IMX_UART
 
+
+config DEBUG_LAYERSCAPE_UART
+	bool "Layerscape Debug UART"
+	depends on ARCH_LAYERSCAPE
+	help
+	  Say Y here if you want barebox low-level debugging support
+	  on NXP Layerscape SoCs.
+
 config DEBUG_VEXPRESS_UART
 	bool "Vexpress Debug UART"
 	depends on ARCH_VEXPRESS
@@ -409,7 +417,7 @@ config DEBUG_SOCFPGA_UART_CLOCK
 
 config DEBUG_LAYERSCAPE_UART_PORT
 	int "Layerscape UART port selection"
-	depends on ARCH_LAYERSCAPE
+	depends on DEBUG_LAYERSCAPE_UART
 	default 1
 	help
 	  Select the UART port number used for early debugging here. Port
diff --git a/include/mach/layerscape/debug_ll.h b/include/mach/layerscape/debug_ll.h
index 22c32243406b..c54a4810a4cb 100644
--- a/include/mach/layerscape/debug_ll.h
+++ b/include/mach/layerscape/debug_ll.h
@@ -13,6 +13,8 @@
 #define __LSCH3_UART_BASE(num)	LSCH3_NS16550_COM##num
 #define LSCH3_UART_BASE(num) __LSCH3_UART_BASE(num)
 
+#ifdef CONFIG_DEBUG_LAYERSCAPE_UART
+
 static inline uint8_t debug_ll_read_reg(void __iomem *base, int reg)
 {
 	return readb(base + reg);
@@ -82,4 +84,16 @@ static inline void layerscape_uart_putc(void *base, int c)
 	debug_ll_ns16550_putc(base, c);
 }
 
+#else
+
+static inline void ls1046a_uart_setup(void *base) { }
+static inline void ls1046a_debug_ll_init(void) { }
+static inline void ls1028a_uart_setup(void *base) { }
+static inline void ls1028a_debug_ll_init(void) { }
+static inline void ls102xa_uart_setup(void *base) { }
+static inline void ls102xa_debug_ll_init(void) { }
+static inline void layerscape_uart_putc(void *base, int c) { }
+
+#endif
+
 #endif /* __MACH_LAYERSCAPE_DEBUG_LL_H__ */
-- 
2.39.2




More information about the barebox mailing list