0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _MMC_CORE_HOST_H
0009 #define _MMC_CORE_HOST_H
0010
0011 #include <linux/mmc/host.h>
0012
0013 int mmc_register_host_class(void);
0014 void mmc_unregister_host_class(void);
0015
0016 void mmc_retune_enable(struct mmc_host *host);
0017 void mmc_retune_disable(struct mmc_host *host);
0018 void mmc_retune_hold(struct mmc_host *host);
0019 void mmc_retune_release(struct mmc_host *host);
0020 int mmc_retune(struct mmc_host *host);
0021 void mmc_retune_pause(struct mmc_host *host);
0022 void mmc_retune_unpause(struct mmc_host *host);
0023
0024 static inline void mmc_retune_clear(struct mmc_host *host)
0025 {
0026 host->retune_now = 0;
0027 host->need_retune = 0;
0028 }
0029
0030 static inline void mmc_retune_hold_now(struct mmc_host *host)
0031 {
0032 host->retune_now = 0;
0033 host->hold_retune += 1;
0034 }
0035
0036 static inline void mmc_retune_recheck(struct mmc_host *host)
0037 {
0038 if (host->hold_retune <= 1)
0039 host->retune_now = 1;
0040 }
0041
0042 static inline int mmc_host_cmd23(struct mmc_host *host)
0043 {
0044 return host->caps & MMC_CAP_CMD23;
0045 }
0046
0047 static inline bool mmc_host_done_complete(struct mmc_host *host)
0048 {
0049 return host->caps & MMC_CAP_DONE_COMPLETE;
0050 }
0051
0052 static inline int mmc_boot_partition_access(struct mmc_host *host)
0053 {
0054 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
0055 }
0056
0057 static inline int mmc_host_uhs(struct mmc_host *host)
0058 {
0059 return host->caps &
0060 (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
0061 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 |
0062 MMC_CAP_UHS_DDR50) &&
0063 host->caps & MMC_CAP_4_BIT_DATA;
0064 }
0065
0066 static inline bool mmc_card_hs200(struct mmc_card *card)
0067 {
0068 return card->host->ios.timing == MMC_TIMING_MMC_HS200;
0069 }
0070
0071 static inline bool mmc_card_ddr52(struct mmc_card *card)
0072 {
0073 return card->host->ios.timing == MMC_TIMING_MMC_DDR52;
0074 }
0075
0076 static inline bool mmc_card_hs400(struct mmc_card *card)
0077 {
0078 return card->host->ios.timing == MMC_TIMING_MMC_HS400;
0079 }
0080
0081 static inline bool mmc_card_hs400es(struct mmc_card *card)
0082 {
0083 return card->host->ios.enhanced_strobe;
0084 }
0085
0086 static inline bool mmc_card_sd_express(struct mmc_host *host)
0087 {
0088 return host->ios.timing == MMC_TIMING_SD_EXP ||
0089 host->ios.timing == MMC_TIMING_SD_EXP_1_2V;
0090 }
0091
0092 #endif
0093