Patchwork [U-Boot,1/1,v3] console: USB: KBD: Fix incorrect autoboot timeout

login
register
mail settings
Submitter Jim Lin
Date Jan. 24, 2013, 11:05 a.m.
Message ID <1359025555-15119-1-git-send-email-jilin@nvidia.com>
Download mbox | patch
Permalink /patch/215313/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Jim Lin - Jan. 24, 2013, 11:05 a.m.
Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if
CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are defined in
configuration file and when tstc() function for checking key pressed
takes longer time than 10 ms (e.g., 50 ms) to finish.

Signed-off-by: Jim Lin <jilin@nvidia.com>
---
Changes in v2:
   - use do-while and get_timer to count timeout.
Changes in v3:
   - revert original udelay(10000); for safety.

 common/main.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
Marek Vasut - Jan. 26, 2013, 3:17 a.m.
Dear Jim Lin,

> Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if
> CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are defined in
> configuration file and when tstc() function for checking key pressed
> takes longer time than 10 ms (e.g., 50 ms) to finish.
> 
> Signed-off-by: Jim Lin <jilin@nvidia.com>

Applied to u-boot-usb
Thanks

Best regards,
Marek Vasut
Wolfgang Denk - Jan. 26, 2013, 1:14 p.m.
Dear Marek Vasut,

In message <201301260417.54768.marex@denx.de> you wrote:
> 
> > Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if
> > CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are defined in
> > configuration file and when tstc() function for checking key pressed
> > takes longer time than 10 ms (e.g., 50 ms) to finish.
> > 
> > Signed-off-by: Jim Lin <jilin@nvidia.com>
> 
> Applied to u-boot-usb

This is common code, and essentially unrelated to USB. It should go
through Tom, not through the USB repo.

Best regards,

Wolfgang Denk
Marek Vasut - Jan. 26, 2013, 5:04 p.m.
Dear Wolfgang Denk,

> Dear Marek Vasut,
> 
> In message <201301260417.54768.marex@denx.de> you wrote:
> > > Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if
> > > CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are defined in
> > > configuration file and when tstc() function for checking key pressed
> > > takes longer time than 10 ms (e.g., 50 ms) to finish.
> > > 
> > > Signed-off-by: Jim Lin <jilin@nvidia.com>
> > 
> > Applied to u-boot-usb
> 
> This is common code, and essentially unrelated to USB. It should go
> through Tom, not through the USB repo.

Either way is fine by me. Maybe the usb: tag should be removed then too.

Best regards,
Marek Vasut
Marek Vasut - Jan. 28, 2013, 4:37 p.m.
Dear Tom Warren,

> Wolfgang,
> 
> > -----Original Message-----
> > From: Wolfgang Denk [mailto:wd@denx.de]
> > Sent: Saturday, January 26, 2013 6:14 AM
> > To: Marek Vasut
> > Cc: Jim Lin; u-boot@lists.denx.de; Tom Warren; trini@ti.com;
> > albert.u.boot@aribaud.net
> > Subject: Re: [PATCH 1/1 v3] console: USB: KBD: Fix incorrect autoboot
> > timeout
> > 
> > Dear Marek Vasut,
> > 
> > In message <201301260417.54768.marex@denx.de> you wrote:
> > > > Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if
> > > > CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are
> > 
> > defined in
> > 
> > > > configuration file and when tstc() function for checking key pressed
> > > > takes longer time than 10 ms (e.g., 50 ms) to finish.
> > > > 
> > > > Signed-off-by: Jim Lin <jilin@nvidia.com>
> > > 
> > > Applied to u-boot-usb
> > 
> > This is common code, and essentially unrelated to USB. It should go
> > through Tom, not through the USB repo.
> 
> Why do you expect this to go thru the Tegra tree?

Tom Rini ... you're not the only Tom around here :p
[...]

