[PATCH RFC 05/20] ns16550: Turn on the UME bit if on ARCH_JZ47XX

Lubomir Rintel lkundrak at v3.sk
Wed Nov 18 07:55:01 CET 2020


On Tue, Nov 17, 2020 at 11:29:01PM +0100, Daniel Schwierzeck wrote:
> Am Dienstag, den 17.11.2020, 22:00 +0100 schrieb Lubomir Rintel:
> > The jz47xx serial port is essentially a ns16550 with an extra bit that
> > needs to be turned on. The driver already takes care of it, but not in
> > the early debug config path.
> > 
> > Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
> > ---
> >  drivers/serial/ns16550.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> > index 702109b23b6..0cf667c2731 100644
> > --- a/drivers/serial/ns16550.c
> > +++ b/drivers/serial/ns16550.c
> > @@ -326,6 +326,7 @@ static inline void _debug_uart_init(void)
> >  {
> >  	struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE;
> >  	int baud_divisor;
> > +	int fcr = UART_FCR_DEFVAL;
> >  
> >  	/*
> >  	 * We copy the code from above because it is already horribly messy.
> > @@ -335,9 +336,13 @@ static inline void _debug_uart_init(void)
> >  	 */
> >  	baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
> >  					    CONFIG_BAUDRATE);
> > +
> > +	if (IS_ENABLED(CONFIG_ARCH_JZ47XX))
> > +		fcr |= UART_FCR_UME;
> 
> do you use that driver without CONFIG_OF_CONTROL?

Yes. This is indeed for the debug uart output only. I needed in SPL which
is too constrained for OF_CONTROL to fit on my board, but I think it
could be used to get debug output very early even if OF_CONTROL is
enabled.

I actually tried to indicate that in the patch description, perhaps I
could reword that somehow to make it clearer.

Thank you
Lubo

> There is already code for UME bit on JS4780 when you use the compatible
> "ingenic,jz4780-uart":
> 
> 	plat->fcr = UART_FCR_DEFVAL;
> 	if (port_type == PORT_JZ4780)
> 		plat->fcr |= UART_FCR_UME;
> 
> > +
> >  	serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER);
> >  	serial_dout(&com_port->mcr, UART_MCRVAL);
> > -	serial_dout(&com_port->fcr, UART_FCR_DEFVAL);
> > +	serial_dout(&com_port->fcr, fcr);
> >  
> >  	serial_dout(&com_port->lcr, UART_LCR_BKSE | UART_LCRVAL);
> >  	serial_dout(&com_port->dll, baud_divisor & 0xff);
> -- 
> - Daniel
> 


More information about the U-Boot mailing list