diff mbox

[U-Boot,v5,03/19] dm: mmc: Set up the MMC device when controller is probed

Message ID 20170401180556.2416-4-sjg@chromium.org
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass April 1, 2017, 6:05 p.m. UTC
When an MMC controller is set up we should probe the device to find out
what it is. This includes finding its capacity and reading its partition
table.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/mmc/mmc-uclass.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox

Patch

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 5bb446bcc2..1e881e45e6 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -239,6 +239,15 @@  int mmc_unbind(struct udevice *dev)
 	return 0;
 }
 
+#ifdef CONFIG_BLK
+static int mmc_post_probe(struct udevice *dev)
+{
+	struct mmc *mmc = mmc_get_mmc_dev(dev);
+
+	return mmc_init(mmc);
+}
+#endif
+
 static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
 {
 	struct udevice *mmc_dev = dev_get_parent(bdev);
@@ -292,4 +301,7 @@  UCLASS_DRIVER(mmc) = {
 	.name		= "mmc",
 	.flags		= DM_UC_FLAG_SEQ_ALIAS,
 	.per_device_auto_alloc_size = sizeof(struct mmc_uclass_priv),
+#ifdef CONFIG_BLK
+	.post_probe	= mmc_post_probe,
+#endif
 };