All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata
@ 2017-02-01  1:15 Oleksandr Tymoshenko
  2017-02-01  8:46 ` Marek Vasut
  2017-02-01 13:12 ` Tom Rini
  0 siblings, 2 replies; 6+ messages in thread
From: Oleksandr Tymoshenko @ 2017-02-01  1:15 UTC (permalink / raw)
  To: u-boot

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@bluezbox.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
---
 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;
 
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata
  2017-02-01  1:15 [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata Oleksandr Tymoshenko
@ 2017-02-01  8:46 ` Marek Vasut
  2017-02-01 13:12 ` Tom Rini
  1 sibling, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2017-02-01  8:46 UTC (permalink / raw)
  To: u-boot

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@bluezbox.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Simon Glass <sjg@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata
  2017-02-01  1:15 [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata Oleksandr Tymoshenko
  2017-02-01  8:46 ` Marek Vasut
@ 2017-02-01 13:12 ` Tom Rini
  2017-02-01 18:52   ` Oleksandr Tymoshenko
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Rini @ 2017-02-01 13:12 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 31, 2017 at 05:15:20PM -0800, 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@bluezbox.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Simon Glass <sjg@chromium.org>

Are you still seeing this with v2017.03-rc1?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170201/9612247f/attachment.sig>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata
  2017-02-01 13:12 ` Tom Rini
@ 2017-02-01 18:52   ` Oleksandr Tymoshenko
  2017-02-02  5:13     ` Heiko Schocher
  0 siblings, 1 reply; 6+ messages in thread
From: Oleksandr Tymoshenko @ 2017-02-01 18:52 UTC (permalink / raw)
  To: u-boot

Tom Rini (trini at konsulko.com) wrote:
> On Tue, Jan 31, 2017 at 05:15:20PM -0800, 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@bluezbox.com>
> > Cc: Marek Vasut <marex@denx.de>
> > Cc: Tom Rini <trini@konsulko.com>
> > Cc: Simon Glass <sjg@chromium.org>
> 
> Are you still seeing this with v2017.03-rc1?  Thanks!

No, this bug is not reproducible on v2017.03-rc1, I believe 17fa032671
fixed it. Not sure how I missed that patch I am pretty sure I tested my
BBB with master branch.

Thanks

-- 
gonzo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata
  2017-02-01 18:52   ` Oleksandr Tymoshenko
@ 2017-02-02  5:13     ` Heiko Schocher
  2017-02-02  5:36       ` Oleksandr Tymoshenko
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Schocher @ 2017-02-02  5:13 UTC (permalink / raw)
  To: u-boot

Hello Oleksandr,

Am 01.02.2017 um 19:52 schrieb Oleksandr Tymoshenko:
> Tom Rini (trini at konsulko.com) wrote:
>> On Tue, Jan 31, 2017 at 05:15:20PM -0800, 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@bluezbox.com>
>>> Cc: Marek Vasut <marex@denx.de>
>>> Cc: Tom Rini <trini@konsulko.com>
>>> Cc: Simon Glass <sjg@chromium.org>
>>
>> Are you still seeing this with v2017.03-rc1?  Thanks!
>
> No, this bug is not reproducible on v2017.03-rc1, I believe 17fa032671
> fixed it. Not sure how I missed that patch I am pretty sure I tested my
> BBB with master branch.

Yes commit 17fa032671 fixed this issue. How do you test? You must
type very fast, or copy&paste a long command ...

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata
  2017-02-02  5:13     ` Heiko Schocher
@ 2017-02-02  5:36       ` Oleksandr Tymoshenko
  0 siblings, 0 replies; 6+ messages in thread
From: Oleksandr Tymoshenko @ 2017-02-02  5:36 UTC (permalink / raw)
  To: u-boot

Heiko Schocher (hs at denx.de) wrote:
> Hello Oleksandr,
> 
> Am 01.02.2017 um 19:52 schrieb Oleksandr Tymoshenko:
> > Tom Rini (trini at konsulko.com) wrote:
> >> On Tue, Jan 31, 2017 at 05:15:20PM -0800, 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@bluezbox.com>
> >>> Cc: Marek Vasut <marex@denx.de>
> >>> Cc: Tom Rini <trini@konsulko.com>
> >>> Cc: Simon Glass <sjg@chromium.org>
> >>
> >> Are you still seeing this with v2017.03-rc1?  Thanks!
> >
> > No, this bug is not reproducible on v2017.03-rc1, I believe 17fa032671
> > fixed it. Not sure how I missed that patch I am pretty sure I tested my
> > BBB with master branch.
> 
> Yes commit 17fa032671 fixed this issue. How do you test? You must
> type very fast, or copy&paste a long command ...

Hi Heiko,

I copy-pasted long lines for my test. I think I used 2017.01 for my
test, not master. That's why I didn't realise that the bug is fixed
in the latest version.

-- 
gonzo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-02  5:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-01  1:15 [U-Boot] [PATCH] serial: 16550: properly initialize fcr field of ns16550_platdata Oleksandr Tymoshenko
2017-02-01  8:46 ` Marek Vasut
2017-02-01 13:12 ` Tom Rini
2017-02-01 18:52   ` Oleksandr Tymoshenko
2017-02-02  5:13     ` Heiko Schocher
2017-02-02  5:36       ` Oleksandr Tymoshenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.