[U-Boot] [PATCH] USB: add CONFIG_USB_INIT to autoinitialize USB before main_loop

Allen Martin amartin at nvidia.com
Thu Dec 22 02:05:56 CET 2011


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

Signed-off-by: Allen Martin <amartin at 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



More information about the U-Boot mailing list