mmc: host: Add facility to support re-tuning
authorAdrian Hunter <adrian.hunter@intel.com>
Thu, 7 May 2015 10:10:12 +0000 (13:10 +0300)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 1 Jun 2015 07:06:53 +0000 (09:06 +0200)
commitdfa13ebbe3340e538b988f5608efd9ff2ca7fc35
treec2797cd4a3ea5a8f041790b8687005de608b5a3c
parent59d22309c46e807cef8d892316f6d08b715d6652
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>
drivers/mmc/core/host.c
drivers/mmc/core/host.h
include/linux/mmc/host.h