diff options
Diffstat (limited to 'include/linux/mmc/host.h')
| -rw-r--r-- | include/linux/mmc/host.h | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ee2b0363c040..cbde4b7e675e 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/sched.h> | 14 | #include <linux/sched.h> |
| 15 | #include <linux/device.h> | ||
| 15 | #include <linux/fault-inject.h> | 16 | #include <linux/fault-inject.h> |
| 16 | 17 | ||
| 17 | #include <linux/mmc/core.h> | 18 | #include <linux/mmc/core.h> |
| @@ -80,34 +81,11 @@ struct mmc_ios { | |||
| 80 | 81 | ||
| 81 | struct mmc_host_ops { | 82 | struct mmc_host_ops { |
| 82 | /* | 83 | /* |
| 83 | * Hosts that support power saving can use the 'enable' and 'disable' | 84 | * 'enable' is called when the host is claimed and 'disable' is called |
| 84 | * methods to exit and enter power saving states. 'enable' is called | 85 | * when the host is released. 'enable' and 'disable' are deprecated. |
| 85 | * when the host is claimed and 'disable' is called (or scheduled with | ||
| 86 | * a delay) when the host is released. The 'disable' is scheduled if | ||
| 87 | * the disable delay set by 'mmc_set_disable_delay()' is non-zero, | ||
| 88 | * otherwise 'disable' is called immediately. 'disable' may be | ||
| 89 | * scheduled repeatedly, to permit ever greater power saving at the | ||
| 90 | * expense of ever greater latency to re-enable. Rescheduling is | ||
| 91 | * determined by the return value of the 'disable' method. A positive | ||
| 92 | * value gives the delay in milliseconds. | ||
| 93 | * | ||
| 94 | * In the case where a host function (like set_ios) may be called | ||
| 95 | * with or without the host claimed, enabling and disabling can be | ||
| 96 | * done directly and will nest correctly. Call 'mmc_host_enable()' and | ||
| 97 | * 'mmc_host_lazy_disable()' for this purpose, but note that these | ||
| 98 | * functions must be paired. | ||
| 99 | * | ||
| 100 | * Alternatively, 'mmc_host_enable()' may be paired with | ||
| 101 | * 'mmc_host_disable()' which calls 'disable' immediately. In this | ||
| 102 | * case the 'disable' method will be called with 'lazy' set to 0. | ||
| 103 | * This is mainly useful for error paths. | ||
| 104 | * | ||
| 105 | * Because lazy disable may be called from a work queue, the 'disable' | ||
| 106 | * method must claim the host when 'lazy' != 0, which will work | ||
| 107 | * correctly because recursion is detected and handled. | ||
| 108 | */ | 86 | */ |
| 109 | int (*enable)(struct mmc_host *host); | 87 | int (*enable)(struct mmc_host *host); |
| 110 | int (*disable)(struct mmc_host *host, int lazy); | 88 | int (*disable)(struct mmc_host *host); |
| 111 | /* | 89 | /* |
| 112 | * It is optional for the host to implement pre_req and post_req in | 90 | * It is optional for the host to implement pre_req and post_req in |
| 113 | * order to support double buffering of requests (prepare one | 91 | * order to support double buffering of requests (prepare one |
| @@ -218,7 +196,7 @@ struct mmc_host { | |||
| 218 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ | 196 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ |
| 219 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ | 197 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ |
| 220 | #define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ | 198 | #define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ |
| 221 | #define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ | 199 | |
| 222 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ | 200 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ |
| 223 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ | 201 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ |
| 224 | #define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ | 202 | #define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ |
| @@ -258,6 +236,8 @@ struct mmc_host { | |||
| 258 | #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ | 236 | #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ |
| 259 | MMC_CAP2_HS200_1_2V_SDR) | 237 | MMC_CAP2_HS200_1_2V_SDR) |
| 260 | #define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ | 238 | #define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ |
| 239 | #define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */ | ||
| 240 | #define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ | ||
| 261 | 241 | ||
| 262 | mmc_pm_flag_t pm_caps; /* supported pm features */ | 242 | mmc_pm_flag_t pm_caps; /* supported pm features */ |
| 263 | unsigned int power_notify_type; | 243 | unsigned int power_notify_type; |
| @@ -300,13 +280,7 @@ struct mmc_host { | |||
| 300 | unsigned int removed:1; /* host is being removed */ | 280 | unsigned int removed:1; /* host is being removed */ |
| 301 | #endif | 281 | #endif |
| 302 | 282 | ||
| 303 | /* Only used with MMC_CAP_DISABLE */ | ||
| 304 | int enabled; /* host is enabled */ | ||
| 305 | int rescan_disable; /* disable card detection */ | 283 | int rescan_disable; /* disable card detection */ |
| 306 | int nesting_cnt; /* "enable" nesting count */ | ||
| 307 | int en_dis_recurs; /* detect recursion */ | ||
| 308 | unsigned int disable_delay; /* disable delay in msecs */ | ||
| 309 | struct delayed_work disable; /* disabling work */ | ||
| 310 | 284 | ||
| 311 | struct mmc_card *card; /* device attached to this host */ | 285 | struct mmc_card *card; /* device attached to this host */ |
| 312 | 286 | ||
| @@ -406,17 +380,8 @@ int mmc_card_awake(struct mmc_host *host); | |||
| 406 | int mmc_card_sleep(struct mmc_host *host); | 380 | int mmc_card_sleep(struct mmc_host *host); |
| 407 | int mmc_card_can_sleep(struct mmc_host *host); | 381 | int mmc_card_can_sleep(struct mmc_host *host); |
| 408 | 382 | ||
| 409 | int mmc_host_enable(struct mmc_host *host); | ||
| 410 | int mmc_host_disable(struct mmc_host *host); | ||
| 411 | int mmc_host_lazy_disable(struct mmc_host *host); | ||
| 412 | int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); | 383 | int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); |
| 413 | 384 | ||
| 414 | static inline void mmc_set_disable_delay(struct mmc_host *host, | ||
| 415 | unsigned int disable_delay) | ||
| 416 | { | ||
| 417 | host->disable_delay = disable_delay; | ||
| 418 | } | ||
| 419 | |||
| 420 | /* Module parameter */ | 385 | /* Module parameter */ |
| 421 | extern bool mmc_assume_removable; | 386 | extern bool mmc_assume_removable; |
| 422 | 387 | ||
