public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] USB: add CONFIG_USB_INIT to autoinitialize USB before main_loop
@ 2011-12-22  1:05 Allen Martin
  2011-12-22  4:04 ` Marek Vasut
  2011-12-22  8:06 ` Wolfgang Denk
  0 siblings, 2 replies; 12+ messages in thread
From: Allen Martin @ 2011-12-22  1:05 UTC (permalink / raw)
  To: u-boot

This allows systems to pause autoboot with USB keyboard.  Tested on
tegra2 seaboard.

Signed-off-by: Allen Martin <amartin@nvidia.com>
---
 README               |    5 +++++
 arch/arm/lib/board.c |    9 +++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/README b/README
index 882483b..40e8481 100644
--- a/README
+++ b/README
@@ -1132,6 +1132,11 @@ The following options need to be configured:
 		CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the
 		txfilltuning field in the EHCI controller on reset.
 
+		CONFIG_USB_INIT causes USB to be initialized
+		automatically before the main command loop.  This is
+		useful if you have a USB keyboard and you want to use
+		it to stop autoboot.
+
 - USB Device:
 		Define the below if you wish to use the USB console.
 		Once firmware is rebuilt from a serial console issue the
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 3d78274..6787048 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -64,6 +64,10 @@
 #include "../drivers/net/lan91c96.h"
 #endif
 
+#ifdef CONFIG_USB_INIT
+#include <usb.h>
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 ulong monitor_flash_len;
@@ -548,6 +552,11 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	api_init();
 #endif
 
+#ifdef CONFIG_USB_INIT
+	/* this needs to be before console init for USB kbd to work as stdin */
+	usb_init();
+#endif
+
 	console_init_r();	/* fully init console as a device */
 
 #if defined(CONFIG_ARCH_MISC_INIT)
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [U-Boot] [PATCH] USB: add CONFIG_USB_INIT to autoinitialize USB before main_loop
@ 2011-12-22 22:25 Allen Martin
  0 siblings, 0 replies; 12+ messages in thread
From: Allen Martin @ 2011-12-22 22:25 UTC (permalink / raw)
  To: u-boot

> > This allows systems to pause autoboot with USB keyboard.  Tested on
> > tegra2 seaboard.
> >
> > Signed-off-by: Allen Martin <amartin@nvidia.com>
> > ---
> >  README               |    5 +++++
> >  arch/arm/lib/board.c |    9 +++++++++
> >  2 files changed, 14 insertions(+), 0 deletions(-)
> 
> This modification is in no way ARM specific, so if we accept it, it must be
> applied to all supported architectures.
> 
Sounds reasonable, I can make patches for other architectures, but I can 
really only test ARM and x86

> Where exacly is this feature nneded?  You don;t enable it in any of 
> the board configurations...

It's intended for systems that use USB keyboard as the primary input device.  
I have a tegra2 device like that, I haven't sent out the patch to enable it yet 
because it depends on Simon Glass's tegra USB patches, which are still in review.

> Also, should we then not auto-enable this if CONFIG_USB_KEYBOARD is set?

Sure, that sounds reasonable.

-Allen
nvpublic

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [U-Boot] [PATCH] USB: add CONFIG_USB_INIT to autoinitialize USB before main_loop
@ 2011-12-23  0:52 Allen Martin
  0 siblings, 0 replies; 12+ messages in thread
From: Allen Martin @ 2011-12-23  0:52 UTC (permalink / raw)
  To: u-boot

> > This seems incompatible with iomux, shouldn't these decisions be made
> in the
> > console driver?  In my case, stdin is set to "serial,tegra-kbc,usbkbd"
> so this
> > strcmp won't match.
> 
> Indeed, this code predates the iomux implementation, and nobody
> noticed yet that it needs fixing.

Ok thanks, I'll work on fixing this, as it seems a lot less painful
than modifying the init sequence for a dozen different architectures
I know nothing about.

-Allen

nvpublic

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

end of thread, other threads:[~2011-12-23  0:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22  1:05 [U-Boot] [PATCH] USB: add CONFIG_USB_INIT to autoinitialize USB before main_loop Allen Martin
2011-12-22  4:04 ` Marek Vasut
2011-12-22 18:54   ` Allen Martin
2011-12-22 19:10     ` Moffett, Kyle D
2011-12-22 19:27       ` Marek Vasut
2011-12-22 20:32         ` Allen Martin
2011-12-22 22:40           ` Allen Martin
2011-12-22 23:00             ` Wolfgang Denk
2011-12-22  8:06 ` Wolfgang Denk
2011-12-22  8:17   ` Igor Grinberg
  -- strict thread matches above, loose matches on Subject: below --
2011-12-22 22:25 Allen Martin
2011-12-23  0:52 Allen Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox