This adds support for debug_ll output on i.MX9 SoCs. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- common/Kconfig | 5 +++++ include/mach/imx/debug_ll.h | 13 +++++++++++++ include/serial/lpuart32.h | 10 ++++++++++ 3 files changed, 28 insertions(+) diff --git a/common/Kconfig b/common/Kconfig index 15c648de5d..792f93d381 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1365,6 +1365,10 @@ config DEBUG_IMX8M_UART Say Y here if you want barebox low-level debugging support on i.MX8M*. +config DEBUG_IMX9_UART + bool "i.MX9 Debug UART" + select DEBUG_IMX_UART + config DEBUG_VEXPRESS_UART bool "Vexpress Debug UART" depends on ARCH_VEXPRESS @@ -1571,6 +1575,7 @@ config DEBUG_IMX_UART_PORT DEBUG_IMX6Q_UART || \ DEBUG_IMX7D_UART || \ DEBUG_IMX8M_UART || \ + DEBUG_IMX9_UART || \ DEBUG_VF610_UART default 1 depends on ARCH_IMX diff --git a/include/mach/imx/debug_ll.h b/include/mach/imx/debug_ll.h index d25631d116..618cbc784e 100644 --- a/include/mach/imx/debug_ll.h +++ b/include/mach/imx/debug_ll.h @@ -18,10 +18,12 @@ #include <mach/imx/imx6-regs.h> #include <mach/imx/imx7-regs.h> #include <mach/imx/imx8m-regs.h> +#include <mach/imx/imx9-regs.h> #include <mach/imx/vf610-regs.h> #include <serial/imx-uart.h> #include <serial/lpuart.h> +#include <serial/lpuart32.h> #ifdef CONFIG_DEBUG_IMX_UART @@ -54,6 +56,8 @@ #define IMX_DEBUG_SOC MX8M #elif defined CONFIG_DEBUG_VF610_UART #define IMX_DEBUG_SOC VF610 +#elif defined CONFIG_DEBUG_IMX9_UART +#define IMX_DEBUG_SOC MX9 #else #error "unknown i.MX debug uart soc type" #endif @@ -107,6 +111,13 @@ static inline void imx8m_uart_setup_ll(void) imx8m_uart_setup(base); } +static inline void imx9_uart_setup_ll(void) +{ + void *base = IOMEM(IMX_UART_BASE(IMX_DEBUG_SOC, + CONFIG_DEBUG_IMX_UART_PORT)); + lpuart32_setup(base + 0x10, 24000000); +} + static inline void PUTC_LL(int c) { void __iomem *base = IOMEM(IMX_UART_BASE(IMX_DEBUG_SOC, @@ -117,6 +128,8 @@ static inline void PUTC_LL(int c) if (IS_ENABLED(CONFIG_DEBUG_VF610_UART)) lpuart_putc(base, c); + else if (IS_ENABLED(CONFIG_DEBUG_IMX9_UART)) + lpuart32_putc(base + 0x10, c); else imx_uart_putc(base, c); } diff --git a/include/serial/lpuart32.h b/include/serial/lpuart32.h index bcfd067113..12526ee0ae 100644 --- a/include/serial/lpuart32.h +++ b/include/serial/lpuart32.h @@ -155,4 +155,14 @@ static inline void lpuart32_putc(void __iomem *base, int c) writel(c, base + LPUART32_UARTDATA); } +static inline void imx9_uart_setup(void __iomem *uartbase) +{ + /* + * On i.MX9 the registers start at offset 0x10 + */ + BUG_ON((unsigned long)uartbase & 0x10); + + lpuart32_setup(uartbase + 0x10, 24000000); +} + #endif -- 2.39.2