summaryrefslogtreecommitdiff
path: root/common/usb_storage.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-04-25 08:31:23 +0300
committerTom Rini <trini@konsulko.com>2022-04-25 17:00:04 +0300
commit0ccb0ac5d8fa8e03ba57b364133b7f033c2d52c1 (patch)
tree4486092416d85c711292e665290b8b0d05517faa /common/usb_storage.c
parentd9409244b309959ac8dd79fc88d2c42f23c62f8c (diff)
downloadu-boot-0ccb0ac5d8fa8e03ba57b364133b7f033c2d52c1.tar.xz
bootstd: usb: Add a bootdev driver
Add a bootdev driver for USB host. It can use the distro boot mechanism to locate a file, or any other available bootmeth. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/usb_storage.c')
-rw-r--r--common/usb_storage.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 291728f37e..eaa31374ef 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -34,6 +34,7 @@
#include <common.h>
#include <blk.h>
+#include <bootdev.h>
#include <command.h>
#include <dm.h>
#include <errno.h>
@@ -243,6 +244,16 @@ static int usb_stor_probe_device(struct usb_device *udev)
ret = blk_probe_or_unbind(dev);
if (ret)
return ret;
+
+ ret = bootdev_setup_sibling_blk(dev, "usb_bootdev");
+ if (ret) {
+ int ret2;
+
+ ret2 = device_unbind(dev);
+ if (ret2)
+ return log_msg_ret("bootdev", ret2);
+ return log_msg_ret("bootdev", ret);
+ }
}
#else
/* We don't have space to even probe if we hit the maximum */