]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - include/blk.h
arc/cache: really do invalidate_dcache_all() even if IOC exists
[people/ms/u-boot.git] / include / blk.h
index 82b2c1a70686439bd2ca6765620c2b98a3e76886..66a1c55cc8b69c256e9caf214642bbc60c439406 100644 (file)
@@ -63,6 +63,11 @@ struct blk_desc {
        char            product[20+1];  /* IDE Serial no, SCSI product */
        char            revision[8+1];  /* firmware revision */
 #ifdef CONFIG_BLK
+       /*
+        * For now we have a few functions which take struct blk_desc as a
+        * parameter. This field allows them to look up the associated
+        * device. Once these functions are removed we can drop this field.
+        */
        struct udevice *bdev;
 #else
        unsigned long   (*block_read)(struct blk_desc *block_dev,
@@ -211,6 +216,25 @@ struct blk_ops {
         */
        unsigned long (*erase)(struct udevice *dev, lbaint_t start,
                               lbaint_t blkcnt);
+
+       /**
+        * select_hwpart() - select a particular hardware partition
+        *
+        * Some devices (e.g. MMC) can support partitioning at the hardware
+        * level. This is quite separate from the normal idea of
+        * software-based partitions. MMC hardware partitions must be
+        * explicitly selected. Once selected only the region of the device
+        * covered by that partition is accessible.
+        *
+        * The MMC standard provides for two boot partitions (numbered 1 and 2),
+        * rpmb (3), and up to 4 addition general-purpose partitions (4-7).
+        *
+        * @desc:       Block device to update
+        * @hwpart:     Hardware partition number to select. 0 means the raw
+        *              device, 1 is the first partition, 2 is the second, etc.
+        * @return 0 if OK, -ve on error
+        */
+       int (*select_hwpart)(struct udevice *dev, int hwpart);
 };
 
 #define blk_get_ops(dev)       ((struct blk_ops *)(dev)->driver->ops)
@@ -329,6 +353,17 @@ int blk_unbind_all(int if_type);
  */
 int blk_find_max_devnum(enum if_type if_type);
 
+/**
+ * blk_select_hwpart() - select a hardware partition
+ *
+ * Select a hardware partition if the device supports it (typically MMC does)
+ *
+ * @dev:       Device to update
+ * @hwpart:    Partition number to select
+ * @return 0 if OK, -ve on error
+ */
+int blk_select_hwpart(struct udevice *dev, int hwpart);
+
 #else
 #include <errno.h>
 /*