summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-05-01 11:36:07 -0600
committerSimon Glass <sjg@chromium.org>2016-05-17 09:54:43 -0600
commit663acabdc548216d61a9d2b1f789d4e6606f7a52 (patch)
treead678dd20e470fff69eb8aaabb0eb26b52a3c3dd /drivers/mmc
parentc0543bf6be4bac277d65c601f9150c7faf3d125e (diff)
dm: mmc: Add a legacy block interface for MMC
Add a legacy block interface for MMC. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/mmc.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d3c22abfd5..024368c727 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1582,14 +1582,31 @@ void mmc_destroy(struct mmc *mmc)
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
@@ -1965,3 +1982,10 @@ int mmc_set_rst_n_function(struct mmc *mmc, u8 enable)
enable);
}
#endif
+
+U_BOOT_LEGACY_BLK(mmc) = {
+ .if_typename = "mmc",
+ .if_type = IF_TYPE_MMC,
+ .max_devs = -1,
+ .get_dev = mmc_get_devp,
+};