phy: atheros: Clarify the intention of ar8021_config
[oweals/u-boot.git] / include / mmc.h
index 85fc3497a14a42db47d5fd39b36dc974d55f17bd..6a2e9739e00e6f5da69b32da37f2ba44e126e30b 100644 (file)
@@ -377,7 +377,7 @@ struct mmc_uclass_priv {
  * @dev:       Device
  * @return associated mmc struct pointer if available, else NULL
  */
-struct mmc *mmc_get_mmc_dev(struct udevice *dev);
+struct mmc *mmc_get_mmc_dev(const struct udevice *dev);
 
 /* End of driver model support */
 
@@ -491,6 +491,19 @@ struct dm_mmc_ops {
         * @return 0 if not present, 1 if present, -ve on error
         */
        int (*host_power_cycle)(struct udevice *dev);
+
+       /**
+        * get_b_max - get maximum length of single transfer
+        *             Called before reading blocks from the card,
+        *             useful for system which have e.g. DMA limits
+        *             on various memory ranges.
+        *
+        * @dev:        Device to check
+        * @dst:        Destination buffer in memory
+        * @blkcnt:     Total number of blocks in this transfer
+        * @return maximum number of blocks for this transfer
+        */
+       int (*get_b_max)(struct udevice *dev, void *dst, lbaint_t blkcnt);
 };
 
 #define mmc_get_ops(dev)        ((struct dm_mmc_ops *)(dev)->driver->ops)
@@ -504,6 +517,7 @@ int dm_mmc_execute_tuning(struct udevice *dev, uint opcode);
 int dm_mmc_wait_dat0(struct udevice *dev, int state, int timeout_us);
 int dm_mmc_host_power_cycle(struct udevice *dev);
 int dm_mmc_deferred_probe(struct udevice *dev);
+int dm_mmc_get_b_max(struct udevice *dev, void *dst, lbaint_t blkcnt);
 
 /* Transition functions for compatibility */
 int mmc_set_ios(struct mmc *mmc);
@@ -514,6 +528,7 @@ int mmc_wait_dat0(struct mmc *mmc, int state, int timeout_us);
 int mmc_set_enhanced_strobe(struct mmc *mmc);
 int mmc_host_power_cycle(struct mmc *mmc);
 int mmc_deferred_probe(struct mmc *mmc);
+int mmc_get_b_max(struct mmc *mmc, void *dst, lbaint_t blkcnt);
 
 #else
 struct mmc_ops {
@@ -524,6 +539,7 @@ struct mmc_ops {
        int (*getcd)(struct mmc *mmc);
        int (*getwp)(struct mmc *mmc);
        int (*host_power_cycle)(struct mmc *mmc);
+       int (*get_b_max)(struct mmc *mmc, void *dst, lbaint_t blkcnt);
 };
 #endif
 
@@ -907,6 +923,15 @@ struct blk_desc *mmc_get_blk_desc(struct mmc *mmc);
  */
 int mmc_send_ext_csd(struct mmc *mmc, u8 *ext_csd);
 
+/**
+ * mmc_boot_wp() - power on write protect boot partitions
+ *
+ * The boot partitions are write protected until the next power cycle.
+ *
+ * Return:     0 for success
+ */
+int mmc_boot_wp(struct mmc *mmc);
+
 static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
 {
        return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE;