summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFiach Antaw <fiach.antaw@uqconnect.edu.au>2017-01-25 19:00:24 +1000
committerJaehoon Chung <jh80.chung@samsung.com>2017-02-09 20:37:06 +0900
commita0269bb6e891c6c3b984a2f3d6a12c07e244484a (patch)
tree8fdca4cf58f9a8018e1cbcf613a1c89039e9c083 /drivers
parent6aca17c9b7e8d311c86d4cf54daef65bdf68ef73 (diff)
downloadu-boot-imx-a0269bb6e891c6c3b984a2f3d6a12c07e244484a.zip
u-boot-imx-a0269bb6e891c6c3b984a2f3d6a12c07e244484a.tar.gz
u-boot-imx-a0269bb6e891c6c3b984a2f3d6a12c07e244484a.tar.bz2
mmc: init mmc block devices on probe
MMC devices accessed exclusively via the driver model were not being initialized before being exposed as block devices, causing issues in scenarios where the MMC device is first accessed via the uclass block interface. Signed-off-by: Fiach Antaw <fiach.antaw@uqconnect.edu.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc-uclass.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index de7acb6..5bb446b 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -254,6 +254,17 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
return mmc_switch_part(mmc, hwpart);
}
+static int mmc_blk_probe(struct udevice *dev)
+{
+ struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
+ int dev_num = block_dev->devnum;
+ struct mmc *mmc = find_mmc_device(dev_num);
+
+ if (!mmc)
+ return -ENODEV;
+ return mmc_init(mmc);
+}
+
static const struct blk_ops mmc_blk_ops = {
.read = mmc_bread,
#ifndef CONFIG_SPL_BUILD
@@ -267,6 +278,7 @@ U_BOOT_DRIVER(mmc_blk) = {
.name = "mmc_blk",
.id = UCLASS_BLK,
.ops = &mmc_blk_ops,
+ .probe = mmc_blk_probe,
};
#endif /* CONFIG_BLK */