diff options
author | Tom Rini <trini@ti.com> | 2014-10-06 15:49:50 -0400 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-10-06 15:49:50 -0400 |
commit | 8a6b088aff969a125cf4ed21f7608112f8b722e5 (patch) | |
tree | 347fdd557fbd93bc1f9bcee4e1da492bfbfecc74 /common/cmd_usb.c | |
parent | 04de09f89bbc647d5b72db3512d1af1475a13bbd (diff) | |
parent | e2140588dd2f3e619f21d9575281b7c7ea771c09 (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-usb
Diffstat (limited to 'common/cmd_usb.c')
-rw-r--r-- | common/cmd_usb.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 2519497dad..c192498257 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -430,6 +430,16 @@ static int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif /* CONFIG_USB_STORAGE */ +static int do_usb_stop_keyboard(int force) +{ +#ifdef CONFIG_USB_KEYBOARD + if (usb_kbd_deregister(force) != 0) { + printf("USB not stopped: usbkbd still using USB\n"); + return 1; + } +#endif + return 0; +} /****************************************************************************** * usb command intepreter @@ -450,6 +460,8 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if ((strncmp(argv[1], "reset", 5) == 0) || (strncmp(argv[1], "start", 5) == 0)) { bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start"); + if (do_usb_stop_keyboard(1) != 0) + return 1; usb_stop(); printf("(Re)start USB...\n"); if (usb_init() >= 0) { @@ -468,19 +480,10 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } if (strncmp(argv[1], "stop", 4) == 0) { -#ifdef CONFIG_USB_KEYBOARD - if (argc == 2) { - if (usb_kbd_deregister() != 0) { - printf("USB not stopped: usbkbd still" - " using USB\n"); - return 1; - } - } else { - /* forced stop, switch console in to serial */ + if (argc != 2) console_assign(stdin, "serial"); - usb_kbd_deregister(); - } -#endif + if (do_usb_stop_keyboard(0) != 0) + return 1; printf("stopping USB..\n"); usb_stop(); return 0; |