* [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 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 8:06 ` Wolfgang Denk
1 sibling, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2011-12-22 4:04 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>
Can't you just add "usb reset" to preboot env?
M
> ---
> 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)
^ 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-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 8:06 ` Wolfgang Denk
2011-12-22 8:17 ` Igor Grinberg
1 sibling, 1 reply; 12+ messages in thread
From: Wolfgang Denk @ 2011-12-22 8:06 UTC (permalink / raw)
To: u-boot
Dear Allen Martin,
In message <1324515956-1642-1-git-send-email-amartin@nvidia.com> you wrote:
> 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.
Where exacly is this feature nneded? You don;t enable it in any of
the board configurations...
Also, should we then not auto-enable this if CONFIG_USB_KEYBOARD is
set?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I can type faster than I can move a mouse, so I find menu-driven
drawing packages time consuming and frustrating. - W. R. Stevens
^ 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-22 8:06 ` Wolfgang Denk
@ 2011-12-22 8:17 ` Igor Grinberg
0 siblings, 0 replies; 12+ messages in thread
From: Igor Grinberg @ 2011-12-22 8:17 UTC (permalink / raw)
To: u-boot
Hi Wolfgang,
On 12/22/11 10:06, Wolfgang Denk wrote:
> Dear Allen Martin,
>
> In message <1324515956-1642-1-git-send-email-amartin@nvidia.com> you wrote:
>> 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.
>
> Where exacly is this feature nneded? You don;t enable it in any of
> the board configurations...
>
> Also, should we then not auto-enable this if CONFIG_USB_KEYBOARD is
> set?
Right, IMHO, there is no need for a new config option -
just make the USB init depend on CONFIG_USB_KEYBOARD.
--
Regards,
Igor.
^ 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-22 4:04 ` Marek Vasut
@ 2011-12-22 18:54 ` Allen Martin
2011-12-22 19:10 ` Moffett, Kyle D
0 siblings, 1 reply; 12+ messages in thread
From: Allen Martin @ 2011-12-22 18:54 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>
>
> Can't you just add "usb reset" to preboot env?
The point is to be able to use USB keyboard to stop autoboot on systems where USB keyboard is the primary (or only) input device. This needs to happen before BOOTCOMMAND gets parsed.
-Allen
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
^ 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-22 18:54 ` Allen Martin
@ 2011-12-22 19:10 ` Moffett, Kyle D
2011-12-22 19:27 ` Marek Vasut
0 siblings, 1 reply; 12+ messages in thread
From: Moffett, Kyle D @ 2011-12-22 19:10 UTC (permalink / raw)
To: u-boot
--
Curious about my work on the Debian powerpcspe port?
I'm keeping a blog here: http://pureperl.blogspot.com/
>>> This allows systems to pause autoboot with USB keyboard. Tested on
>>> tegra2 seaboard.
>>>
>>> Signed-off-by: Allen Martin <amartin@nvidia.com>
>>
>> Can't you just add "usb reset" to preboot env?
>
> The point is to be able to use USB keyboard to stop autoboot on systems
> where USB keyboard is the primary (or only) input device. This needs
> to happen before BOOTCOMMAND gets parsed.
I think the "preboot" environment variable already *is* run before
starting the autoboot timer?
Cheers,
Kyle Moffett
^ 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-22 19:10 ` Moffett, Kyle D
@ 2011-12-22 19:27 ` Marek Vasut
2011-12-22 20:32 ` Allen Martin
0 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2011-12-22 19:27 UTC (permalink / raw)
To: u-boot
> --
> Curious about my work on the Debian powerpcspe port?
> I'm keeping a blog here: http://pureperl.blogspot.com/
>
> >>> This allows systems to pause autoboot with USB keyboard. Tested on
> >>> tegra2 seaboard.
> >>>
> >>> Signed-off-by: Allen Martin <amartin@nvidia.com>
> >>
> >> Can't you just add "usb reset" to preboot env?
> >
> > The point is to be able to use USB keyboard to stop autoboot on systems
> > where USB keyboard is the primary (or only) input device. This needs
> > to happen before BOOTCOMMAND gets parsed.
>
> I think the "preboot" environment variable already *is* run before
> starting the autoboot timer?
Yep.
M
^ 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-22 19:27 ` Marek Vasut
@ 2011-12-22 20:32 ` Allen Martin
2011-12-22 22:40 ` Allen Martin
0 siblings, 1 reply; 12+ messages in thread
From: Allen Martin @ 2011-12-22 20:32 UTC (permalink / raw)
To: u-boot
> > >> Can't you just add "usb reset" to preboot env?
> > >
> > > The point is to be able to use USB keyboard to stop autoboot on
> > > systems where USB keyboard is the primary (or only) input device.
> > > This needs to happen before BOOTCOMMAND gets parsed.
> >
> > I think the "preboot" environment variable already *is* run before
> > starting the autoboot timer?
>
> Yep.
>
I also had to stick it before console init because console makes decisions about the input device based on what's been registered when it initializes (at least with iomux turned on, I didn't try it without).
Maybe a better fix is to have console reevaluate things when the usb keyboard driver registers itself? I'm open to suggestions.
-Allen
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
^ 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-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-22 20:32 ` Allen Martin
@ 2011-12-22 22:40 ` Allen Martin
2011-12-22 23:00 ` Wolfgang Denk
0 siblings, 1 reply; 12+ messages in thread
From: Allen Martin @ 2011-12-22 22:40 UTC (permalink / raw)
To: u-boot
> > > > The point is to be able to use USB keyboard to stop autoboot on
> > > > systems where USB keyboard is the primary (or only) input device.
> > > > This needs to happen before BOOTCOMMAND gets parsed.
> > >
> > > I think the "preboot" environment variable already *is* run before
> > > starting the autoboot timer?
> >
> > Yep.
> >
>
> I also had to stick it before console init because console makes
> decisions about the input device based on what's been registered when it
> initializes (at least with iomux turned on, I didn't try it without).
>
> Maybe a better fix is to have console reevaluate things when the usb
> keyboard driver registers itself? I'm open to suggestions.
I don't fully grok how console/stdin gets assigned, but is this possibly
the problem? (from drv_usb_kbd_init()):
/* Check if this is the standard input device. */
if (strcmp(stdinname, DEVNAME))
return 1;
/* Reassign the console */
if (overwrite_console())
return 1;
error = console_assign(stdin, DEVNAME);
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.
-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-22 22:40 ` Allen Martin
@ 2011-12-22 23:00 ` Wolfgang Denk
0 siblings, 0 replies; 12+ messages in thread
From: Wolfgang Denk @ 2011-12-22 23:00 UTC (permalink / raw)
To: u-boot
Dear Allen Martin,
In message <3C7A7ACA8617D24290826EC008B5CD083E5DCDAF40@HQMAIL03.nvidia.com> you wrote:
>
> I don't fully grok how console/stdin gets assigned, but is this possibly
> the problem? (from drv_usb_kbd_init()):
>
> /* Check if this is the standard input device. */
> if (strcmp(stdinname, DEVNAME))
> return 1;
>
> /* Reassign the console */
> if (overwrite_console())
> return 1;
>
> error = console_assign(stdin, DEVNAME);
>
> 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.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
They're usually so busy thinking about what happens next that the
only time they ever find out what is happening now is when they come
to look back on it. - Terry Pratchett, _Wyrd Sisters_
^ 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