[U-Boot] [PATCH v2 06/24] dm: mmc: Add a function to obtain the block device

Simon Glass sjg at chromium.org
Sun May 1 21:52:27 CEST 2016


The MMC block device is contained within struct mmc. But with driver model
this will not be the case. Add a function to obtain the block device. We
can later implement this for CONFIG_BLK.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 drivers/mmc/mmc.c | 5 +++++
 include/mmc.h     | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index e270f5f..49996a8 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -24,6 +24,11 @@
 static struct list_head mmc_devices;
 static int cur_dev_num = -1;
 
+struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
+{
+	return &mmc->block_dev;
+}
+
 __weak int board_mmc_getwp(struct mmc *mmc)
 {
 	return -1;
diff --git a/include/mmc.h b/include/mmc.h
index cdb56e7..36449c3 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -498,4 +498,12 @@ int pci_mmc_init(const char *name, struct pci_device_id *mmc_supported);
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT 65535
 #endif
 
+/**
+ * mmc_get_blk_desc() - Get the block descriptor for an MMC device
+ *
+ * @mmc:	MMC device
+ * @return block device if found, else NULL
+ */
+struct blk_desc *mmc_get_blk_desc(struct mmc *mmc);
+
 #endif /* _MMC_H_ */
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list