diff options
Diffstat (limited to 'include/linux/mmc')
-rw-r--r-- | include/linux/mmc/card.h | 12 | ||||
-rw-r--r-- | include/linux/mmc/core.h | 1 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 59 | ||||
-rw-r--r-- | include/linux/mmc/mmc.h | 3 | ||||
-rw-r--r-- | include/linux/mmc/sdio_func.h | 3 | ||||
-rw-r--r-- | include/linux/mmc/sdio_ids.h | 6 |
6 files changed, 83 insertions, 1 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 403aa505f27e..2ee22e8af110 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -40,6 +40,8 @@ struct mmc_csd { | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct mmc_ext_csd { | 42 | struct mmc_ext_csd { |
43 | u8 rev; | ||
44 | unsigned int sa_timeout; /* Units: 100ns */ | ||
43 | unsigned int hs_max_dtr; | 45 | unsigned int hs_max_dtr; |
44 | unsigned int sectors; | 46 | unsigned int sectors; |
45 | }; | 47 | }; |
@@ -62,7 +64,8 @@ struct sdio_cccr { | |||
62 | low_speed:1, | 64 | low_speed:1, |
63 | wide_bus:1, | 65 | wide_bus:1, |
64 | high_power:1, | 66 | high_power:1, |
65 | high_speed:1; | 67 | high_speed:1, |
68 | disable_cd:1; | ||
66 | }; | 69 | }; |
67 | 70 | ||
68 | struct sdio_cis { | 71 | struct sdio_cis { |
@@ -94,6 +97,8 @@ struct mmc_card { | |||
94 | #define MMC_STATE_READONLY (1<<1) /* card is read-only */ | 97 | #define MMC_STATE_READONLY (1<<1) /* card is read-only */ |
95 | #define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ | 98 | #define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ |
96 | #define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ | 99 | #define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ |
100 | unsigned int quirks; /* card quirks */ | ||
101 | #define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ | ||
97 | 102 | ||
98 | u32 raw_cid[4]; /* raw card CID */ | 103 | u32 raw_cid[4]; /* raw card CID */ |
99 | u32 raw_csd[4]; /* raw card CSD */ | 104 | u32 raw_csd[4]; /* raw card CSD */ |
@@ -129,6 +134,11 @@ struct mmc_card { | |||
129 | #define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) | 134 | #define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) |
130 | #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) | 135 | #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) |
131 | 136 | ||
137 | static inline int mmc_card_lenient_fn0(const struct mmc_card *c) | ||
138 | { | ||
139 | return c->quirks & MMC_QUIRK_LENIENT_FN0; | ||
140 | } | ||
141 | |||
132 | #define mmc_card_name(c) ((c)->cid.prod_name) | 142 | #define mmc_card_name(c) ((c)->cid.prod_name) |
133 | #define mmc_card_id(c) (dev_name(&(c)->dev)) | 143 | #define mmc_card_id(c) (dev_name(&(c)->dev)) |
134 | 144 | ||
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 7ac8b500d55c..e4898e9eeb59 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
@@ -139,6 +139,7 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); | |||
139 | 139 | ||
140 | extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); | 140 | extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); |
141 | extern void mmc_release_host(struct mmc_host *host); | 141 | extern void mmc_release_host(struct mmc_host *host); |
142 | extern int mmc_try_claim_host(struct mmc_host *host); | ||
142 | 143 | ||
143 | /** | 144 | /** |
144 | * mmc_claim_host - exclusively claim a host | 145 | * mmc_claim_host - exclusively claim a host |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 3e7615e9087e..eaf36364b7d4 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/sched.h> | ||
14 | 15 | ||
15 | #include <linux/mmc/core.h> | 16 | #include <linux/mmc/core.h> |
16 | 17 | ||
@@ -51,6 +52,35 @@ struct mmc_ios { | |||
51 | }; | 52 | }; |
52 | 53 | ||
53 | struct mmc_host_ops { | 54 | struct mmc_host_ops { |
55 | /* | ||
56 | * Hosts that support power saving can use the 'enable' and 'disable' | ||
57 | * methods to exit and enter power saving states. 'enable' is called | ||
58 | * when the host is claimed and 'disable' is called (or scheduled with | ||
59 | * a delay) when the host is released. The 'disable' is scheduled if | ||
60 | * the disable delay set by 'mmc_set_disable_delay()' is non-zero, | ||
61 | * otherwise 'disable' is called immediately. 'disable' may be | ||
62 | * scheduled repeatedly, to permit ever greater power saving at the | ||
63 | * expense of ever greater latency to re-enable. Rescheduling is | ||
64 | * determined by the return value of the 'disable' method. A positive | ||
65 | * value gives the delay in milliseconds. | ||
66 | * | ||
67 | * In the case where a host function (like set_ios) may be called | ||
68 | * with or without the host claimed, enabling and disabling can be | ||
69 | * done directly and will nest correctly. Call 'mmc_host_enable()' and | ||
70 | * 'mmc_host_lazy_disable()' for this purpose, but note that these | ||
71 | * functions must be paired. | ||
72 | * | ||
73 | * Alternatively, 'mmc_host_enable()' may be paired with | ||
74 | * 'mmc_host_disable()' which calls 'disable' immediately. In this | ||
75 | * case the 'disable' method will be called with 'lazy' set to 0. | ||
76 | * This is mainly useful for error paths. | ||
77 | * | ||
78 | * Because lazy disable may be called from a work queue, the 'disable' | ||
79 | * method must claim the host when 'lazy' != 0, which will work | ||
80 | * correctly because recursion is detected and handled. | ||
81 | */ | ||
82 | int (*enable)(struct mmc_host *host); | ||
83 | int (*disable)(struct mmc_host *host, int lazy); | ||
54 | void (*request)(struct mmc_host *host, struct mmc_request *req); | 84 | void (*request)(struct mmc_host *host, struct mmc_request *req); |
55 | /* | 85 | /* |
56 | * Avoid calling these three functions too often or in a "fast path", | 86 | * Avoid calling these three functions too often or in a "fast path", |
@@ -118,6 +148,9 @@ struct mmc_host { | |||
118 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ | 148 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ |
119 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ | 149 | #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 */ | 150 | #define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ |
151 | #define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ | ||
152 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ | ||
153 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ | ||
121 | 154 | ||
122 | /* host specific block data */ | 155 | /* host specific block data */ |
123 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ | 156 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ |
@@ -142,9 +175,18 @@ struct mmc_host { | |||
142 | unsigned int removed:1; /* host is being removed */ | 175 | unsigned int removed:1; /* host is being removed */ |
143 | #endif | 176 | #endif |
144 | 177 | ||
178 | /* Only used with MMC_CAP_DISABLE */ | ||
179 | int enabled; /* host is enabled */ | ||
180 | int nesting_cnt; /* "enable" nesting count */ | ||
181 | int en_dis_recurs; /* detect recursion */ | ||
182 | unsigned int disable_delay; /* disable delay in msecs */ | ||
183 | struct delayed_work disable; /* disabling work */ | ||
184 | |||
145 | struct mmc_card *card; /* device attached to this host */ | 185 | struct mmc_card *card; /* device attached to this host */ |
146 | 186 | ||
147 | wait_queue_head_t wq; | 187 | wait_queue_head_t wq; |
188 | struct task_struct *claimer; /* task that has host claimed */ | ||
189 | int claim_cnt; /* "claim" nesting count */ | ||
148 | 190 | ||
149 | struct delayed_work detect; | 191 | struct delayed_work detect; |
150 | 192 | ||
@@ -183,6 +225,9 @@ static inline void *mmc_priv(struct mmc_host *host) | |||
183 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); | 225 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); |
184 | extern int mmc_resume_host(struct mmc_host *); | 226 | extern int mmc_resume_host(struct mmc_host *); |
185 | 227 | ||
228 | extern void mmc_power_save_host(struct mmc_host *host); | ||
229 | extern void mmc_power_restore_host(struct mmc_host *host); | ||
230 | |||
186 | extern void mmc_detect_change(struct mmc_host *, unsigned long delay); | 231 | extern void mmc_detect_change(struct mmc_host *, unsigned long delay); |
187 | extern void mmc_request_done(struct mmc_host *, struct mmc_request *); | 232 | extern void mmc_request_done(struct mmc_host *, struct mmc_request *); |
188 | 233 | ||
@@ -197,5 +242,19 @@ struct regulator; | |||
197 | int mmc_regulator_get_ocrmask(struct regulator *supply); | 242 | int mmc_regulator_get_ocrmask(struct regulator *supply); |
198 | int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); | 243 | int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); |
199 | 244 | ||
245 | int mmc_card_awake(struct mmc_host *host); | ||
246 | int mmc_card_sleep(struct mmc_host *host); | ||
247 | int mmc_card_can_sleep(struct mmc_host *host); | ||
248 | |||
249 | int mmc_host_enable(struct mmc_host *host); | ||
250 | int mmc_host_disable(struct mmc_host *host); | ||
251 | int mmc_host_lazy_disable(struct mmc_host *host); | ||
252 | |||
253 | static inline void mmc_set_disable_delay(struct mmc_host *host, | ||
254 | unsigned int disable_delay) | ||
255 | { | ||
256 | host->disable_delay = disable_delay; | ||
257 | } | ||
258 | |||
200 | #endif | 259 | #endif |
201 | 260 | ||
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 14b81f3e5232..c02c8db73701 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #define MMC_ALL_SEND_CID 2 /* bcr R2 */ | 31 | #define MMC_ALL_SEND_CID 2 /* bcr R2 */ |
32 | #define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ | 32 | #define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ |
33 | #define MMC_SET_DSR 4 /* bc [31:16] RCA */ | 33 | #define MMC_SET_DSR 4 /* bc [31:16] RCA */ |
34 | #define MMC_SLEEP_AWAKE 5 /* ac [31:16] RCA 15:flg R1b */ | ||
34 | #define MMC_SWITCH 6 /* ac [31:0] See below R1b */ | 35 | #define MMC_SWITCH 6 /* ac [31:0] See below R1b */ |
35 | #define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */ | 36 | #define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */ |
36 | #define MMC_SEND_EXT_CSD 8 /* adtc R1 */ | 37 | #define MMC_SEND_EXT_CSD 8 /* adtc R1 */ |
@@ -127,6 +128,7 @@ | |||
127 | #define R1_STATUS(x) (x & 0xFFFFE000) | 128 | #define R1_STATUS(x) (x & 0xFFFFE000) |
128 | #define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ | 129 | #define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ |
129 | #define R1_READY_FOR_DATA (1 << 8) /* sx, a */ | 130 | #define R1_READY_FOR_DATA (1 << 8) /* sx, a */ |
131 | #define R1_SWITCH_ERROR (1 << 7) /* sx, c */ | ||
130 | #define R1_APP_CMD (1 << 5) /* sr, c */ | 132 | #define R1_APP_CMD (1 << 5) /* sr, c */ |
131 | 133 | ||
132 | /* | 134 | /* |
@@ -254,6 +256,7 @@ struct _mmc_csd { | |||
254 | #define EXT_CSD_CARD_TYPE 196 /* RO */ | 256 | #define EXT_CSD_CARD_TYPE 196 /* RO */ |
255 | #define EXT_CSD_REV 192 /* RO */ | 257 | #define EXT_CSD_REV 192 /* RO */ |
256 | #define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ | 258 | #define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ |
259 | #define EXT_CSD_S_A_TIMEOUT 217 | ||
257 | 260 | ||
258 | /* | 261 | /* |
259 | * EXT_CSD field definitions | 262 | * EXT_CSD field definitions |
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index 451bdfc85830..ac3ab683fec6 100644 --- a/include/linux/mmc/sdio_func.h +++ b/include/linux/mmc/sdio_func.h | |||
@@ -67,6 +67,7 @@ struct sdio_func { | |||
67 | 67 | ||
68 | #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) | 68 | #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) |
69 | #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) | 69 | #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) |
70 | #define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) | ||
70 | 71 | ||
71 | /* | 72 | /* |
72 | * SDIO function device driver | 73 | * SDIO function device driver |
@@ -81,6 +82,8 @@ struct sdio_driver { | |||
81 | struct device_driver drv; | 82 | struct device_driver drv; |
82 | }; | 83 | }; |
83 | 84 | ||
85 | #define to_sdio_driver(d) container_of(d, struct sdio_driver, drv) | ||
86 | |||
84 | /** | 87 | /** |
85 | * SDIO_DEVICE - macro used to describe a specific SDIO device | 88 | * SDIO_DEVICE - macro used to describe a specific SDIO device |
86 | * @vend: the 16 bit manufacturer code | 89 | * @vend: the 16 bit manufacturer code |
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h index 39751c8cde9c..2dbfb5a05994 100644 --- a/include/linux/mmc/sdio_ids.h +++ b/include/linux/mmc/sdio_ids.h | |||
@@ -22,6 +22,12 @@ | |||
22 | /* | 22 | /* |
23 | * Vendors and devices. Sort key: vendor first, device next. | 23 | * Vendors and devices. Sort key: vendor first, device next. |
24 | */ | 24 | */ |
25 | #define SDIO_VENDOR_ID_INTEL 0x0089 | ||
26 | #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 | ||
27 | #define SDIO_DEVICE_ID_INTEL_IWMC3200WIFI 0x1403 | ||
28 | #define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404 | ||
29 | #define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405 | ||
30 | #define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406 | ||
25 | 31 | ||
26 | #define SDIO_VENDOR_ID_MARVELL 0x02df | 32 | #define SDIO_VENDOR_ID_MARVELL 0x02df |
27 | #define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 | 33 | #define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 |