diff options
author | Michal Simek <michal.simek@xilinx.com> | 2015-12-14 16:55:10 +0100 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2016-01-27 15:55:49 +0100 |
commit | 4166ba3b2351aa72c372f66a54e9fb92cffbd230 (patch) | |
tree | b02e85c0f7634744bad03a9a30b0acf52c1a3b2a /drivers/serial/serial_xuartlite.c | |
parent | 93768393d71871e4638d613acfdad6ef3cf62561 (diff) |
serial: uartlite: Add support for debug console
Add support for debug console.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Thomas Chou <thomas@wytron.com.tw>
Diffstat (limited to 'drivers/serial/serial_xuartlite.c')
-rw-r--r-- | drivers/serial/serial_xuartlite.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c index 157e14dedc..a2e9303925 100644 --- a/drivers/serial/serial_xuartlite.c +++ b/drivers/serial/serial_xuartlite.c @@ -114,3 +114,29 @@ U_BOOT_DRIVER(serial_uartlite) = { .ops = &uartlite_serial_ops, .flags = DM_FLAG_PRE_RELOC, }; + +#ifdef CONFIG_DEBUG_UART_UARTLITE + +#include <debug_uart.h> + +static inline void _debug_uart_init(void) +{ + struct uartlite *regs = (struct uartlite *)CONFIG_DEBUG_UART_BASE; + + out_be32(®s->control, 0); + out_be32(®s->control, ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX); + in_be32(®s->control); +} + +static inline void _debug_uart_putc(int ch) +{ + struct uartlite *regs = (struct uartlite *)CONFIG_DEBUG_UART_BASE; + + while (in_be32(®s->status) & SR_TX_FIFO_FULL) + ; + + out_be32(®s->tx_fifo, ch & 0xff); +} + +DEBUG_UART_FUNCS +#endif |