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.h48
1 files changed, 36 insertions, 12 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 0707d228d7f1..f578a71d82a6 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -11,6 +11,7 @@
11#define LINUX_MMC_HOST_H 11#define LINUX_MMC_HOST_H
12 12
13#include <linux/leds.h> 13#include <linux/leds.h>
14#include <linux/mutex.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <linux/fault-inject.h> 17#include <linux/fault-inject.h>
@@ -150,11 +151,31 @@ struct mmc_async_req {
150 int (*err_check) (struct mmc_card *, struct mmc_async_req *); 151 int (*err_check) (struct mmc_card *, struct mmc_async_req *);
151}; 152};
152 153
153struct mmc_hotplug { 154/**
154 unsigned int irq; 155 * struct mmc_slot - MMC slot functions
156 *
157 * @cd_irq: MMC/SD-card slot hotplug detection IRQ or -EINVAL
158 * @lock: protect the @handler_priv pointer
159 * @handler_priv: MMC/SD-card slot context
160 *
161 * Some MMC/SD host controllers implement slot-functions like card and
162 * write-protect detection natively. However, a large number of controllers
163 * leave these functions to the CPU. This struct provides a hook to attach
164 * such slot-function drivers.
165 */
166struct mmc_slot {
167 int cd_irq;
168 struct mutex lock;
155 void *handler_priv; 169 void *handler_priv;
156}; 170};
157 171
172struct regulator;
173
174struct mmc_supply {
175 struct regulator *vmmc; /* Card power supply */
176 struct regulator *vqmmc; /* Optional Vccq supply */
177};
178
158struct mmc_host { 179struct mmc_host {
159 struct device *parent; 180 struct device *parent;
160 struct device class_dev; 181 struct device class_dev;
@@ -168,6 +189,9 @@ struct mmc_host {
168 u32 ocr_avail_sd; /* SD-specific OCR */ 189 u32 ocr_avail_sd; /* SD-specific OCR */
169 u32 ocr_avail_mmc; /* MMC-specific OCR */ 190 u32 ocr_avail_mmc; /* MMC-specific OCR */
170 struct notifier_block pm_notify; 191 struct notifier_block pm_notify;
192 u32 max_current_330;
193 u32 max_current_300;
194 u32 max_current_180;
171 195
172#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ 196#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
173#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ 197#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
@@ -211,16 +235,9 @@ struct mmc_host {
211#define MMC_CAP_UHS_SDR50 (1 << 17) /* Host supports UHS SDR50 mode */ 235#define MMC_CAP_UHS_SDR50 (1 << 17) /* Host supports UHS SDR50 mode */
212#define MMC_CAP_UHS_SDR104 (1 << 18) /* Host supports UHS SDR104 mode */ 236#define MMC_CAP_UHS_SDR104 (1 << 18) /* Host supports UHS SDR104 mode */
213#define MMC_CAP_UHS_DDR50 (1 << 19) /* Host supports UHS DDR50 mode */ 237#define MMC_CAP_UHS_DDR50 (1 << 19) /* Host supports UHS DDR50 mode */
214#define MMC_CAP_SET_XPC_330 (1 << 20) /* Host supports >150mA current at 3.3V */
215#define MMC_CAP_SET_XPC_300 (1 << 21) /* Host supports >150mA current at 3.0V */
216#define MMC_CAP_SET_XPC_180 (1 << 22) /* Host supports >150mA current at 1.8V */
217#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ 238#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
218#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ 239#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
219#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ 240#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
220#define MMC_CAP_MAX_CURRENT_200 (1 << 26) /* Host max current limit is 200mA */
221#define MMC_CAP_MAX_CURRENT_400 (1 << 27) /* Host max current limit is 400mA */
222#define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */
223#define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */
224#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */ 241#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
225#define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */ 242#define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */
226 243
@@ -238,6 +255,8 @@ struct mmc_host {
238#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ 255#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 */ 256#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 */ 257#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
258#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
259#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
241 260
242 mmc_pm_flag_t pm_caps; /* supported pm features */ 261 mmc_pm_flag_t pm_caps; /* supported pm features */
243 unsigned int power_notify_type; 262 unsigned int power_notify_type;
@@ -290,7 +309,7 @@ struct mmc_host {
290 309
291 struct delayed_work detect; 310 struct delayed_work detect;
292 int detect_change; /* card detect flag */ 311 int detect_change; /* card detect flag */
293 struct mmc_hotplug hotplug; 312 struct mmc_slot slot;
294 313
295 const struct mmc_bus_ops *bus_ops; /* current bus driver */ 314 const struct mmc_bus_ops *bus_ops; /* current bus driver */
296 unsigned int bus_refs; /* reference counter */ 315 unsigned int bus_refs; /* reference counter */
@@ -309,6 +328,7 @@ struct mmc_host {
309#ifdef CONFIG_REGULATOR 328#ifdef CONFIG_REGULATOR
310 bool regulator_enabled; /* regulator state */ 329 bool regulator_enabled; /* regulator state */
311#endif 330#endif
331 struct mmc_supply supply;
312 332
313 struct dentry *debugfs_root; 333 struct dentry *debugfs_root;
314 334
@@ -357,13 +377,12 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
357 wake_up_process(host->sdio_irq_thread); 377 wake_up_process(host->sdio_irq_thread);
358} 378}
359 379
360struct regulator;
361
362#ifdef CONFIG_REGULATOR 380#ifdef CONFIG_REGULATOR
363int mmc_regulator_get_ocrmask(struct regulator *supply); 381int mmc_regulator_get_ocrmask(struct regulator *supply);
364int mmc_regulator_set_ocr(struct mmc_host *mmc, 382int mmc_regulator_set_ocr(struct mmc_host *mmc,
365 struct regulator *supply, 383 struct regulator *supply,
366 unsigned short vdd_bit); 384 unsigned short vdd_bit);
385int mmc_regulator_get_supply(struct mmc_host *mmc);
367#else 386#else
368static inline int mmc_regulator_get_ocrmask(struct regulator *supply) 387static inline int mmc_regulator_get_ocrmask(struct regulator *supply)
369{ 388{
@@ -376,6 +395,11 @@ static inline int mmc_regulator_set_ocr(struct mmc_host *mmc,
376{ 395{
377 return 0; 396 return 0;
378} 397}
398
399static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
400{
401 return 0;
402}
379#endif 403#endif
380 404
381int mmc_card_awake(struct mmc_host *host); 405int mmc_card_awake(struct mmc_host *host);