serial: mxc: Add debug uart support

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>
This commit is contained in:
Jagan Teki 2017-06-06 05:31:51 +00:00 committed by Stefano Babic
parent 52c14cabda
commit 61366b71a8
3 changed files with 38 additions and 0 deletions

View File

@ -45,3 +45,7 @@ CONFIG_PINCTRL_IMX6=y
CONFIG_MXC_UART=y CONFIG_MXC_UART=y
CONFIG_IMX_THERMAL=y CONFIG_IMX_THERMAL=y
CONFIG_VIDEO_IPUV3=y CONFIG_VIDEO_IPUV3=y
CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_MXC=y
CONFIG_DEBUG_UART_BASE=0x021f0000
CONFIG_DEBUG_UART_CLOCK=24000000

View File

@ -248,6 +248,14 @@ config DEBUG_UART_PIC32
will need to provide parameters to make this work. The driver will will need to provide parameters to make this work. The driver will
be available until the real driver model serial is running. 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 config DEBUG_UART_UNIPHIER
bool "UniPhier on-chip UART" bool "UniPhier on-chip UART"
depends on ARCH_UNIPHIER depends on ARCH_UNIPHIER

View File

@ -357,3 +357,29 @@ U_BOOT_DRIVER(serial_mxc) = {
.flags = DM_FLAG_PRE_RELOC, .flags = DM_FLAG_PRE_RELOC,
}; };
#endif #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