dm: blk: Expand iteration and add tests

Add some functions which support iteration before probing. Also add tests
for the functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index f9f05f4..f1e4a85 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -552,6 +552,30 @@
 	return flags & req_flags ? 0 : 1;
 }
 
+int blk_find_first(enum blk_flag_t flags, struct udevice **devp)
+{
+	int ret;
+
+	for (ret = uclass_find_first_device(UCLASS_BLK, devp);
+	     *devp && !blk_flags_check(*devp, flags);
+	     ret = uclass_find_next_device(devp))
+		return 0;
+
+	return -ENODEV;
+}
+
+int blk_find_next(enum blk_flag_t flags, struct udevice **devp)
+{
+	int ret;
+
+	for (ret = uclass_find_next_device(devp);
+	     *devp && !blk_flags_check(*devp, flags);
+	     ret = uclass_find_next_device(devp))
+		return 0;
+
+	return -ENODEV;
+}
+
 int blk_first_device_err(enum blk_flag_t flags, struct udevice **devp)
 {
 	int ret;