mmc: Allow for children other than the block device
authorSimon Glass <sjg@chromium.org>
Sat, 23 Oct 2021 23:26:00 +0000 (17:26 -0600)
committerSimon Glass <sjg@chromium.org>
Sun, 28 Nov 2021 23:51:51 +0000 (16:51 -0700)
At present the MMC uclass assumes that the only child it can have is a
block device. Update this so we can add a bootmethod too.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/mmc/mmc-uclass.c

index 3ee92d0..b80e838 100644 (file)
@@ -320,7 +320,7 @@ struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
        struct blk_desc *desc;
        struct udevice *dev;
 
-       device_find_first_child(mmc->dev, &dev);
+       device_find_first_child_by_uclass(mmc->dev, UCLASS_BLK, &dev);
        if (!dev)
                return NULL;
        desc = dev_get_uclass_plat(dev);
@@ -425,7 +425,7 @@ int mmc_unbind(struct udevice *dev)
 {
        struct udevice *bdev;
 
-       device_find_first_child(dev, &bdev);
+       device_find_first_child_by_uclass(dev, UCLASS_BLK, &bdev);
        if (bdev) {
                device_remove(bdev, DM_REMOVE_NORMAL);
                device_unbind(bdev);