USB: make "usb start" start usb only once
Currently we've this magic in include/config_distro_bootcmd.h to avoid scanning the usb bus multiple times. And it does not work when also using an usb keyboard because then the preboot command has already scanned the bus, so we're still scanning it twice. This commit makes "usb start" only start usb if it is no already started, allowing us to remove all the magic for it from include/config_distro_bootcmd.h and just call it unconditionally. This also causes "usb start" and "usb reset" to actually do what their different names suggest, rather then both of them doing exactly the same. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
c0978a94aa
commit
b507226405
|
@ -441,6 +441,26 @@ static int do_usb_stop_keyboard(int force)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void do_usb_start(void)
|
||||||
|
{
|
||||||
|
bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
|
||||||
|
|
||||||
|
if (usb_init() < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef CONFIG_USB_STORAGE
|
||||||
|
/* try to recognize storage devices immediately */
|
||||||
|
usb_stor_curr_dev = usb_stor_scan(1);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_USB_HOST_ETHER
|
||||||
|
/* try to recognize ethernet devices immediately */
|
||||||
|
usb_ether_curr_dev = usb_host_eth_scan(1);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_USB_KEYBOARD
|
||||||
|
drv_usb_kbd_init();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* usb command intepreter
|
* usb command intepreter
|
||||||
*/
|
*/
|
||||||
|
@ -457,26 +477,20 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
if ((strncmp(argv[1], "reset", 5) == 0) ||
|
if (strncmp(argv[1], "start", 5) == 0) {
|
||||||
(strncmp(argv[1], "start", 5) == 0)) {
|
if (usb_started)
|
||||||
bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
|
return 0; /* Already started */
|
||||||
|
printf("starting USB...\n");
|
||||||
|
do_usb_start();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp(argv[1], "reset", 5) == 0) {
|
||||||
|
printf("resetting USB...\n");
|
||||||
if (do_usb_stop_keyboard(1) != 0)
|
if (do_usb_stop_keyboard(1) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
usb_stop();
|
usb_stop();
|
||||||
printf("(Re)start USB...\n");
|
do_usb_start();
|
||||||
if (usb_init() >= 0) {
|
|
||||||
#ifdef CONFIG_USB_STORAGE
|
|
||||||
/* try to recognize storage devices immediately */
|
|
||||||
usb_stor_curr_dev = usb_stor_scan(1);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_USB_HOST_ETHER
|
|
||||||
/* try to recognize ethernet devices immediately */
|
|
||||||
usb_ether_curr_dev = usb_host_eth_scan(1);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_USB_KEYBOARD
|
|
||||||
drv_usb_kbd_init();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strncmp(argv[1], "stop", 4) == 0) {
|
if (strncmp(argv[1], "stop", 4) == 0) {
|
||||||
|
|
Loading…
Reference in New Issue