mmc: When switching partition, use the timeout specified in the ext_csd
[oweals/u-boot.git] / include / mmc.h
index 2be3e91fcb58e8bcb9117ac8c1923053689857c4..032873c2ff9b43266a138087dfa2a440bb873cb3 100644 (file)
@@ -226,10 +226,12 @@ static inline bool mmc_is_tuning_cmd(uint cmdidx)
 #define EXT_CSD_HS_TIMING              185     /* R/W */
 #define EXT_CSD_REV                    192     /* RO */
 #define EXT_CSD_CARD_TYPE              196     /* RO */
+#define EXT_CSD_PART_SWITCH_TIME       199     /* RO */
 #define EXT_CSD_SEC_CNT                        212     /* RO, 4 bytes */
 #define EXT_CSD_HC_WP_GRP_SIZE         221     /* RO */
 #define EXT_CSD_HC_ERASE_GRP_SIZE      224     /* RO */
 #define EXT_CSD_BOOT_MULT              226     /* RO */
+#define EXT_CSD_GENERIC_CMD6_TIME       248     /* RO */
 #define EXT_CSD_BKOPS_SUPPORT          502     /* RO */
 
 /*
@@ -418,14 +420,6 @@ struct dm_mmc_ops {
         */
        int (*set_ios)(struct udevice *dev);
 
-       /**
-        * send_init_stream() - send the initialization stream: 74 clock cycles
-        * This is used after power up before sending the first command
-        *
-        * @dev:        Device to update
-        */
-       void (*send_init_stream)(struct udevice *dev);
-
        /**
         * get_cd() - See whether a card is present
         *
@@ -453,7 +447,6 @@ struct dm_mmc_ops {
        int (*execute_tuning)(struct udevice *dev, uint opcode);
 #endif
 
-#if CONFIG_IS_ENABLED(MMC_UHS_SUPPORT)
        /**
         * wait_dat0() - wait until dat0 is in the target state
         *              (CLK must be running during the wait)
@@ -464,7 +457,6 @@ struct dm_mmc_ops {
         * @return 0 if dat0 is in the target state, -ve on error
         */
        int (*wait_dat0)(struct udevice *dev, int state, int timeout);
-#endif
 };
 
 #define mmc_get_ops(dev)        ((struct dm_mmc_ops *)(dev)->driver->ops)
@@ -472,7 +464,6 @@ struct dm_mmc_ops {
 int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
                    struct mmc_data *data);
 int dm_mmc_set_ios(struct udevice *dev);
-void dm_mmc_send_init_stream(struct udevice *dev);
 int dm_mmc_get_cd(struct udevice *dev);
 int dm_mmc_get_wp(struct udevice *dev);
 int dm_mmc_execute_tuning(struct udevice *dev, uint opcode);
@@ -480,7 +471,6 @@ int dm_mmc_wait_dat0(struct udevice *dev, int state, int timeout);
 
 /* Transition functions for compatibility */
 int mmc_set_ios(struct mmc *mmc);
-void mmc_send_init_stream(struct mmc *mmc);
 int mmc_getcd(struct mmc *mmc);
 int mmc_getwp(struct mmc *mmc);
 int mmc_execute_tuning(struct mmc *mmc, uint opcode);
@@ -597,6 +587,8 @@ struct mmc {
        u8 part_attr;
        u8 wr_rel_set;
        u8 part_config;
+       u8 gen_cmd6_time;
+       u8 part_switch_time;
        uint tran_speed;
        uint legacy_speed; /* speed for the legacy mode provided by the card */
        uint read_bl_len;
@@ -843,6 +835,9 @@ extern uint mmc_get_env_part(struct mmc *mmc);
 # endif
 int mmc_get_env_dev(void);
 
+/* Minimum partition switch timeout in units of 10-milliseconds */
+#define MMC_MIN_PART_SWITCH_TIME       30 /* 300 ms */
+
 /* Set block count limit because of 16 bit register limit on some hardware*/
 #ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT
 #define CONFIG_SYS_MMC_MAX_BLK_COUNT 65535