diff options
Diffstat (limited to 'include/linux/mmc/host.h')
-rw-r--r-- | include/linux/mmc/host.h | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 1ee4424462e..8c0bf3f2a36 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/wakelock.h> | ||
15 | 16 | ||
16 | #include <linux/mmc/core.h> | 17 | #include <linux/mmc/core.h> |
17 | #include <linux/mmc/pm.h> | 18 | #include <linux/mmc/pm.h> |
@@ -56,8 +57,6 @@ struct mmc_ios { | |||
56 | #define MMC_TIMING_UHS_SDR104 4 | 57 | #define MMC_TIMING_UHS_SDR104 4 |
57 | #define MMC_TIMING_UHS_DDR50 5 | 58 | #define MMC_TIMING_UHS_DDR50 5 |
58 | 59 | ||
59 | unsigned char ddr; /* dual data rate used */ | ||
60 | |||
61 | #define MMC_SDR_MODE 0 | 60 | #define MMC_SDR_MODE 0 |
62 | #define MMC_1_2V_DDR_MODE 1 | 61 | #define MMC_1_2V_DDR_MODE 1 |
63 | #define MMC_1_8V_DDR_MODE 2 | 62 | #define MMC_1_8V_DDR_MODE 2 |
@@ -106,6 +105,15 @@ struct mmc_host_ops { | |||
106 | */ | 105 | */ |
107 | int (*enable)(struct mmc_host *host); | 106 | int (*enable)(struct mmc_host *host); |
108 | int (*disable)(struct mmc_host *host, int lazy); | 107 | int (*disable)(struct mmc_host *host, int lazy); |
108 | /* | ||
109 | * It is optional for the host to implement pre_req and post_req in | ||
110 | * order to support double buffering of requests (prepare one | ||
111 | * request while another request is active). | ||
112 | */ | ||
113 | void (*post_req)(struct mmc_host *host, struct mmc_request *req, | ||
114 | int err); | ||
115 | void (*pre_req)(struct mmc_host *host, struct mmc_request *req, | ||
116 | bool is_first_req); | ||
109 | void (*request)(struct mmc_host *host, struct mmc_request *req); | 117 | void (*request)(struct mmc_host *host, struct mmc_request *req); |
110 | /* | 118 | /* |
111 | * Avoid calling these three functions too often or in a "fast path", | 119 | * Avoid calling these three functions too often or in a "fast path", |
@@ -139,11 +147,22 @@ struct mmc_host_ops { | |||
139 | int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); | 147 | int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); |
140 | int (*execute_tuning)(struct mmc_host *host); | 148 | int (*execute_tuning)(struct mmc_host *host); |
141 | void (*enable_preset_value)(struct mmc_host *host, bool enable); | 149 | void (*enable_preset_value)(struct mmc_host *host, bool enable); |
150 | int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); | ||
142 | }; | 151 | }; |
143 | 152 | ||
144 | struct mmc_card; | 153 | struct mmc_card; |
145 | struct device; | 154 | struct device; |
146 | 155 | ||
156 | struct mmc_async_req { | ||
157 | /* active mmc request */ | ||
158 | struct mmc_request *mrq; | ||
159 | /* | ||
160 | * Check error status of completed mmc request. | ||
161 | * Returns 0 if success otherwise non zero. | ||
162 | */ | ||
163 | int (*err_check) (struct mmc_card *, struct mmc_async_req *); | ||
164 | }; | ||
165 | |||
147 | struct mmc_host { | 166 | struct mmc_host { |
148 | struct device *parent; | 167 | struct device *parent; |
149 | struct device class_dev; | 168 | struct device class_dev; |
@@ -211,6 +230,7 @@ struct mmc_host { | |||
211 | #define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */ | 230 | #define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */ |
212 | #define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */ | 231 | #define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */ |
213 | #define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */ | 232 | #define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */ |
233 | #define MMC_CAP_BKOPS (1 << 31) /* Host supports BKOPS */ | ||
214 | 234 | ||
215 | mmc_pm_flag_t pm_caps; /* supported pm features */ | 235 | mmc_pm_flag_t pm_caps; /* supported pm features */ |
216 | 236 | ||
@@ -231,6 +251,7 @@ struct mmc_host { | |||
231 | unsigned int max_req_size; /* maximum number of bytes in one req */ | 251 | unsigned int max_req_size; /* maximum number of bytes in one req */ |
232 | unsigned int max_blk_size; /* maximum size of one mmc block */ | 252 | unsigned int max_blk_size; /* maximum size of one mmc block */ |
233 | unsigned int max_blk_count; /* maximum number of blocks in one req */ | 253 | unsigned int max_blk_count; /* maximum number of blocks in one req */ |
254 | unsigned int max_discard_to; /* max. discard timeout in ms */ | ||
234 | 255 | ||
235 | /* private data */ | 256 | /* private data */ |
236 | spinlock_t lock; /* lock for claim and bus ops */ | 257 | spinlock_t lock; /* lock for claim and bus ops */ |
@@ -261,10 +282,15 @@ struct mmc_host { | |||
261 | int claim_cnt; /* "claim" nesting count */ | 282 | int claim_cnt; /* "claim" nesting count */ |
262 | 283 | ||
263 | struct delayed_work detect; | 284 | struct delayed_work detect; |
285 | struct wake_lock detect_wake_lock; | ||
264 | 286 | ||
265 | const struct mmc_bus_ops *bus_ops; /* current bus driver */ | 287 | const struct mmc_bus_ops *bus_ops; /* current bus driver */ |
266 | unsigned int bus_refs; /* reference counter */ | 288 | unsigned int bus_refs; /* reference counter */ |
267 | 289 | ||
290 | unsigned int bus_resume_flags; | ||
291 | #define MMC_BUSRESUME_MANUAL_RESUME (1 << 0) | ||
292 | #define MMC_BUSRESUME_NEEDS_RESUME (1 << 1) | ||
293 | |||
268 | unsigned int sdio_irqs; | 294 | unsigned int sdio_irqs; |
269 | struct task_struct *sdio_irq_thread; | 295 | struct task_struct *sdio_irq_thread; |
270 | atomic_t sdio_irq_thread_abort; | 296 | atomic_t sdio_irq_thread_abort; |
@@ -281,6 +307,17 @@ struct mmc_host { | |||
281 | 307 | ||
282 | struct dentry *debugfs_root; | 308 | struct dentry *debugfs_root; |
283 | 309 | ||
310 | struct mmc_async_req *areq; /* active async req */ | ||
311 | |||
312 | #ifdef CONFIG_MMC_EMBEDDED_SDIO | ||
313 | struct { | ||
314 | struct sdio_cis *cis; | ||
315 | struct sdio_cccr *cccr; | ||
316 | struct sdio_embedded_func *funcs; | ||
317 | int num_funcs; | ||
318 | } embedded_sdio_data; | ||
319 | #endif | ||
320 | |||
284 | unsigned long private[0] ____cacheline_aligned; | 321 | unsigned long private[0] ____cacheline_aligned; |
285 | }; | 322 | }; |
286 | 323 | ||
@@ -289,6 +326,14 @@ extern int mmc_add_host(struct mmc_host *); | |||
289 | extern void mmc_remove_host(struct mmc_host *); | 326 | extern void mmc_remove_host(struct mmc_host *); |
290 | extern void mmc_free_host(struct mmc_host *); | 327 | extern void mmc_free_host(struct mmc_host *); |
291 | 328 | ||
329 | #ifdef CONFIG_MMC_EMBEDDED_SDIO | ||
330 | extern void mmc_set_embedded_sdio_data(struct mmc_host *host, | ||
331 | struct sdio_cis *cis, | ||
332 | struct sdio_cccr *cccr, | ||
333 | struct sdio_embedded_func *funcs, | ||
334 | int num_funcs); | ||
335 | #endif | ||
336 | |||
292 | static inline void *mmc_priv(struct mmc_host *host) | 337 | static inline void *mmc_priv(struct mmc_host *host) |
293 | { | 338 | { |
294 | return (void *)host->private; | 339 | return (void *)host->private; |
@@ -299,6 +344,18 @@ static inline void *mmc_priv(struct mmc_host *host) | |||
299 | #define mmc_dev(x) ((x)->parent) | 344 | #define mmc_dev(x) ((x)->parent) |
300 | #define mmc_classdev(x) (&(x)->class_dev) | 345 | #define mmc_classdev(x) (&(x)->class_dev) |
301 | #define mmc_hostname(x) (dev_name(&(x)->class_dev)) | 346 | #define mmc_hostname(x) (dev_name(&(x)->class_dev)) |
347 | #define mmc_bus_needs_resume(host) ((host)->bus_resume_flags & MMC_BUSRESUME_NEEDS_RESUME) | ||
348 | #define mmc_bus_manual_resume(host) ((host)->bus_resume_flags & MMC_BUSRESUME_MANUAL_RESUME) | ||
349 | |||
350 | static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual) | ||
351 | { | ||
352 | if (manual) | ||
353 | host->bus_resume_flags |= MMC_BUSRESUME_MANUAL_RESUME; | ||
354 | else | ||
355 | host->bus_resume_flags &= ~MMC_BUSRESUME_MANUAL_RESUME; | ||
356 | } | ||
357 | |||
358 | extern int mmc_resume_bus(struct mmc_host *host); | ||
302 | 359 | ||
303 | extern int mmc_suspend_host(struct mmc_host *); | 360 | extern int mmc_suspend_host(struct mmc_host *); |
304 | extern int mmc_resume_host(struct mmc_host *); | 361 | extern int mmc_resume_host(struct mmc_host *); |
@@ -373,5 +430,4 @@ static inline int mmc_host_cmd23(struct mmc_host *host) | |||
373 | { | 430 | { |
374 | return host->caps & MMC_CAP_CMD23; | 431 | return host->caps & MMC_CAP_CMD23; |
375 | } | 432 | } |
376 | #endif | 433 | #endif /* LINUX_MMC_HOST_H */ |
377 | |||