Commit 61366b71a8950aae48ce9e00295a16cf65ac4f02
Committed by
Stefano Babic
1 parent
52c14cabda
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
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>
Showing 3 changed files with 38 additions and 0 deletions Side-by-side Diff
configs/imx6qdl_icore_mmc_defconfig
drivers/serial/Kconfig
... | ... | @@ -248,6 +248,14 @@ |
248 | 248 | will need to provide parameters to make this work. The driver will |
249 | 249 | be available until the real driver model serial is running. |
250 | 250 | |
251 | +config DEBUG_UART_MXC | |
252 | + bool "IMX Serial port" | |
253 | + depends on MXC_UART | |
254 | + help | |
255 | + Select this to enable a debug UART using the serial_mxc driver. You | |
256 | + will need to provide parameters to make this work. The driver will | |
257 | + be available until the real driver model serial is running. | |
258 | + | |
251 | 259 | config DEBUG_UART_UNIPHIER |
252 | 260 | bool "UniPhier on-chip UART" |
253 | 261 | depends on ARCH_UNIPHIER |
drivers/serial/serial_mxc.c
... | ... | @@ -357,4 +357,30 @@ |
357 | 357 | .flags = DM_FLAG_PRE_RELOC, |
358 | 358 | }; |
359 | 359 | #endif |
360 | + | |
361 | +#ifdef CONFIG_DEBUG_UART_MXC | |
362 | +#include <debug_uart.h> | |
363 | + | |
364 | +static inline void _debug_uart_init(void) | |
365 | +{ | |
366 | + struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE; | |
367 | + | |
368 | + _mxc_serial_init(base); | |
369 | + _mxc_serial_setbrg(base, CONFIG_DEBUG_UART_CLOCK, | |
370 | + CONFIG_BAUDRATE, false); | |
371 | +} | |
372 | + | |
373 | +static inline void _debug_uart_putc(int ch) | |
374 | +{ | |
375 | + struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE; | |
376 | + | |
377 | + while (!(readl(&base->ts) & UTS_TXEMPTY)) | |
378 | + WATCHDOG_RESET(); | |
379 | + | |
380 | + writel(ch, &base->txd); | |
381 | +} | |
382 | + | |
383 | +DEBUG_UART_FUNCS | |
384 | + | |
385 | +#endif |