aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2015-05-07 06:10:12 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2015-06-01 03:06:53 -0400
commitdfa13ebbe3340e538b988f5608efd9ff2ca7fc35 (patch)
treec2797cd4a3ea5a8f041790b8687005de608b5a3c /include/linux/mmc
parent59d22309c46e807cef8d892316f6d08b715d6652 (diff)
mmc: host: Add facility to support re-tuning
Currently, there is core support for tuning during initialization. There can also be a need to re-tune periodically (e.g. sdhci) or to re-tune after the host controller is powered off (e.g. after PM runtime suspend / resume) or to re-tune in response to CRC errors. The main requirements for re-tuning are: - ability to enable / disable re-tuning - ability to flag that re-tuning is needed - ability to re-tune before any request - ability to hold off re-tuning if the card is busy - ability to hold off re-tuning if re-tuning is in progress - ability to run a re-tuning timer To support those requirements 7 members are added to struct mmc_host: 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 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 */ need_retune is an integer so it can be set without needing synchronization. hold_retune is a integer to allow nesting. Various simple functions are provided to set / clear those variables. Subsequent patches take those functions into use. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'include/linux/mmc')
-rw-r--r--include/linux/mmc/host.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index b5bedaec6223..f471193ef6d6 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/leds.h> 13#include <linux/leds.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/timer.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
16#include <linux/device.h> 17#include <linux/device.h>
17#include <linux/fault-inject.h> 18#include <linux/fault-inject.h>
@@ -321,10 +322,18 @@ struct mmc_host {
321#ifdef CONFIG_MMC_DEBUG 322#ifdef CONFIG_MMC_DEBUG
322 unsigned int removed:1; /* host is being removed */ 323 unsigned int removed:1; /* host is being removed */
323#endif 324#endif
325 unsigned int can_retune:1; /* re-tuning can be used */
326 unsigned int doing_retune:1; /* re-tuning in progress */
327 unsigned int retune_now:1; /* do re-tuning at next req */
324 328
325 int rescan_disable; /* disable card detection */ 329 int rescan_disable; /* disable card detection */
326 int rescan_entered; /* used with nonremovable devices */ 330 int rescan_entered; /* used with nonremovable devices */
327 331
332 int need_retune; /* re-tuning is needed */
333 int hold_retune; /* hold off re-tuning */
334 unsigned int retune_period; /* re-tuning period in secs */
335 struct timer_list retune_timer; /* for periodic re-tuning */
336
328 bool trigger_card_event; /* card_event necessary */ 337 bool trigger_card_event; /* card_event necessary */
329 338
330 struct mmc_card *card; /* device attached to this host */ 339 struct mmc_card *card; /* device attached to this host */
@@ -513,4 +522,18 @@ static inline bool mmc_card_hs400(struct mmc_card *card)
513 return card->host->ios.timing == MMC_TIMING_MMC_HS400; 522 return card->host->ios.timing == MMC_TIMING_MMC_HS400;
514} 523}
515 524
525void mmc_retune_timer_stop(struct mmc_host *host);
526
527static inline void mmc_retune_needed(struct mmc_host *host)
528{
529 if (host->can_retune)
530 host->need_retune = 1;
531}
532
533static inline void mmc_retune_recheck(struct mmc_host *host)
534{
535 if (host->hold_retune <= 1)
536 host->retune_now = 1;
537}
538
516#endif /* LINUX_MMC_HOST_H */ 539#endif /* LINUX_MMC_HOST_H */