aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc/host.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mmc/host.h')
-rw-r--r--include/linux/mmc/host.h115
1 files changed, 110 insertions, 5 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1575b52c3bfa..1ee4424462eb 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -50,6 +50,30 @@ struct mmc_ios {
50#define MMC_TIMING_LEGACY 0 50#define MMC_TIMING_LEGACY 0
51#define MMC_TIMING_MMC_HS 1 51#define MMC_TIMING_MMC_HS 1
52#define MMC_TIMING_SD_HS 2 52#define MMC_TIMING_SD_HS 2
53#define MMC_TIMING_UHS_SDR12 MMC_TIMING_LEGACY
54#define MMC_TIMING_UHS_SDR25 MMC_TIMING_SD_HS
55#define MMC_TIMING_UHS_SDR50 3
56#define MMC_TIMING_UHS_SDR104 4
57#define MMC_TIMING_UHS_DDR50 5
58
59 unsigned char ddr; /* dual data rate used */
60
61#define MMC_SDR_MODE 0
62#define MMC_1_2V_DDR_MODE 1
63#define MMC_1_8V_DDR_MODE 2
64
65 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
66
67#define MMC_SIGNAL_VOLTAGE_330 0
68#define MMC_SIGNAL_VOLTAGE_180 1
69#define MMC_SIGNAL_VOLTAGE_120 2
70
71 unsigned char drv_type; /* driver type (A, B, C, D) */
72
73#define MMC_SET_DRIVER_TYPE_B 0
74#define MMC_SET_DRIVER_TYPE_A 1
75#define MMC_SET_DRIVER_TYPE_C 2
76#define MMC_SET_DRIVER_TYPE_D 3
53}; 77};
54 78
55struct mmc_host_ops { 79struct mmc_host_ops {
@@ -111,6 +135,10 @@ struct mmc_host_ops {
111 135
112 /* optional callback for HC quirks */ 136 /* optional callback for HC quirks */
113 void (*init_card)(struct mmc_host *host, struct mmc_card *card); 137 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
138
139 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
140 int (*execute_tuning)(struct mmc_host *host);
141 void (*enable_preset_value)(struct mmc_host *host, bool enable);
114}; 142};
115 143
116struct mmc_card; 144struct mmc_card;
@@ -123,7 +151,11 @@ struct mmc_host {
123 const struct mmc_host_ops *ops; 151 const struct mmc_host_ops *ops;
124 unsigned int f_min; 152 unsigned int f_min;
125 unsigned int f_max; 153 unsigned int f_max;
154 unsigned int f_init;
126 u32 ocr_avail; 155 u32 ocr_avail;
156 u32 ocr_avail_sdio; /* SDIO-specific OCR */
157 u32 ocr_avail_sd; /* SD-specific OCR */
158 u32 ocr_avail_mmc; /* MMC-specific OCR */
127 struct notifier_block pm_notify; 159 struct notifier_block pm_notify;
128 160
129#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ 161#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
@@ -157,13 +189,44 @@ struct mmc_host {
157#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 189#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
158#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 190#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
159#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 191#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
192#define MMC_CAP_1_8V_DDR (1 << 11) /* can support */
193 /* DDR mode at 1.8V */
194#define MMC_CAP_1_2V_DDR (1 << 12) /* can support */
195 /* DDR mode at 1.2V */
196#define MMC_CAP_POWER_OFF_CARD (1 << 13) /* Can power off after boot */
197#define MMC_CAP_BUS_WIDTH_TEST (1 << 14) /* CMD14/CMD19 bus width ok */
198#define MMC_CAP_UHS_SDR12 (1 << 15) /* Host supports UHS SDR12 mode */
199#define MMC_CAP_UHS_SDR25 (1 << 16) /* Host supports UHS SDR25 mode */
200#define MMC_CAP_UHS_SDR50 (1 << 17) /* Host supports UHS SDR50 mode */
201#define MMC_CAP_UHS_SDR104 (1 << 18) /* Host supports UHS SDR104 mode */
202#define MMC_CAP_UHS_DDR50 (1 << 19) /* Host supports UHS DDR50 mode */
203#define MMC_CAP_SET_XPC_330 (1 << 20) /* Host supports >150mA current at 3.3V */
204#define MMC_CAP_SET_XPC_300 (1 << 21) /* Host supports >150mA current at 3.0V */
205#define MMC_CAP_SET_XPC_180 (1 << 22) /* Host supports >150mA current at 1.8V */
206#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
207#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
208#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
209#define MMC_CAP_MAX_CURRENT_200 (1 << 26) /* Host max current limit is 200mA */
210#define MMC_CAP_MAX_CURRENT_400 (1 << 27) /* Host max current limit is 400mA */
211#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 */
213#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
160 214
161 mmc_pm_flag_t pm_caps; /* supported pm features */ 215 mmc_pm_flag_t pm_caps; /* supported pm features */
162 216
217#ifdef CONFIG_MMC_CLKGATE
218 int clk_requests; /* internal reference counter */
219 unsigned int clk_delay; /* number of MCI clk hold cycles */
220 bool clk_gated; /* clock gated */
221 struct work_struct clk_gate_work; /* delayed clock gate */
222 unsigned int clk_old; /* old clock value cache */
223 spinlock_t clk_lock; /* lock for clk fields */
224 struct mutex clk_gate_mutex; /* mutex for clock gating */
225#endif
226
163 /* host specific block data */ 227 /* host specific block data */
164 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 228 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
165 unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ 229 unsigned short max_segs; /* see blk_queue_max_segments */
166 unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */
167 unsigned short unused; 230 unsigned short unused;
168 unsigned int max_req_size; /* maximum number of bytes in one req */ 231 unsigned int max_req_size; /* maximum number of bytes in one req */
169 unsigned int max_blk_size; /* maximum size of one mmc block */ 232 unsigned int max_blk_size; /* maximum size of one mmc block */
@@ -212,6 +275,10 @@ struct mmc_host {
212 struct led_trigger *led; /* activity led */ 275 struct led_trigger *led; /* activity led */
213#endif 276#endif
214 277
278#ifdef CONFIG_REGULATOR
279 bool regulator_enabled; /* regulator state */
280#endif
281
215 struct dentry *debugfs_root; 282 struct dentry *debugfs_root;
216 283
217 unsigned long private[0] ____cacheline_aligned; 284 unsigned long private[0] ____cacheline_aligned;
@@ -236,8 +303,8 @@ static inline void *mmc_priv(struct mmc_host *host)
236extern int mmc_suspend_host(struct mmc_host *); 303extern int mmc_suspend_host(struct mmc_host *);
237extern int mmc_resume_host(struct mmc_host *); 304extern int mmc_resume_host(struct mmc_host *);
238 305
239extern void mmc_power_save_host(struct mmc_host *host); 306extern int mmc_power_save_host(struct mmc_host *host);
240extern void mmc_power_restore_host(struct mmc_host *host); 307extern int mmc_power_restore_host(struct mmc_host *host);
241 308
242extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 309extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
243extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 310extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
@@ -250,8 +317,24 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
250 317
251struct regulator; 318struct regulator;
252 319
320#ifdef CONFIG_REGULATOR
253int mmc_regulator_get_ocrmask(struct regulator *supply); 321int mmc_regulator_get_ocrmask(struct regulator *supply);
254int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); 322int mmc_regulator_set_ocr(struct mmc_host *mmc,
323 struct regulator *supply,
324 unsigned short vdd_bit);
325#else
326static inline int mmc_regulator_get_ocrmask(struct regulator *supply)
327{
328 return 0;
329}
330
331static inline int mmc_regulator_set_ocr(struct mmc_host *mmc,
332 struct regulator *supply,
333 unsigned short vdd_bit)
334{
335 return 0;
336}
337#endif
255 338
256int mmc_card_awake(struct mmc_host *host); 339int mmc_card_awake(struct mmc_host *host);
257int mmc_card_sleep(struct mmc_host *host); 340int mmc_card_sleep(struct mmc_host *host);
@@ -268,5 +351,27 @@ static inline void mmc_set_disable_delay(struct mmc_host *host,
268 host->disable_delay = disable_delay; 351 host->disable_delay = disable_delay;
269} 352}
270 353
354/* Module parameter */
355extern int mmc_assume_removable;
356
357static inline int mmc_card_is_removable(struct mmc_host *host)
358{
359 return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable;
360}
361
362static inline int mmc_card_keep_power(struct mmc_host *host)
363{
364 return host->pm_flags & MMC_PM_KEEP_POWER;
365}
366
367static inline int mmc_card_wake_sdio_irq(struct mmc_host *host)
368{
369 return host->pm_flags & MMC_PM_WAKE_SDIO_IRQ;
370}
371
372static inline int mmc_host_cmd23(struct mmc_host *host)
373{
374 return host->caps & MMC_CAP_CMD23;
375}
271#endif 376#endif
272 377