]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
serial: mxc: Add debug uart support
authorJagan Teki <jagan@amarulasolutions.com>
Tue, 6 Jun 2017 05:31:51 +0000 (05:31 +0000)
committerStefano Babic <sbabic@denx.de>
Wed, 12 Jul 2017 07:44:22 +0000 (09:44 +0200)
Add support for the debug UART to assist with early debugging.
Enable it for i.CoreM6 as an example.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
configs/imx6qdl_icore_mmc_defconfig
drivers/serial/Kconfig
drivers/serial/serial_mxc.c

index 8c0cc96ba861363e52b7e7df46f361b5f6537d23..2b1bb3d5911677e8a6f06689460cdb2555bdb86c 100644 (file)
@@ -45,3 +45,7 @@ CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
 CONFIG_VIDEO_IPUV3=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_MXC=y
+CONFIG_DEBUG_UART_BASE=0x021f0000
+CONFIG_DEBUG_UART_CLOCK=24000000
index b7dd2ac1038d7ca03454c13c5614478dc7e18aba..97cef7edbda69a08856614270d7d323493e083fc 100644 (file)
@@ -248,6 +248,14 @@ config DEBUG_UART_PIC32
          will need to provide parameters to make this work. The driver will
          be available until the real driver model serial is running.
 
          will need to provide parameters to make this work. The driver will
          be available until the real driver model serial is running.
 
+config DEBUG_UART_MXC
+       bool "IMX Serial port"
+       depends on MXC_UART
+       help
+         Select this to enable a debug UART using the serial_mxc driver. You
+         will need to provide parameters to make this work. The driver will
+         be available until the real driver model serial is running.
+
 config DEBUG_UART_UNIPHIER
        bool "UniPhier on-chip UART"
        depends on ARCH_UNIPHIER
 config DEBUG_UART_UNIPHIER
        bool "UniPhier on-chip UART"
        depends on ARCH_UNIPHIER
index c8c36e5e19cf5167bc6d652768cc1b0fb9354302..cce80a8559e2527f15502cd9e4e07fbb0557403e 100644 (file)
@@ -357,3 +357,29 @@ U_BOOT_DRIVER(serial_mxc) = {
        .flags = DM_FLAG_PRE_RELOC,
 };
 #endif
        .flags = DM_FLAG_PRE_RELOC,
 };
 #endif
+
+#ifdef CONFIG_DEBUG_UART_MXC
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+       struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE;
+
+       _mxc_serial_init(base);
+       _mxc_serial_setbrg(base, CONFIG_DEBUG_UART_CLOCK,
+                          CONFIG_BAUDRATE, false);
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+       struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE;
+
+       while (!(readl(&base->ts) & UTS_TXEMPTY))
+               WATCHDOG_RESET();
+
+       writel(ch, &base->txd);
+}
+
+DEBUG_UART_FUNCS
+
+#endif