bootstd: Keep track of use of usb stop

When 'usb stop' is run, doing 'bootflow scan' does not run the USB hunter
again so does not see any devices. Fix this by telling bootstd about the
state of USB.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2023-09-20 07:29:49 -06:00
committed by Bin Meng
parent 8c11d19e75
commit 1b1d36ec58
3 changed files with 44 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#define LOG_CATEGORY UCLASS_USB
#include <common.h>
#include <bootdev.h>
#include <dm.h>
#include <errno.h>
#include <log.h>
@@ -208,6 +209,13 @@ int usb_stop(void)
#ifdef CONFIG_USB_STORAGE
usb_stor_reset();
#endif
if (CONFIG_IS_ENABLED(BOOTSTD)) {
int ret;
ret = bootdev_unhunt(UCLASS_USB);
if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && ret && ret != -EALREADY)
printf("failed to unhunt USB (err=%dE)\n", ret);
}
uc_priv->companion_device_count = 0;
usb_started = 0;