Best regards,
Marek Vasut
Tom Rini - Jan. 28, 2013, 4:37 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/28/2013 11:30 AM, Tom Warren wrote:
> Wolfgang,
> 
>> -----Original Message----- From: Wolfgang Denk 
>> [mailto:wd@denx.de] Sent: Saturday, January 26, 2013 6:14 AM To: 
>> Marek Vasut Cc: Jim Lin; u-boot@lists.denx.de; Tom Warren; 
>> trini@ti.com; albert.u.boot@aribaud.net Subject: Re: [PATCH 1/1 
>> v3] console: USB: KBD: Fix incorrect autoboot timeout
>> 
>> Dear Marek Vasut,
>> 
>> In message <201301260417.54768.marex@denx.de> you wrote:
>>> 
>>>> Autoboot timeout defined by CONFIG_BOOTDELAY will not be 
>>>> accurate if CONFIG_USB_KEYBOARD and
>>>> CONFIG_SYS_USB_EVENT_POLL are
>> defined in
>>>> configuration file and when tstc() function for checking key 
>>>> pressed takes longer time than 10 ms (e.g., 50 ms) to 
>>>> finish.
>>>> 
>>>> Signed-off-by: Jim Lin <jilin@nvidia.com>
>>> 
>>> Applied to u-boot-usb
>> 
>> This is common code, and essentially unrelated to USB. It should 
>> go through Tom, not through the USB repo.
> 
> Why do you expect this to go thru the Tegra tree? It's common code 
> - shouldn't it at least go thru my parent repo (ARM), if no 
> directly into u-boot.git/master?

I think he means me :)

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRBqk8AAoJENk4IS6UOR1WnqwQAI0Gpysj7oZjelcF7XDYVOPu
/9rIsi3ZiB5+xtENWTBV08Y8GKpfNIdqMyMqQ3V6kWFSTAVzoNZDtoX3KX01Vvc8
SZ8LDlpQFzW1cCYxLcRdXIOmCXrUoc/qoJgbmYYHrnlZOHmSW1rrZTE2iW9QUe69
4YfmWDD5sVx/fGKXZvbzYu1Nt24qWtCXxGZ0jWBv3mPpvOtnyfePeUKdHhakn8PE
eTI9MUXXsOCX4Sbj2anPKbmp+W4f6bKvl0OpBBQNHSuD5tYthuM/YTpmhwSnaGtr
8QiJNIc7nliSmQh4y0XrIqEaN3KC6oIN6VjO2uM5+TVern9HYIazy+uXXRvQvA5c
wq+Xb2mxIZf4vet9BbAWIpNN7w5I6adnC1APM5I47IMQyxGfesi4cdt6JY/X4M+z
xr9DZo4kcmszhAfSNH12MndQfutH6INcZeOpMFFZe+2h51XrbufUsT3mNwvsmcCT
6+Ef1VoMfpB0ZrCPxk969twm8sXarD2d6KW5uO/jDJF3ENoXIUEEbZpT8Sz/mlgJ
9bNyddsEptXS4mRoUszcWItc5Stok1fNYmECkknpPFOm01s7x6XUuRBpV72jFiwM
+/d7K+wAH8jm9y0Ij2Ya3w8bKnilEAA3nJpbr5K9wPLEFqNrX++es/44lxQGb/vI
OjPexZLYrEG9okXEC83v
=cV3l
-----END PGP SIGNATURE-----
Tom Rini - Feb. 4, 2013, 4:40 p.m.
On Thu, Jan 24, 2013 at 01:05:55AM -0000, Jim Lin wrote:

> Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if
> CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are defined in
> configuration file and when tstc() function for checking key pressed
> takes longer time than 10 ms (e.g., 50 ms) to finish.
> 
> Signed-off-by: Jim Lin <jilin@nvidia.com>

Applied to u-boot/master, thanks!

Patch

diff --git a/common/main.c b/common/main.c
index b145f85..dcd2a42 100644
--- a/common/main.c
+++ b/common/main.c
@@ -225,6 +225,7 @@  static inline
 int abortboot(int bootdelay)
 {
 	int abort = 0;
+	unsigned long ts;
 
 #ifdef CONFIG_MENUPROMPT
 	printf(CONFIG_MENUPROMPT);
@@ -248,11 +249,10 @@  int abortboot(int bootdelay)
 #endif
 
 	while ((bootdelay > 0) && (!abort)) {
-		int i;
-
 		--bootdelay;
-		/* delay 100 * 10ms */
-		for (i=0; !abort && i<100; ++i) {
+		/* delay 1000 ms */
+		ts = get_timer(0);
+		do {
 			if (tstc()) {	/* we got a key press	*/
 				abort  = 1;	/* don't auto boot	*/
 				bootdelay = 0;	/* no more delay	*/
@@ -264,7 +264,7 @@  int abortboot(int bootdelay)
 				break;
 			}
 			udelay(10000);
-		}
+		} while (!abort && get_timer(ts) < 1000);
 
 		printf("\b\b\b%2d ", bootdelay);
 	}