aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc/host.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-09-24 18:13:11 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-24 18:13:11 -0400
commit8b3f6af86378d0a10ca2f1ded1da124aef13b62c (patch)
treede6ca90295730343c495be8d98be8efa322140ef /include/linux/mmc/host.h
parent139d6065c83071d5f66cd013a274a43699f8e2c1 (diff)
parent94e0fb086fc5663c38bbc0fe86d698be8314f82f (diff)
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts: drivers/staging/Kconfig drivers/staging/Makefile drivers/staging/cpc-usb/TODO drivers/staging/cpc-usb/cpc-usb_drv.c drivers/staging/cpc-usb/cpc.h drivers/staging/cpc-usb/cpc_int.h drivers/staging/cpc-usb/cpcusb.h
Diffstat (limited to 'include/linux/mmc/host.h')
-rw-r--r--include/linux/mmc/host.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3e7615e9087e..81bb42358595 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -51,6 +51,35 @@ struct mmc_ios {
51}; 51};
52 52
53struct mmc_host_ops { 53struct mmc_host_ops {
54 /*
55 * Hosts that support power saving can use the 'enable' and 'disable'
56 * methods to exit and enter power saving states. 'enable' is called
57 * when the host is claimed and 'disable' is called (or scheduled with
58 * a delay) when the host is released. The 'disable' is scheduled if
59 * the disable delay set by 'mmc_set_disable_delay()' is non-zero,
60 * otherwise 'disable' is called immediately. 'disable' may be
61 * scheduled repeatedly, to permit ever greater power saving at the
62 * expense of ever greater latency to re-enable. Rescheduling is
63 * determined by the return value of the 'disable' method. A positive
64 * value gives the delay in milliseconds.
65 *
66 * In the case where a host function (like set_ios) may be called
67 * with or without the host claimed, enabling and disabling can be
68 * done directly and will nest correctly. Call 'mmc_host_enable()' and
69 * 'mmc_host_lazy_disable()' for this purpose, but note that these
70 * functions must be paired.
71 *
72 * Alternatively, 'mmc_host_enable()' may be paired with
73 * 'mmc_host_disable()' which calls 'disable' immediately. In this
74 * case the 'disable' method will be called with 'lazy' set to 0.
75 * This is mainly useful for error paths.
76 *
77 * Because lazy disable may be called from a work queue, the 'disable'
78 * method must claim the host when 'lazy' != 0, which will work
79 * correctly because recursion is detected and handled.
80 */
81 int (*enable)(struct mmc_host *host);
82 int (*disable)(struct mmc_host *host, int lazy);
54 void (*request)(struct mmc_host *host, struct mmc_request *req); 83 void (*request)(struct mmc_host *host, struct mmc_request *req);
55 /* 84 /*
56 * Avoid calling these three functions too often or in a "fast path", 85 * Avoid calling these three functions too often or in a "fast path",
@@ -118,6 +147,9 @@ struct mmc_host {
118#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 147#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
119#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 148#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
120#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 149#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
150#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */
151#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
152#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
121 153
122 /* host specific block data */ 154 /* host specific block data */
123 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 155 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
@@ -142,9 +174,18 @@ struct mmc_host {
142 unsigned int removed:1; /* host is being removed */ 174 unsigned int removed:1; /* host is being removed */
143#endif 175#endif
144 176
177 /* Only used with MMC_CAP_DISABLE */
178 int enabled; /* host is enabled */
179 int nesting_cnt; /* "enable" nesting count */
180 int en_dis_recurs; /* detect recursion */
181 unsigned int disable_delay; /* disable delay in msecs */
182 struct delayed_work disable; /* disabling work */
183
145 struct mmc_card *card; /* device attached to this host */ 184 struct mmc_card *card; /* device attached to this host */
146 185
147 wait_queue_head_t wq; 186 wait_queue_head_t wq;
187 struct task_struct *claimer; /* task that has host claimed */
188 int claim_cnt; /* "claim" nesting count */
148 189
149 struct delayed_work detect; 190 struct delayed_work detect;
150 191
@@ -183,6 +224,9 @@ static inline void *mmc_priv(struct mmc_host *host)
183extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 224extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
184extern int mmc_resume_host(struct mmc_host *); 225extern int mmc_resume_host(struct mmc_host *);
185 226
227extern void mmc_power_save_host(struct mmc_host *host);
228extern void mmc_power_restore_host(struct mmc_host *host);
229
186extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 230extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
187extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 231extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
188 232
@@ -197,5 +241,19 @@ struct regulator;
197int mmc_regulator_get_ocrmask(struct regulator *supply); 241int mmc_regulator_get_ocrmask(struct regulator *supply);
198int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); 242int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit);
199 243
244int mmc_card_awake(struct mmc_host *host);
245int mmc_card_sleep(struct mmc_host *host);
246int mmc_card_can_sleep(struct mmc_host *host);
247
248int mmc_host_enable(struct mmc_host *host);
249int mmc_host_disable(struct mmc_host *host);
250int mmc_host_lazy_disable(struct mmc_host *host);
251
252static inline void mmc_set_disable_delay(struct mmc_host *host,
253 unsigned int disable_delay)
254{
255 host->disable_delay = disable_delay;
256}
257
200#endif 258#endif
201 259