From: Jagan Teki <jagannadh.teki@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/7] serial: mxc: Add debug uart support
Date: Tue, 6 Jun 2017 05:31:51 +0000 [thread overview]
Message-ID: <1496727111-3655-8-git-send-email-jteki@openedev.com> (raw)
In-Reply-To: <1496727111-3655-1-git-send-email-jteki@openedev.com>
From: Jagan Teki <jagan@amarulasolutions.com>
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>
---
configs/imx6qdl_icore_mmc_defconfig | 4 ++++
drivers/serial/Kconfig | 8 ++++++++
drivers/serial/serial_mxc.c | 26 ++++++++++++++++++++++++++
3 files changed, 38 insertions(+)
diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig
index 4ab1fac..24010ec 100644
--- a/configs/imx6qdl_icore_mmc_defconfig
+++ b/configs/imx6qdl_icore_mmc_defconfig
@@ -44,3 +44,7 @@ CONFIG_IMX_THERMAL=y
CONFIG_VIDEO_IPUV3=y
CONFIG_PHYLIB=y
CONFIG_PHY_SMSC=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_MXC=y
+CONFIG_DEBUG_UART_BASE=0x021f0000
+CONFIG_DEBUG_UART_CLOCK=24000000
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 58fc7cd..32a3374 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -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.
+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
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 0bcd15c..18ff421 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -357,3 +357,29 @@ U_BOOT_DRIVER(serial_mxc) = {
.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
--
1.9.1
next prev parent reply other threads:[~2017-06-06 5:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-06 5:31 [U-Boot] [PATCH 0/7] serial: mxc: Add debug uart support Jagan Teki
2017-06-06 5:31 ` [U-Boot] [PATCH 1/7] serial: mxc: Add common mxc_uart reg space Jagan Teki
2017-06-06 21:08 ` Simon Glass
2017-06-29 8:28 ` Stefano Babic
2017-06-06 5:31 ` [U-Boot] [PATCH 2/7] serial: mxc: Use RFDIV in dm-code Jagan Teki
2017-06-06 21:08 ` Simon Glass
2017-06-06 5:31 ` [U-Boot] [PATCH 3/7] serial: mxc: Move cr1 and cr2 write to mxc_serial_setbrg Jagan Teki
2017-06-06 21:09 ` Simon Glass
2017-06-06 5:31 ` [U-Boot] [PATCH 4/7] serial: mxc: Move common init into _mxc_serial_init Jagan Teki
2017-06-06 21:09 ` Simon Glass
2017-06-06 5:31 ` [U-Boot] [PATCH 5/7] serial: mxc: Move common baud gen into _mxc_serial_setbrg Jagan Teki
2017-06-06 21:09 ` Simon Glass
2017-06-06 5:31 ` [U-Boot] [PATCH 6/7] serial: mxc: Code cleanup Jagan Teki
2017-06-06 21:09 ` Simon Glass
2017-06-06 5:31 ` Jagan Teki [this message]
2017-06-06 21:09 ` [U-Boot] [PATCH 7/7] serial: mxc: Add debug uart support Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496727111-3655-8-git-send-email-jteki@openedev.com \
--to=jagannadh.teki@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox