diff options
author | Tom Rini <trini@konsulko.com> | 2018-05-24 09:54:25 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-05-24 09:54:25 -0400 |
commit | 8730d012c9bd92d6412b3ef6e33b40c5df00f225 (patch) | |
tree | c6db406267e19a4c59e0a49565c284822ff39b6f /drivers/serial/serial_arc.c | |
parent | 7049f620002b18eef4ffc6512efafac4177e1b01 (diff) | |
parent | 0556b569e52caf3ab519c340435236e4940cc1cd (diff) |
Merge tag 'arc-uart-updates-for-2018.07-rc1' of git://git.denx.de/u-boot-arc
Add support for DEBUG_UART on ARC devboards
This required us to do 2 things:
1) Insert a call to debug_uart_init() in early boot code
2) Convert serial_arc to Kconfig
Once both items above are done we just patched defconfigs.
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 da4a07ab2f6..925f0c25554 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 |