mmc: add hs400 enhanced strobe support for mmc subsystem
[firefly-linux-kernel-4.4.55.git] / include / linux / mmc / host.h
index 5c479e77817037b308a31792ffb6ed01d9f161aa..ec55e25115d191afe5d89ea6cac5b4002e28a197 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <linux/mmc/core.h>
 #include <linux/mmc/card.h>
+#include <linux/mmc/mmc.h>
 #include <linux/mmc/pm.h>
 
 struct mmc_ios {
@@ -133,6 +134,8 @@ struct mmc_host_ops {
 
        /* Prepare HS400 target operating frequency depending host driver */
        int     (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios);
+       /* Prepare enhanced strobe depending host driver */
+       int     (*prepare_enhanced_strobe)(struct mmc_host *host, bool enable);
        int     (*select_drive_strength)(struct mmc_card *card,
                                         unsigned int max_dtr, int host_drv,
                                         int card_drv, int *drv_type);
@@ -290,6 +293,7 @@ struct mmc_host {
 #define MMC_CAP2_HSX00_1_2V    (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V)
 #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
 #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18)    /* No physical write protect pin, assume that card is always read-write */
+#define MMC_CAP2_HS400_ENHANCED_STROBE (1 << 20) /* Host supports enhanced strobe */
 
        mmc_pm_flag_t           pm_caps;        /* supported pm features */
 
@@ -492,6 +496,11 @@ static inline int mmc_host_uhs(struct mmc_host *host)
                 MMC_CAP_UHS_DDR50);
 }
 
+static inline int mmc_host_hs400_enhanced_strobe(struct mmc_host *host)
+{
+       return host->caps2 & MMC_CAP2_HS400_ENHANCED_STROBE;
+}
+
 static inline int mmc_host_packed_wr(struct mmc_host *host)
 {
        return host->caps2 & MMC_CAP2_PACKED_WR;
@@ -524,6 +533,15 @@ static inline bool mmc_card_hs400(struct mmc_card *card)
        return card->host->ios.timing == MMC_TIMING_MMC_HS400;
 }
 
+static inline bool mmc_card_hs400es(struct mmc_card *card)
+{
+       if (mmc_card_hs400(card) &&
+           (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES))
+               return 1;
+
+       return 0;
+}
+
 void mmc_retune_timer_stop(struct mmc_host *host);
 
 static inline void mmc_retune_needed(struct mmc_host *host)