[PATCH 04/22] ARM64: Add support for debug_ll on TI AM62x SoCs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



TI K3 SoCs have ns16550 compatible UARTs. Add lowlevel debugging support
for the AM62x SoC from the K3 family.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 arch/arm/include/asm/debug_ll.h |  2 ++
 common/Kconfig                  | 16 ++++++++++-
 include/mach/k3/debug_ll.h      | 49 +++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 include/mach/k3/debug_ll.h

diff --git a/arch/arm/include/asm/debug_ll.h b/arch/arm/include/asm/debug_ll.h
index a1d5161ccf..98a7d0d839 100644
--- a/arch/arm/include/asm/debug_ll.h
+++ b/arch/arm/include/asm/debug_ll.h
@@ -64,6 +64,8 @@
 #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 b/common/Kconfig
index 50f62b9f9a..3938577987 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1552,6 +1552,10 @@ config DEBUG_SUN20I
 	depends on SOC_ALLWINNER_SUN20I
 	select DEBUG_LL_NS16550
 
+config DEBUG_AM62X_UART
+	bool "Texas Instruments AM62X debug UART"
+	depends on ARCH_K3
+
 config DEBUG_QEMU_ARM64_VIRT
 	bool "QEMU ARM64 Virt PL011 console"
 	depends on ARCH_ARM64_VIRT
@@ -1582,10 +1586,20 @@ config DEBUG_IMX_UART_PORT
 	  Choose UART port on which kernel low-level debug messages
 	  should be output.
 
+config DEBUG_K3_UART_PORT
+	int "K3 Debug UART Port Selection" if DEBUG_AM62X_UART
+	default 0
+	depends on ARCH_K3
+	help
+	  Choose UART port on which kernel low-level debug messages
+	  should be output. Possible values are:
+	  AM62x: 0 - 6
+
 config DEBUG_OMAP_UART_PORT
 	int "OMAP Debug UART Port Selection" if DEBUG_OMAP3_UART || \
 						DEBUG_OMAP4_UART || \
-						DEBUG_AM33XX_UART
+						DEBUG_AM33XX_UART || \
+						DEBUG_AM62X_UART
 	default 1
 	depends on ARCH_OMAP
 	help
diff --git a/include/mach/k3/debug_ll.h b/include/mach/k3/debug_ll.h
new file mode 100644
index 0000000000..2433bb8f2e
--- /dev/null
+++ b/include/mach/k3/debug_ll.h
@@ -0,0 +1,49 @@
+#ifndef __MACH_K3_DEBUG_LL_H__
+#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(int reg)
+{
+	void __iomem *base = (void *)K3_UART_BASE(K3_DEBUG_SOC,
+					CONFIG_DEBUG_K3_UART_PORT);
+
+	return readb(base + (reg << 2));
+}
+
+static inline void debug_ll_write_reg(int reg, uint8_t val)
+{
+	void __iomem *base = (void *)K3_UART_BASE(K3_DEBUG_SOC,
+					CONFIG_DEBUG_K3_UART_PORT);
+
+	writeb(val, base + (reg << 2));
+}
+
+#include <debug_ll/ns16550.h>
+
+static inline void debug_ll_init(void)
+{
+	/* already configured */
+}
+
+static inline void PUTC_LL(int c)
+{
+	debug_ll_ns16550_putc(c);
+}
+
+#endif
+
+#endif /* __MACH_K3_DEBUG_LL_H__ */
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux