summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-05-01 13:52:30 -0600
committerSimon Glass <sjg@chromium.org>2016-05-17 09:54:43 -0600
commitcd0fb55b640b2991c1d29122d252a360037ed903 (patch)
tree65333e1eec999d760682765b6913d9ec0d94abb5 /drivers
parent69f45cd53b8ad8bc3afef2cf2410baf58fe75a6f (diff)
downloadu-boot-imx-cd0fb55b640b2991c1d29122d252a360037ed903.zip
u-boot-imx-cd0fb55b640b2991c1d29122d252a360037ed903.tar.gz
u-boot-imx-cd0fb55b640b2991c1d29122d252a360037ed903.tar.bz2
dm: blk: Add functions to select a hardware partition
The block device uclass does not currently support selecting a particular hardware partition but this is needed for MMC. Add it so that the blk API can support MMC properly. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/blk-uclass.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index a37239e..6ba1026 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -165,6 +165,18 @@ static int get_desc(enum if_type if_type, int devnum, struct blk_desc **descp)
return found_more ? -ENOENT : -ENODEV;
}
+int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = blk_get_device(if_type, devnum, &dev);
+ if (ret)
+ return ret;
+
+ return blk_select_hwpart(dev, hwpart);
+}
+
int blk_list_part(enum if_type if_type)
{
struct blk_desc *desc;
@@ -291,6 +303,23 @@ ulong blk_write_devnum(enum if_type if_type, int devnum, lbaint_t start,
return blk_dwrite(desc, start, blkcnt, buffer);
}
+int blk_select_hwpart(struct udevice *dev, int hwpart)
+{
+ const struct blk_ops *ops = blk_get_ops(dev);
+
+ if (!ops)
+ return -ENOSYS;
+ if (!ops->select_hwpart)
+ return 0;
+
+ return ops->select_hwpart(dev, hwpart);
+}
+
+int blk_dselect_hwpart(struct blk_desc *desc, int hwpart)
+{
+ return blk_select_hwpart(desc->bdev, hwpart);
+}
+
int blk_first_device(int if_type, struct udevice **devp)
{
struct blk_desc *desc;