[U-Boot] [PATCH 18/19] serial: ns16550: Support debug UART
    Simon Glass 
    sjg at chromium.org
       
    Wed Dec 17 05:47:51 CET 2014
    
    
  
Hi Masahiro,
On 15 December 2014 at 21:39, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
> Hi Simon,
>
>
> On Mon, 15 Dec 2014 07:19:53 -0700
> Simon Glass <sjg at 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().
Yes I should fix that.
>
>
>
>> +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().
Ditto.
>
>
>
> What does this patch save?
>
> It looks like the driver code is just getting dirtier.
See my other patch for an explanation. We could add this feature to
any serial driver.
Regards,
Simon
    
    
More information about the U-Boot
mailing list