[U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata

Marek Vasut marex at denx.de
Wed Feb 1 09:46:52 CET 2017


On 02/01/2017 02:15 AM, Oleksandr Tymoshenko wrote:
> Default fcr value is initialized in ns16550_serial_ofdata_to_platdata
> but this function is only called if OF_CONTROL option is enabled while
> the field is used whenever DM_SERIAL is set. So for configs that
> do not have OF_CONTROL default fcr value is set to zero which leads
> to loosing characters when serial port input is faster than reading
> routine i.e. when copy-pasting long line to U-Boot prompt.
> 
> As a fix initialize fcr field in probe method
> 
> Signed-off-by: Oleksandr Tymoshenko <gonzo at bluezbox.com>
> Cc: Marek Vasut <marex at denx.de>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Simon Glass <sjg at chromium.org>

This looks like the correct fix for the FCR flub instead of patching
each and every board/cpu file.

> ---
>  drivers/serial/ns16550.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> index 2df4a1f..2b30a4f 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -352,6 +352,7 @@ int ns16550_serial_probe(struct udevice *dev)
>  	struct NS16550 *const com_port = dev_get_priv(dev);
>  
>  	com_port->plat = dev_get_platdata(dev);
> +	com_port->plat->fcr = UART_FCR_DEFVAL;
>  	NS16550_init(com_port, -1);
>  
>  	return 0;
> @@ -437,7 +438,6 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
>  		return -EINVAL;
>  	}
>  
> -	plat->fcr = UART_FCR_DEFVAL;
>  	if (port_type == PORT_JZ4780)
>  		plat->fcr |= UART_FCR_UME;
>  
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list