mmc: host: Add facility to support re-tuning
[firefly-linux-kernel-4.4.55.git] / include / linux / mmc / host.h
index b5bedaec6223679bc00a25af801c1ae57ff17ad2..f471193ef6d637a4569f0d5a9962e4604d18b485 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/leds.h>
 #include <linux/mutex.h>
+#include <linux/timer.h>
 #include <linux/sched.h>
 #include <linux/device.h>
 #include <linux/fault-inject.h>
@@ -321,10 +322,18 @@ struct mmc_host {
 #ifdef CONFIG_MMC_DEBUG
        unsigned int            removed:1;      /* host is being removed */
 #endif
+       unsigned int            can_retune:1;   /* re-tuning can be used */
+       unsigned int            doing_retune:1; /* re-tuning in progress */
+       unsigned int            retune_now:1;   /* do re-tuning at next req */
 
        int                     rescan_disable; /* disable card detection */
        int                     rescan_entered; /* used with nonremovable devices */
 
+       int                     need_retune;    /* re-tuning is needed */
+       int                     hold_retune;    /* hold off re-tuning */
+       unsigned int            retune_period;  /* re-tuning period in secs */
+       struct timer_list       retune_timer;   /* for periodic re-tuning */
+
        bool                    trigger_card_event; /* card_event necessary */
 
        struct mmc_card         *card;          /* device attached to this host */
@@ -513,4 +522,18 @@ static inline bool mmc_card_hs400(struct mmc_card *card)
        return card->host->ios.timing == MMC_TIMING_MMC_HS400;
 }
 
+void mmc_retune_timer_stop(struct mmc_host *host);
+
+static inline void mmc_retune_needed(struct mmc_host *host)
+{
+       if (host->can_retune)
+               host->need_retune = 1;
+}
+
+static inline void mmc_retune_recheck(struct mmc_host *host)
+{
+       if (host->hold_retune <= 1)
+               host->retune_now = 1;
+}
+
 #endif /* LINUX_MMC_HOST_H */