summaryrefslogtreecommitdiff
path: root/include/mmc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mmc.h')
-rw-r--r--include/mmc.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/mmc.h b/include/mmc.h
index e83c22423b..5e9d15cb41 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -223,6 +223,9 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
#define EXT_CSD_WR_REL_PARAM 166 /* R */
#define EXT_CSD_WR_REL_SET 167 /* R/W */
#define EXT_CSD_RPMB_MULT 168 /* RO */
+#define EXT_CSD_USER_WP 171 /* R/W & R/W/C_P & R/W/E_P */
+#define EXT_CSD_BOOT_WP 173 /* R/W & R/W/C_P */
+#define EXT_CSD_BOOT_WP_STATUS 174 /* R */
#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
#define EXT_CSD_BOOT_BUS_WIDTH 177
#define EXT_CSD_PART_CONF 179 /* R/W */
@@ -488,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)
@@ -501,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);
@@ -511,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 {
@@ -521,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
@@ -893,6 +912,26 @@ int mmc_get_env_dev(void);
*/
struct blk_desc *mmc_get_blk_desc(struct mmc *mmc);
+/**
+ * mmc_send_ext_csd() - read the extended CSD register
+ *
+ * @mmc: MMC device
+ * @ext_csd a cache aligned buffer of length MMC_MAX_BLOCK_LEN allocated by
+ * the caller, e.g. using
+ * ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN)
+ * Return: 0 for success
+ */
+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;