[PATCH master 3/4] ARM: k3: define debug_ll_write_reg only on CONFIG_DEBUG_AM62X_UART=y

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 22 00:55:18 PDT 2025


From: Ahmad Fatoum <a.fatoum at barebox.org>

Defining debug_ll_read_reg unconditionally for K3 can clash with other
debug_ll implementations, so move it into the include guard.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 include/mach/k3/debug_ll.h | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/include/mach/k3/debug_ll.h b/include/mach/k3/debug_ll.h
index 13321c61346f..0e479d2e7f2b 100644
--- a/include/mach/k3/debug_ll.h
+++ b/include/mach/k3/debug_ll.h
@@ -2,6 +2,20 @@
 #define __MACH_K3_DEBUG_LL_H__
 #include <io.h>
 
+#define AM62X_UART_UART0_BASE	0x02800000
+#define AM62X_UART_UART1_BASE	0x02810000
+#define AM62X_UART_UART2_BASE	0x02820000
+#define AM62X_UART_UART3_BASE	0x02830000
+#define AM62X_UART_UART4_BASE	0x02840000
+#define AM62X_UART_UART5_BASE	0x02850000
+#define AM62X_UART_UART6_BASE	0x02860000
+
+#if defined CONFIG_DEBUG_AM62X_UART
+#define K3_DEBUG_SOC AM62X_UART
+
+#define __K3_UART_BASE(soc, num) soc##_UART##num##_BASE
+#define K3_UART_BASE(soc, num) __K3_UART_BASE(soc, num)
+
 static inline uint8_t debug_ll_read_reg(void __iomem *base, int reg)
 {
 	return readb(base + (reg << 2));
@@ -22,25 +36,6 @@ static inline void k3_debug_ll_init(void __iomem *base)
 	debug_ll_write_reg(base, 8, 0x00);
 }
 
-#define AM62X_UART_UART0_BASE	0x02800000
-#define AM62X_UART_UART1_BASE	0x02810000
-#define AM62X_UART_UART2_BASE	0x02820000
-#define AM62X_UART_UART3_BASE	0x02830000
-#define AM62X_UART_UART4_BASE	0x02840000
-#define AM62X_UART_UART5_BASE	0x02850000
-#define AM62X_UART_UART6_BASE	0x02860000
-
-#if defined CONFIG_DEBUG_AM62X_UART
-#define K3_DEBUG_SOC AM62X_UART
-
-#define __K3_UART_BASE(soc, num) soc##_UART##num##_BASE
-#define K3_UART_BASE(soc, num) __K3_UART_BASE(soc, num)
-
-static inline void debug_ll_init(void)
-{
-	/* already configured */
-}
-
 static inline void PUTC_LL(int c)
 {
 	void __iomem *base = (void *)K3_UART_BASE(K3_DEBUG_SOC,
@@ -49,6 +44,10 @@ static inline void PUTC_LL(int c)
 	debug_ll_ns16550_putc(base, c);
 }
 
+#else
+static inline void k3_debug_ll_init(void __iomem *base)
+{
+}
 #endif
 
 #endif /* __MACH_K3_DEBUG_LL_H__ */
-- 
2.39.5




More information about the barebox mailing list