free(mmc);
}
+static int mmc_get_devp(int dev, struct blk_desc **descp)
+{
+ struct mmc *mmc = find_mmc_device(dev);
+ int ret;
+
+ if (!mmc)
+ return -ENODEV;
+ ret = mmc_init(mmc);
+ if (ret)
+ return ret;
+
+ *descp = &mmc->block_dev;
+
+ return 0;
+}
+
#ifdef CONFIG_PARTITIONS
struct blk_desc *mmc_get_dev(int dev)
{
- struct mmc *mmc = find_mmc_device(dev);
- if (!mmc || mmc_init(mmc))
+ struct blk_desc *desc;
+
+ if (mmc_get_devp(dev, &desc))
return NULL;
- return &mmc->block_dev;
+ return desc;
}
#endif
enable);
}
#endif
+
+U_BOOT_LEGACY_BLK(mmc) = {
+ .if_typename = "mmc",
+ .if_type = IF_TYPE_MMC,
+ .max_devs = -1,
+ .get_dev = mmc_get_devp,
+};