
16 Dec
2014
16 Dec
'14
5:39 a.m.
Hi Simon,
On Mon, 15 Dec 2014 07:19:53 -0700 Simon Glass sjg@chromium.org wrote:
+#ifdef CONFIG_DEBUG_UART_NS16550 +void debug_uart_init(void) +{
- struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;
- int baud_divisor;
- baud_divisor = calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
CONFIG_BAUDRATE);
- writeb(CONFIG_SYS_NS16550_IER, &com_port->ier);
- writeb(UART_MCRVAL, &com_port->mcr);
- writeb(UART_FCRVAL, &com_port->fcr);
- writeb(UART_LCR_BKSE | UART_LCRVAL, &com_port->lcr);
- writeb(baud_divisor & 0xff, &com_port->dll);
- writeb((baud_divisor >> 8) & 0xff, &com_port->dlm);
- writeb(UART_LCRVAL, &com_port->lcr);
+}
This function is duplicating NS16550_init() and NS16550_setbrg().
+static inline void _debug_uart_putc(int ch) +{
- struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;
- while (!(readb(&com_port->lsr) & UART_LSR_THRE))
;
- writeb(ch, &com_port->thr);
+}
This is duplicating ns16550_serial_putc().
What does this patch save?
It looks like the driver code is just getting dirtier.
Best Regards Masahiro Yamada