diff options
author | Alexey Brodkin <abrodkin@synopsys.com> | 2018-05-21 16:42:07 +0300 |
---|---|---|
committer | Alexey Brodkin <abrodkin@synopsys.com> | 2018-05-24 15:59:17 +0300 |
commit | 54705016ba705601acd32e04ff4e28b82f7ce71a (patch) | |
tree | 26cdaecd5d444bbaac2c2417f65a9b25538e3ba1 /drivers/serial/serial_arc.c | |
parent | d7ac185fd840d1406fcafc1b412482138475af82 (diff) |
serial/serial_arc: Implement debug serial
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Diffstat (limited to 'drivers/serial/serial_arc.c')
-rw-r--r-- | drivers/serial/serial_arc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c index da4a07ab2f..925f0c2555 100644 --- a/drivers/serial/serial_arc.c +++ b/drivers/serial/serial_arc.c @@ -130,3 +130,29 @@ U_BOOT_DRIVER(serial_arc) = { .ops = &arc_serial_ops, .flags = DM_FLAG_PRE_RELOC, }; + +#ifdef CONFIG_DEBUG_ARC_SERIAL +#include <debug_uart.h> + +static inline void _debug_uart_init(void) +{ + struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE; + int arc_console_baud = CONFIG_DEBUG_UART_CLOCK / (CONFIG_BAUDRATE * 4) - 1; + + writeb(arc_console_baud & 0xff, ®s->baudl); + writeb((arc_console_baud & 0xff00) >> 8, ®s->baudh); +} + +static inline void _debug_uart_putc(int c) +{ + struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE; + + while (!(readb(®s->status) & UART_TXEMPTY)) + ; + + writeb(c, ®s->data); +} + +DEBUG_UART_FUNCS + +#endif |