From b85fc8dbabd7c027ad7ad6133578a0d679dbe2ba Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:47:26 -0700 Subject: bootstd: Add a default method to get bootflows The code in these functions turns out to often be the same. Add a default get_bootflow() function and allow the drivers to select it by setting the method to NULL. This saves a little code space. Signed-off-by: Simon Glass --- drivers/usb/host/usb_bootdev.c | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'drivers/usb/host/usb_bootdev.c') diff --git a/drivers/usb/host/usb_bootdev.c b/drivers/usb/host/usb_bootdev.c index b85f699933d..b2d157faf33 100644 --- a/drivers/usb/host/usb_bootdev.c +++ b/drivers/usb/host/usb_bootdev.c @@ -11,29 +11,6 @@ #include #include -static int usb_get_bootflow(struct udevice *dev, struct bootflow_iter *iter, - struct bootflow *bflow) -{ - struct udevice *blk; - int ret; - - ret = bootdev_get_sibling_blk(dev, &blk); - /* - * If there is no media, indicate that no more partitions should be - * checked - */ - if (ret == -EOPNOTSUPP) - ret = -ESHUTDOWN; - if (ret) - return log_msg_ret("blk", ret); - assert(blk); - ret = bootdev_find_in_blk(dev, blk, iter, bflow); - if (ret) - return log_msg_ret("find", ret); - - return 0; -} - static int usb_bootdev_bind(struct udevice *dev) { struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev); @@ -44,7 +21,6 @@ static int usb_bootdev_bind(struct udevice *dev) } struct bootdev_ops usb_bootdev_ops = { - .get_bootflow = usb_get_bootflow, }; static const struct udevice_id usb_bootdev_ids[] = { -- cgit v1.2.3 From 04fb2b6e45893df45a7d6bed61614fce97c279e4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:47:37 -0700 Subject: bootstd: Add a USB hunter Add a hunter for USB which enumerates the bus to find new bootdevs. Update the tests and speed up bootdev_test_prio() while we are here, by dropping the USB delays. Signed-off-by: Simon Glass --- drivers/usb/host/usb_bootdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/usb/host/usb_bootdev.c') diff --git a/drivers/usb/host/usb_bootdev.c b/drivers/usb/host/usb_bootdev.c index b2d157faf33..66d0b6ae8f5 100644 --- a/drivers/usb/host/usb_bootdev.c +++ b/drivers/usb/host/usb_bootdev.c @@ -20,6 +20,11 @@ static int usb_bootdev_bind(struct udevice *dev) return 0; } +static int usb_bootdev_hunt(struct bootdev_hunter *info, bool show) +{ + return usb_init(); +} + struct bootdev_ops usb_bootdev_ops = { }; @@ -35,3 +40,10 @@ U_BOOT_DRIVER(usb_bootdev) = { .bind = usb_bootdev_bind, .of_match = usb_bootdev_ids, }; + +BOOTDEV_HUNTER(usb_bootdev_hunter) = { + .prio = BOOTDEVP_3_SCAN_SLOW, + .uclass = UCLASS_USB, + .hunt = usb_bootdev_hunt, + .drv = DM_DRIVER_REF(usb_bootdev), +}; -- cgit v1.2.3 From eacc261178b9c8024cb8de89ee4ca6c68d80d96a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 17 Jan 2023 10:48:08 -0700 Subject: bootstd: Add a new pre-scan priority for bootdevs We need extensions to be set up before we start trying to boot any of the bootdevs. Add a new priority before all the others for tht sort of thing. Also add a 'none' option, so that the first one is not 0. While we are here, comment enum bootdev_prio_t fully and expand the test for the 'bootdev hunt' command. Signed-off-by: Simon Glass --- drivers/usb/host/usb_bootdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/usb/host/usb_bootdev.c') diff --git a/drivers/usb/host/usb_bootdev.c b/drivers/usb/host/usb_bootdev.c index 66d0b6ae8f5..32919f99286 100644 --- a/drivers/usb/host/usb_bootdev.c +++ b/drivers/usb/host/usb_bootdev.c @@ -15,7 +15,7 @@ static int usb_bootdev_bind(struct udevice *dev) { struct bootdev_uc_plat *ucp = dev_get_uclass_plat(dev); - ucp->prio = BOOTDEVP_3_SCAN_SLOW; + ucp->prio = BOOTDEVP_5_SCAN_SLOW; return 0; } @@ -42,7 +42,7 @@ U_BOOT_DRIVER(usb_bootdev) = { }; BOOTDEV_HUNTER(usb_bootdev_hunter) = { - .prio = BOOTDEVP_3_SCAN_SLOW, + .prio = BOOTDEVP_5_SCAN_SLOW, .uclass = UCLASS_USB, .hunt = usb_bootdev_hunt, .drv = DM_DRIVER_REF(usb_bootdev), -- cgit v1.2.3