All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] common/xyzModem.c: Fix delay timeout calculation
@ 2016-09-20 15:39 Andrew F. Davis
  2016-09-23 19:57 ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew F. Davis @ 2016-09-20 15:39 UTC (permalink / raw)
  To: u-boot

When waiting for input in CYGACC_COMM_IF_GETC_TIMEOUT we delay 2
seconds by incrementing and checking a counter variable every 20
uSeconds. The overhead in the loop calling tstc() thousands of times
causes the timeout to be closer to 20 seconds. Delay longer per iteration
to reduce overhead and bring the timeout back closer to the correct time.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 common/xyzModem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/xyzModem.c b/common/xyzModem.c
index 5656aac..390abdc 100644
--- a/common/xyzModem.c
+++ b/common/xyzModem.c
@@ -73,9 +73,9 @@ CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c)
 {
 #define DELAY 20
   unsigned long counter = 0;
-  while (!tstc () && (counter < xyzModem_CHAR_TIMEOUT * 1000 / DELAY))
+  while (!tstc () && (counter < xyzModem_CHAR_TIMEOUT / DELAY))
     {
-      udelay (DELAY);
+      mdelay (DELAY);
       counter++;
     }
   if (tstc ())
-- 
2.9.3

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

* [U-Boot] [PATCH v2] common/xyzModem.c: Fix delay timeout calculation
  2016-09-20 15:39 [U-Boot] [PATCH v2] common/xyzModem.c: Fix delay timeout calculation Andrew F. Davis
@ 2016-09-23 19:57 ` Tom Rini
  2016-09-27 16:27   ` Andrew F. Davis
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2016-09-23 19:57 UTC (permalink / raw)
  To: u-boot

On Tue, Sep 20, 2016 at 10:39:49AM -0500, Andrew F. Davis wrote:

> When waiting for input in CYGACC_COMM_IF_GETC_TIMEOUT we delay 2
> seconds by incrementing and checking a counter variable every 20
> uSeconds. The overhead in the loop calling tstc() thousands of times
> causes the timeout to be closer to 20 seconds. Delay longer per iteration
> to reduce overhead and bring the timeout back closer to the correct time.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
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/20160923/788fc323/attachment.sig>

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

* [U-Boot] [PATCH v2] common/xyzModem.c: Fix delay timeout calculation
  2016-09-23 19:57 ` Tom Rini
@ 2016-09-27 16:27   ` Andrew F. Davis
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew F. Davis @ 2016-09-27 16:27 UTC (permalink / raw)
  To: u-boot

On 09/23/2016 02:57 PM, Tom Rini wrote:
> On Tue, Sep 20, 2016 at 10:39:49AM -0500, Andrew F. Davis wrote:
> 
>> When waiting for input in CYGACC_COMM_IF_GETC_TIMEOUT we delay 2
>> seconds by incrementing and checking a counter variable every 20
>> uSeconds. The overhead in the loop calling tstc() thousands of times
>> causes the timeout to be closer to 20 seconds. Delay longer per iteration
>> to reduce overhead and bring the timeout back closer to the correct time.
>>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
> 
> Reviewed-by: Tom Rini <trini@konsulko.com>
> 

I was just informed that this may be breaking UART boot on a couple of
our platforms, so this shouldn't be taken until I can get this figured out.

Thanks,
Andrew

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

end of thread, other threads:[~2016-09-27 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-20 15:39 [U-Boot] [PATCH v2] common/xyzModem.c: Fix delay timeout calculation Andrew F. Davis
2016-09-23 19:57 ` Tom Rini
2016-09-27 16:27   ` Andrew F. Davis

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.