aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mmc')
-rw-r--r--include/linux/mmc/boot.h6
-rw-r--r--include/linux/mmc/card.h20
-rw-r--r--include/linux/mmc/core.h12
-rw-r--r--include/linux/mmc/dw_mmc.h28
-rw-r--r--include/linux/mmc/host.h64
-rw-r--r--include/linux/mmc/ioctl.h2
-rw-r--r--include/linux/mmc/mmc.h25
-rw-r--r--include/linux/mmc/pm.h3
-rw-r--r--include/linux/mmc/sd.h7
-rw-r--r--include/linux/mmc/sdhci-pltfm.h35
-rw-r--r--include/linux/mmc/sdhci-spear.h6
-rw-r--r--include/linux/mmc/sdhci.h79
-rw-r--r--include/linux/mmc/sdio.h40
-rw-r--r--include/linux/mmc/sdio_func.h17
-rw-r--r--include/linux/mmc/sdio_ids.h6
-rw-r--r--include/linux/mmc/sh_mmcif.h6
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h6
-rw-r--r--include/linux/mmc/tmio.h8
18 files changed, 247 insertions, 123 deletions
diff --git a/include/linux/mmc/boot.h b/include/linux/mmc/boot.h
index 39d787c229c..23acc3baa07 100644
--- a/include/linux/mmc/boot.h
+++ b/include/linux/mmc/boot.h
@@ -1,7 +1,7 @@
1#ifndef MMC_BOOT_H 1#ifndef LINUX_MMC_BOOT_H
2#define MMC_BOOT_H 2#define LINUX_MMC_BOOT_H
3 3
4enum { MMC_PROGRESS_ENTER, MMC_PROGRESS_INIT, 4enum { MMC_PROGRESS_ENTER, MMC_PROGRESS_INIT,
5 MMC_PROGRESS_LOAD, MMC_PROGRESS_DONE }; 5 MMC_PROGRESS_LOAD, MMC_PROGRESS_DONE };
6 6
7#endif 7#endif /* LINUX_MMC_BOOT_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 6ad43554ac0..9178aa48209 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -77,6 +77,12 @@ struct mmc_ext_csd {
77 u8 raw_sec_feature_support;/* 231 */ 77 u8 raw_sec_feature_support;/* 231 */
78 u8 raw_trim_mult; /* 232 */ 78 u8 raw_trim_mult; /* 232 */
79 u8 raw_sectors[4]; /* 212 - 4 bytes */ 79 u8 raw_sectors[4]; /* 212 - 4 bytes */
80 bool hpi_en; /* HPI enablebit */
81 bool hpi; /* HPI support bit */
82 unsigned int hpi_cmd; /* cmd used as HPI */
83 u8 out_of_int_time; /* out of int time */
84 bool bk_ops; /* BK ops support bit */
85 bool bk_ops_en; /* BK ops enable bit */
80}; 86};
81 87
82struct sd_scr { 88struct sd_scr {
@@ -176,6 +182,8 @@ struct mmc_card {
176#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 182#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
177#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ 183#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
178#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 184#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
185#define MMC_STATE_DOING_BKOPS (1<<6) /* Card doing bkops */
186#define MMC_STATE_NEED_BKOPS (1<<7) /* Card needs to do bkops */
179#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 187#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
180 unsigned int quirks; /* card quirks */ 188 unsigned int quirks; /* card quirks */
181#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 189#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
@@ -312,9 +320,10 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
312#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 320#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
313#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 321#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
314#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) 322#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
315#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 323#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
316#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 324#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
317 325#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS)
326#define mmc_card_need_bkops(c) ((c)->state & MMC_STATE_NEED_BKOPS)
318#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 327#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
319#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 328#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
320#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 329#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
@@ -356,6 +365,11 @@ static inline void __maybe_unused remove_quirk_sd(struct mmc_card *card,
356 if (mmc_card_sd(card)) 365 if (mmc_card_sd(card))
357 card->quirks &= ~data; 366 card->quirks &= ~data;
358} 367}
368#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS)
369#define mmc_card_set_need_bkops(c) ((c)->state |= MMC_STATE_NEED_BKOPS)
370
371#define mmc_card_clr_doing_bkops(c) ((c)->state &= ~MMC_STATE_DOING_BKOPS)
372#define mmc_card_clr_need_bkops(c) ((c)->state &= ~MMC_STATE_NEED_BKOPS)
359 373
360static inline int mmc_card_lenient_fn0(const struct mmc_card *c) 374static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
361{ 375{
@@ -403,4 +417,4 @@ extern void mmc_unregister_driver(struct mmc_driver *);
403extern void mmc_fixup_device(struct mmc_card *card, 417extern void mmc_fixup_device(struct mmc_card *card,
404 const struct mmc_fixup *table); 418 const struct mmc_fixup *table);
405 419
406#endif 420#endif /* LINUX_MMC_CARD_H */
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index b6718e549a5..c3e55fa63fb 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -117,6 +117,7 @@ struct mmc_data {
117 117
118 unsigned int sg_len; /* size of scatter list */ 118 unsigned int sg_len; /* size of scatter list */
119 struct scatterlist *sg; /* I/O scatter list */ 119 struct scatterlist *sg; /* I/O scatter list */
120 s32 host_cookie; /* host private data */
120}; 121};
121 122
122struct mmc_request { 123struct mmc_request {
@@ -125,12 +126,18 @@ struct mmc_request {
125 struct mmc_data *data; 126 struct mmc_data *data;
126 struct mmc_command *stop; 127 struct mmc_command *stop;
127 128
128 void *done_data; /* completion data */ 129 struct completion completion;
129 void (*done)(struct mmc_request *);/* completion function */ 130 void (*done)(struct mmc_request *);/* completion function */
130}; 131};
131 132
132struct mmc_host; 133struct mmc_host;
133struct mmc_card; 134struct mmc_card;
135struct mmc_async_req;
136
137extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
138 struct mmc_async_req *, int *);
139extern int mmc_interrupt_hpi(struct mmc_card *);
140extern int mmc_bkops_start(struct mmc_card *card, bool is_synchronous);
134 141
135extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *); 142extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
136extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); 143extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
@@ -155,6 +162,7 @@ extern int mmc_can_trim(struct mmc_card *card);
155extern int mmc_can_secure_erase_trim(struct mmc_card *card); 162extern int mmc_can_secure_erase_trim(struct mmc_card *card);
156extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, 163extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
157 unsigned int nr); 164 unsigned int nr);
165extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
158 166
159extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen); 167extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
160 168
@@ -179,4 +187,4 @@ static inline void mmc_claim_host(struct mmc_host *host)
179 187
180extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); 188extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
181 189
182#endif 190#endif /* LINUX_MMC_CORE_H */
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index bdd7ceeb99e..6b46819705d 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -11,8 +11,8 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#ifndef _LINUX_MMC_DW_MMC_H_ 14#ifndef LINUX_MMC_DW_MMC_H
15#define _LINUX_MMC_DW_MMC_H_ 15#define LINUX_MMC_DW_MMC_H
16 16
17#define MAX_MCI_SLOTS 2 17#define MAX_MCI_SLOTS 2
18 18
@@ -48,6 +48,7 @@ struct mmc_data;
48 * @data: The data currently being transferred, or NULL if no data 48 * @data: The data currently being transferred, or NULL if no data
49 * transfer is in progress. 49 * transfer is in progress.
50 * @use_dma: Whether DMA channel is initialized or not. 50 * @use_dma: Whether DMA channel is initialized or not.
51 * @using_dma: Whether DMA is in use for the current transfer.
51 * @sg_dma: Bus address of DMA buffer. 52 * @sg_dma: Bus address of DMA buffer.
52 * @sg_cpu: Virtual address of DMA buffer. 53 * @sg_cpu: Virtual address of DMA buffer.
53 * @dma_ops: Pointer to platform-specific DMA callbacks. 54 * @dma_ops: Pointer to platform-specific DMA callbacks.
@@ -74,7 +75,11 @@ struct mmc_data;
74 * @pdev: Platform device associated with the MMC controller. 75 * @pdev: Platform device associated with the MMC controller.
75 * @pdata: Platform data associated with the MMC controller. 76 * @pdata: Platform data associated with the MMC controller.
76 * @slot: Slots sharing this MMC controller. 77 * @slot: Slots sharing this MMC controller.
78 * @fifo_depth: depth of FIFO.
77 * @data_shift: log2 of FIFO item size. 79 * @data_shift: log2 of FIFO item size.
80 * @part_buf_start: Start index in part_buf.
81 * @part_buf_count: Bytes of partial data in part_buf.
82 * @part_buf: Simple buffer for partial fifo reads/writes.
78 * @push_data: Pointer to FIFO push function. 83 * @push_data: Pointer to FIFO push function.
79 * @pull_data: Pointer to FIFO pull function. 84 * @pull_data: Pointer to FIFO pull function.
80 * @quirks: Set of quirks that apply to specific versions of the IP. 85 * @quirks: Set of quirks that apply to specific versions of the IP.
@@ -117,6 +122,7 @@ struct dw_mci {
117 122
118 /* DMA interface members*/ 123 /* DMA interface members*/
119 int use_dma; 124 int use_dma;
125 int using_dma;
120 126
121 dma_addr_t sg_dma; 127 dma_addr_t sg_dma;
122 void *sg_cpu; 128 void *sg_cpu;
@@ -131,7 +137,7 @@ struct dw_mci {
131 u32 stop_cmdr; 137 u32 stop_cmdr;
132 u32 dir_status; 138 u32 dir_status;
133 struct tasklet_struct tasklet; 139 struct tasklet_struct tasklet;
134 struct tasklet_struct card_tasklet; 140 struct work_struct card_work;
135 unsigned long pending_events; 141 unsigned long pending_events;
136 unsigned long completed_events; 142 unsigned long completed_events;
137 enum dw_mci_state state; 143 enum dw_mci_state state;
@@ -146,7 +152,15 @@ struct dw_mci {
146 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 152 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
147 153
148 /* FIFO push and pull */ 154 /* FIFO push and pull */
155 int fifo_depth;
149 int data_shift; 156 int data_shift;
157 u8 part_buf_start;
158 u8 part_buf_count;
159 union {
160 u16 part_buf16;
161 u32 part_buf32;
162 u64 part_buf;
163 };
150 void (*push_data)(struct dw_mci *host, void *buf, int cnt); 164 void (*push_data)(struct dw_mci *host, void *buf, int cnt);
151 void (*pull_data)(struct dw_mci *host, void *buf, int cnt); 165 void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
152 166
@@ -196,6 +210,12 @@ struct dw_mci_board {
196 unsigned int bus_hz; /* Bus speed */ 210 unsigned int bus_hz; /* Bus speed */
197 211
198 unsigned int caps; /* Capabilities */ 212 unsigned int caps; /* Capabilities */
213 /*
214 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
215 * but note that this may not be reliable after a bootloader has used
216 * it.
217 */
218 unsigned int fifo_depth;
199 219
200 /* delay in mS before detecting cards after interrupt */ 220 /* delay in mS before detecting cards after interrupt */
201 u32 detect_delay_ms; 221 u32 detect_delay_ms;
@@ -219,4 +239,4 @@ struct dw_mci_board {
219 struct block_settings *blk_settings; 239 struct block_settings *blk_settings;
220}; 240};
221 241
222#endif /* _LINUX_MMC_DW_MMC_H_ */ 242#endif /* LINUX_MMC_DW_MMC_H */
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
144struct mmc_card; 153struct mmc_card;
145struct device; 154struct device;
146 155
156struct 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
147struct mmc_host { 166struct 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 *);
289extern void mmc_remove_host(struct mmc_host *); 326extern void mmc_remove_host(struct mmc_host *);
290extern void mmc_free_host(struct mmc_host *); 327extern void mmc_free_host(struct mmc_host *);
291 328
329#ifdef CONFIG_MMC_EMBEDDED_SDIO
330extern 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
292static inline void *mmc_priv(struct mmc_host *host) 337static 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
350static 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
358extern int mmc_resume_bus(struct mmc_host *host);
302 359
303extern int mmc_suspend_host(struct mmc_host *); 360extern int mmc_suspend_host(struct mmc_host *);
304extern int mmc_resume_host(struct mmc_host *); 361extern 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
diff --git a/include/linux/mmc/ioctl.h b/include/linux/mmc/ioctl.h
index 5baf2983a12..8fa5bc5f805 100644
--- a/include/linux/mmc/ioctl.h
+++ b/include/linux/mmc/ioctl.h
@@ -51,4 +51,4 @@ struct mmc_ioc_cmd {
51 * block device operations. 51 * block device operations.
52 */ 52 */
53#define MMC_IOC_MAX_BYTES (512L * 256) 53#define MMC_IOC_MAX_BYTES (512L * 256)
54#endif /* LINUX_MMC_IOCTL_H */ 54#endif /* LINUX_MMC_IOCTL_H */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index ac26a685cca..2bb1dfd4cf1 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -21,8 +21,8 @@
21 * 15 May 2002 21 * 15 May 2002
22 */ 22 */
23 23
24#ifndef MMC_MMC_H 24#ifndef LINUX_MMC_MMC_H
25#define MMC_MMC_H 25#define LINUX_MMC_MMC_H
26 26
27/* Standard MMC commands (4.1) type argument response */ 27/* Standard MMC commands (4.1) type argument response */
28 /* class 1 */ 28 /* class 1 */
@@ -138,8 +138,19 @@ static inline bool mmc_op_multi(u32 opcode)
138#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 138#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
139#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 139#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
140#define R1_SWITCH_ERROR (1 << 7) /* sx, c */ 140#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
141#define R1_URGENT_BKOPS (1 << 6) /* sr, a */
141#define R1_APP_CMD (1 << 5) /* sr, c */ 142#define R1_APP_CMD (1 << 5) /* sr, c */
142 143
144#define R1_STATE_IDLE 0
145#define R1_STATE_READY 1
146#define R1_STATE_IDENT 2
147#define R1_STATE_STBY 3
148#define R1_STATE_TRAN 4
149#define R1_STATE_DATA 5
150#define R1_STATE_RCV 6
151#define R1_STATE_PRG 7
152#define R1_STATE_DIS 8
153
143/* 154/*
144 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS 155 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS
145 * R1 is the low order byte; R2 is the next highest byte, when present. 156 * R1 is the low order byte; R2 is the next highest byte, when present.
@@ -262,6 +273,9 @@ struct _mmc_csd {
262 273
263#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 274#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
264#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 275#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
276#define EXT_CSD_HPI_MGMT 161 /* R/W */
277#define EXT_CSD_BKOPS_EN 163 /* R/W */
278#define EXT_CSD_BKOPS_START 164 /* R/W */
265#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 279#define EXT_CSD_WR_REL_PARAM 166 /* RO */
266#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 280#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
267#define EXT_CSD_PART_CONFIG 179 /* R/W */ 281#define EXT_CSD_PART_CONFIG 179 /* R/W */
@@ -271,6 +285,7 @@ struct _mmc_csd {
271#define EXT_CSD_REV 192 /* RO */ 285#define EXT_CSD_REV 192 /* RO */
272#define EXT_CSD_STRUCTURE 194 /* RO */ 286#define EXT_CSD_STRUCTURE 194 /* RO */
273#define EXT_CSD_CARD_TYPE 196 /* RO */ 287#define EXT_CSD_CARD_TYPE 196 /* RO */
288#define EXT_CSD_OUT_OF_INTERRUPT_TIME 198 /* RO */
274#define EXT_CSD_PART_SWITCH_TIME 199 /* RO */ 289#define EXT_CSD_PART_SWITCH_TIME 199 /* RO */
275#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 290#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
276#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ 291#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
@@ -283,6 +298,9 @@ struct _mmc_csd {
283#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ 298#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
284#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ 299#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
285#define EXT_CSD_TRIM_MULT 232 /* RO */ 300#define EXT_CSD_TRIM_MULT 232 /* RO */
301#define EXT_CSD_BKOPS_STATUS 246 /* RO */
302#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
303#define EXT_CSD_HPI_FEATURES 503 /* RO */
286 304
287/* 305/*
288 * EXT_CSD field definitions 306 * EXT_CSD field definitions
@@ -327,5 +345,4 @@ struct _mmc_csd {
327#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */ 345#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */
328#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */ 346#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
329 347
330#endif /* MMC_MMC_PROTOCOL_H */ 348#endif /* LINUX_MMC_MMC_H */
331
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
index d37aac49cf9..6e2d6a135c7 100644
--- a/include/linux/mmc/pm.h
+++ b/include/linux/mmc/pm.h
@@ -26,5 +26,6 @@ typedef unsigned int mmc_pm_flag_t;
26 26
27#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */ 27#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */
28#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */ 28#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */
29#define MMC_PM_IGNORE_PM_NOTIFY (1 << 2) /* ignore mmc pm notify */
29 30
30#endif 31#endif /* LINUX_MMC_PM_H */
diff --git a/include/linux/mmc/sd.h b/include/linux/mmc/sd.h
index 7d35d52c3df..1ebcf9ba125 100644
--- a/include/linux/mmc/sd.h
+++ b/include/linux/mmc/sd.h
@@ -9,8 +9,8 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#ifndef MMC_SD_H 12#ifndef LINUX_MMC_SD_H
13#define MMC_SD_H 13#define LINUX_MMC_SD_H
14 14
15/* SD commands type argument response */ 15/* SD commands type argument response */
16 /* class 0 */ 16 /* class 0 */
@@ -91,5 +91,4 @@
91#define SD_SWITCH_ACCESS_DEF 0 91#define SD_SWITCH_ACCESS_DEF 0
92#define SD_SWITCH_ACCESS_HS 1 92#define SD_SWITCH_ACCESS_HS 1
93 93
94#endif 94#endif /* LINUX_MMC_SD_H */
95
diff --git a/include/linux/mmc/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h
deleted file mode 100644
index 548d59d404c..00000000000
--- a/include/linux/mmc/sdhci-pltfm.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Platform data declarations for the sdhci-pltfm driver.
3 *
4 * Copyright (c) 2010 MontaVista Software, LLC.
5 *
6 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or (at
11 * your option) any later version.
12 */
13
14#ifndef _SDHCI_PLTFM_H
15#define _SDHCI_PLTFM_H
16
17struct sdhci_ops;
18struct sdhci_host;
19
20/**
21 * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks
22 * @ops: optional pointer to the platform-provided SDHCI ops
23 * @quirks: optional SDHCI quirks
24 * @init: optional hook that is called during device probe, before the
25 * driver tries to access any SDHCI registers
26 * @exit: optional hook that is called during device removal
27 */
28struct sdhci_pltfm_data {
29 struct sdhci_ops *ops;
30 unsigned int quirks;
31 int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata);
32 void (*exit)(struct sdhci_host *host);
33};
34
35#endif /* _SDHCI_PLTFM_H */
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
index 9188c973f3e..5cdc96da9dd 100644
--- a/include/linux/mmc/sdhci-spear.h
+++ b/include/linux/mmc/sdhci-spear.h
@@ -11,8 +11,8 @@
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#ifndef MMC_SDHCI_SPEAR_H 14#ifndef LINUX_MMC_SDHCI_SPEAR_H
15#define MMC_SDHCI_SPEAR_H 15#define LINUX_MMC_SDHCI_SPEAR_H
16 16
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18/* 18/*
@@ -39,4 +39,4 @@ sdhci_set_plat_data(struct platform_device *pdev, struct sdhci_plat_data *data)
39 pdev->dev.platform_data = data; 39 pdev->dev.platform_data = data;
40} 40}
41 41
42#endif /* MMC_SDHCI_SPEAR_H */ 42#endif /* LINUX_MMC_SDHCI_SPEAR_H */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 6a68c4eb4e4..5ee48390dec 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -8,8 +8,8 @@
8 * the Free Software Foundation; either version 2 of the License, or (at 8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11#ifndef __SDHCI_H 11#ifndef LINUX_MMC_SDHCI_H
12#define __SDHCI_H 12#define LINUX_MMC_SDHCI_H
13 13
14#include <linux/scatterlist.h> 14#include <linux/scatterlist.h>
15#include <linux/compiler.h> 15#include <linux/compiler.h>
@@ -21,72 +21,78 @@ struct sdhci_host {
21 /* Data set by hardware interface driver */ 21 /* Data set by hardware interface driver */
22 const char *hw_name; /* Hardware bus name */ 22 const char *hw_name; /* Hardware bus name */
23 23
24 unsigned int quirks; /* Deviations from spec. */ 24 u64 quirks; /* Deviations from spec. */
25 25
26/* Controller doesn't honor resets unless we touch the clock register */ 26/* Controller doesn't honor resets unless we touch the clock register */
27#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) 27#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1ULL<<0)
28/* Controller has bad caps bits, but really supports DMA */ 28/* Controller has bad caps bits, but really supports DMA */
29#define SDHCI_QUIRK_FORCE_DMA (1<<1) 29#define SDHCI_QUIRK_FORCE_DMA (1ULL<<1)
30/* Controller doesn't like to be reset when there is no card inserted. */ 30/* Controller doesn't like to be reset when there is no card inserted. */
31#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2) 31#define SDHCI_QUIRK_NO_CARD_NO_RESET (1ULL<<2)
32/* Controller doesn't like clearing the power reg before a change */ 32/* Controller doesn't like clearing the power reg before a change */
33#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3) 33#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1ULL<<3)
34/* Controller has flaky internal state so reset it on each ios change */ 34/* Controller has flaky internal state so reset it on each ios change */
35#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4) 35#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1ULL<<4)
36/* Controller has an unusable DMA engine */ 36/* Controller has an unusable DMA engine */
37#define SDHCI_QUIRK_BROKEN_DMA (1<<5) 37#define SDHCI_QUIRK_BROKEN_DMA (1ULL<<5)
38/* Controller has an unusable ADMA engine */ 38/* Controller has an unusable ADMA engine */
39#define SDHCI_QUIRK_BROKEN_ADMA (1<<6) 39#define SDHCI_QUIRK_BROKEN_ADMA (1ULL<<6)
40/* Controller can only DMA from 32-bit aligned addresses */ 40/* Controller can only DMA from 32-bit aligned addresses */
41#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<7) 41#define SDHCI_QUIRK_32BIT_DMA_ADDR (1ULL<<7)
42/* Controller can only DMA chunk sizes that are a multiple of 32 bits */ 42/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
43#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<8) 43#define SDHCI_QUIRK_32BIT_DMA_SIZE (1ULL<<8)
44/* Controller can only ADMA chunks that are a multiple of 32 bits */ 44/* Controller can only ADMA chunks that are a multiple of 32 bits */
45#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1<<9) 45#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1ULL<<9)
46/* Controller needs to be reset after each request to stay stable */ 46/* Controller needs to be reset after each request to stay stable */
47#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<10) 47#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1ULL<<10)
48/* Controller needs voltage and power writes to happen separately */ 48/* Controller needs voltage and power writes to happen separately */
49#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11) 49#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1ULL<<11)
50/* Controller provides an incorrect timeout value for transfers */ 50/* Controller provides an incorrect timeout value for transfers */
51#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) 51#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1ULL<<12)
52/* Controller has an issue with buffer bits for small transfers */ 52/* Controller has an issue with buffer bits for small transfers */
53#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13) 53#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1ULL<<13)
54/* Controller does not provide transfer-complete interrupt when not busy */ 54/* Controller does not provide transfer-complete interrupt when not busy */
55#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<14) 55#define SDHCI_QUIRK_NO_BUSY_IRQ (1ULL<<14)
56/* Controller has unreliable card detection */ 56/* Controller has unreliable card detection */
57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) 57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1ULL<<15)
58/* Controller reports inverted write-protect state */ 58/* Controller reports inverted write-protect state */
59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) 59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1ULL<<16)
60/* Controller has nonstandard clock management */ 60/* Controller has nonstandard clock management */
61#define SDHCI_QUIRK_NONSTANDARD_CLOCK (1<<17) 61#define SDHCI_QUIRK_NONSTANDARD_CLOCK (1ULL<<17)
62/* Controller does not like fast PIO transfers */ 62/* Controller does not like fast PIO transfers */
63#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18) 63#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1ULL<<18)
64/* Controller losing signal/interrupt enable states after reset */ 64/* Controller losing signal/interrupt enable states after reset */
65#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1<<19) 65#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1ULL<<19)
66/* Controller has to be forced to use block size of 2048 bytes */ 66/* Controller has to be forced to use block size of 2048 bytes */
67#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20) 67#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1ULL<<20)
68/* Controller cannot do multi-block transfers */ 68/* Controller cannot do multi-block transfers */
69#define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21) 69#define SDHCI_QUIRK_NO_MULTIBLOCK (1ULL<<21)
70/* Controller can only handle 1-bit data transfers */ 70/* Controller can only handle 1-bit data transfers */
71#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22) 71#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1ULL<<22)
72/* Controller needs 10ms delay between applying power and clock */ 72/* Controller needs 10ms delay between applying power and clock */
73#define SDHCI_QUIRK_DELAY_AFTER_POWER (1<<23) 73#define SDHCI_QUIRK_DELAY_AFTER_POWER (1ULL<<23)
74/* Controller uses SDCLK instead of TMCLK for data timeouts */ 74/* Controller uses SDCLK instead of TMCLK for data timeouts */
75#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1<<24) 75#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1ULL<<24)
76/* Controller reports wrong base clock capability */ 76/* Controller reports wrong base clock capability */
77#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25) 77#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1ULL<<25)
78/* Controller cannot support End Attribute in NOP ADMA descriptor */ 78/* Controller cannot support End Attribute in NOP ADMA descriptor */
79#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26) 79#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1ULL<<26)
80/* Controller is missing device caps. Use caps provided by host */ 80/* Controller is missing device caps. Use caps provided by host */
81#define SDHCI_QUIRK_MISSING_CAPS (1<<27) 81#define SDHCI_QUIRK_MISSING_CAPS (1ULL<<27)
82/* Controller uses Auto CMD12 command to stop the transfer */ 82/* Controller uses Auto CMD12 command to stop the transfer */
83#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28) 83#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1ULL<<28)
84/* Controller doesn't have HISPD bit field in HI-SPEED SD card */ 84/* Controller doesn't have HISPD bit field in HI-SPEED SD card */
85#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29) 85#define SDHCI_QUIRK_NO_HISPD_BIT (1ULL<<29)
86/* Controller treats ADMA descriptors with length 0000h incorrectly */ 86/* Controller treats ADMA descriptors with length 0000h incorrectly */
87#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30) 87#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1ULL<<30)
88/* The read-only detection via SDHCI_PRESENT_STATE register is unstable */ 88/* The read-only detection via SDHCI_PRESENT_STATE register is unstable */
89#define SDHCI_QUIRK_UNSTABLE_RO_DETECT (1<<31) 89#define SDHCI_QUIRK_UNSTABLE_RO_DETECT (1ULL<<31)
90/* Controller cannot report the line status in present state register */
91#define SDHCI_QUIRK_NON_STD_VOLTAGE_SWITCHING (1ULL<<32)
92/* Controller doesn't follow the standard frequency tuning procedure */
93#define SDHCI_QUIRK_NON_STANDARD_TUNING (1ULL<<33)
94/* Controller doesn't calculate max_discard_to */
95#define SDHCI_QUIRK_NO_CALC_MAX_DISCARD_TO (1ULL<<34)
90 96
91 int irq; /* Device IRQ */ 97 int irq; /* Device IRQ */
92 void __iomem *ioaddr; /* Mapped address */ 98 void __iomem *ioaddr; /* Mapped address */
@@ -145,6 +151,7 @@ struct sdhci_host {
145 struct tasklet_struct finish_tasklet; 151 struct tasklet_struct finish_tasklet;
146 152
147 struct timer_list timer; /* Timer for timeouts */ 153 struct timer_list timer; /* Timer for timeouts */
154 unsigned int card_int_set; /* card int status */
148 155
149 unsigned int caps; /* Alternative capabilities */ 156 unsigned int caps; /* Alternative capabilities */
150 157
@@ -162,4 +169,4 @@ struct sdhci_host {
162 169
163 unsigned long private[0] ____cacheline_aligned; 170 unsigned long private[0] ____cacheline_aligned;
164}; 171};
165#endif /* __SDHCI_H */ 172#endif /* LINUX_MMC_SDHCI_H */
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index 245cdacee54..666ff6b0aea 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -9,8 +9,8 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#ifndef MMC_SDIO_H 12#ifndef LINUX_MMC_SDIO_H
13#define MMC_SDIO_H 13#define LINUX_MMC_SDIO_H
14 14
15/* SDIO commands type argument response */ 15/* SDIO commands type argument response */
16#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */ 16#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */
@@ -38,7 +38,8 @@
38 * [8:0] Byte/block count 38 * [8:0] Byte/block count
39 */ 39 */
40 40
41#define R4_MEMORY_PRESENT (1 << 27) 41#define R4_18V_PRESENT BIT(24)
42#define R4_MEMORY_PRESENT BIT(27)
42 43
43/* 44/*
44 SDIO status in R5 45 SDIO status in R5
@@ -72,17 +73,20 @@
72#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */ 73#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */
73#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */ 74#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */
74#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */ 75#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */
76#define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */
75 77
76#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */ 78#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */
77#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */ 79#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */
78#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */ 80#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */
79#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */ 81#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */
82#define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */
80 83
81#define SDIO_CCCR_SD 0x01 84#define SDIO_CCCR_SD 0x01
82 85
83#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */ 86#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
84#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */ 87#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
85#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */ 88#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
89#define SDIO_SD_REV_3_00 3 /* SD Physical Spev Version 3.00 */
86 90
87#define SDIO_CCCR_IOEx 0x02 91#define SDIO_CCCR_IOEx 0x02
88#define SDIO_CCCR_IORx 0x03 92#define SDIO_CCCR_IORx 0x03
@@ -132,8 +136,31 @@
132#define SDIO_CCCR_SPEED 0x13 136#define SDIO_CCCR_SPEED 0x13
133 137
134#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */ 138#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
135#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */ 139#define SDIO_SPEED_BSS_SHIFT 1
136 140#define SDIO_SPEED_BSS_MASK (7 << SDIO_SPEED_BSS_SHIFT)
141#define SDIO_SPEED_SDR12 (0 << SDIO_SPEED_BSS_SHIFT)
142#define SDIO_SPEED_SDR25 (1 << SDIO_SPEED_BSS_SHIFT)
143#define SDIO_SPEED_SDR50 (2 << SDIO_SPEED_BSS_SHIFT)
144#define SDIO_SPEED_SDR104 (3 << SDIO_SPEED_BSS_SHIFT)
145#define SDIO_SPEED_DDR50 (4 << SDIO_SPEED_BSS_SHIFT)
146#define SDIO_SPEED_EHS SDIO_SPEED_SDR25 /* Enable High-Speed */
147
148#define SDIO_CCCR_UHS 0x14
149#define SDIO_UHS_SDR50 0x01
150#define SDIO_UHS_SDR104 0x02
151#define SDIO_UHS_DDR50 0x04
152
153#define SDIO_CCCR_DRIVE_STRENGTH 0x15
154#define SDIO_SDTx_MASK 0x07
155#define SDIO_DRIVE_SDTA (1 << 0)
156#define SDIO_DRIVE_SDTC (1 << 1)
157#define SDIO_DRIVE_SDTD (1 << 2)
158#define SDIO_DRIVE_DTSx_MASK 0x03
159#define SDIO_DRIVE_DTSx_SHIFT 4
160#define SDIO_DTSx_SET_TYPE_B (0 << SDIO_DRIVE_DTSx_SHIFT)
161#define SDIO_DTSx_SET_TYPE_A (1 << SDIO_DRIVE_DTSx_SHIFT)
162#define SDIO_DTSx_SET_TYPE_C (2 << SDIO_DRIVE_DTSx_SHIFT)
163#define SDIO_DTSx_SET_TYPE_D (3 << SDIO_DRIVE_DTSx_SHIFT)
137/* 164/*
138 * Function Basic Registers (FBR) 165 * Function Basic Registers (FBR)
139 */ 166 */
@@ -161,5 +188,4 @@
161 188
162#define SDIO_FBR_BLKSIZE 0x10 /* block size (2 bytes) */ 189#define SDIO_FBR_BLKSIZE 0x10 /* block size (2 bytes) */
163 190
164#endif 191#endif /* LINUX_MMC_SDIO_H */
165
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 31baaf82f45..dc680c4b50d 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -9,8 +9,8 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#ifndef MMC_SDIO_FUNC_H 12#ifndef LINUX_MMC_SDIO_FUNC_H
13#define MMC_SDIO_FUNC_H 13#define LINUX_MMC_SDIO_FUNC_H
14 14
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/mod_devicetable.h> 16#include <linux/mod_devicetable.h>
@@ -23,6 +23,14 @@ struct sdio_func;
23typedef void (sdio_irq_handler_t)(struct sdio_func *); 23typedef void (sdio_irq_handler_t)(struct sdio_func *);
24 24
25/* 25/*
26 * Structure used to hold embedded SDIO device data from platform layer
27 */
28struct sdio_embedded_func {
29 uint8_t f_class;
30 uint32_t f_maxblksize;
31};
32
33/*
26 * SDIO function CIS tuple (unknown to the core) 34 * SDIO function CIS tuple (unknown to the core)
27 */ 35 */
28struct sdio_func_tuple { 36struct sdio_func_tuple {
@@ -130,6 +138,8 @@ extern int sdio_release_irq(struct sdio_func *func);
130extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz); 138extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
131 139
132extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret); 140extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
141extern u8 sdio_readb_ext(struct sdio_func *func, unsigned int addr, int *err_ret,
142 unsigned in);
133extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret); 143extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
134extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret); 144extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
135 145
@@ -161,5 +171,4 @@ extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
161extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func); 171extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
162extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags); 172extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
163 173
164#endif 174#endif /* LINUX_MMC_SDIO_FUNC_H */
165
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index a36ab3bc7b0..9f03feedc8e 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -2,8 +2,8 @@
2 * SDIO Classes, Interface Types, Manufacturer IDs, etc. 2 * SDIO Classes, Interface Types, Manufacturer IDs, etc.
3 */ 3 */
4 4
5#ifndef MMC_SDIO_IDS_H 5#ifndef LINUX_MMC_SDIO_IDS_H
6#define MMC_SDIO_IDS_H 6#define LINUX_MMC_SDIO_IDS_H
7 7
8/* 8/*
9 * Standard SDIO Function Interfaces 9 * Standard SDIO Function Interfaces
@@ -44,4 +44,4 @@
44#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100 44#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100
45#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347 45#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347
46 46
47#endif 47#endif /* LINUX_MMC_SDIO_IDS_H */
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 9eb9b4b96f5..0222cd8ebe7 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -11,8 +11,8 @@
11 * 11 *
12 */ 12 */
13 13
14#ifndef __SH_MMCIF_H__ 14#ifndef LINUX_MMC_SH_MMCIF_H
15#define __SH_MMCIF_H__ 15#define LINUX_MMC_SH_MMCIF_H
16 16
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -220,4 +220,4 @@ static inline void sh_mmcif_boot_init(void __iomem *base)
220 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000); 220 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000);
221} 221}
222 222
223#endif /* __SH_MMCIF_H__ */ 223#endif /* LINUX_MMC_SH_MMCIF_H */
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index faf32b6ec18..bd50b365167 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -1,5 +1,5 @@
1#ifndef __SH_MOBILE_SDHI_H__ 1#ifndef LINUX_MMC_SH_MOBILE_SDHI_H
2#define __SH_MOBILE_SDHI_H__ 2#define LINUX_MMC_SH_MOBILE_SDHI_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
@@ -17,4 +17,4 @@ struct sh_mobile_sdhi_info {
17 int (*get_cd)(struct platform_device *pdev); 17 int (*get_cd)(struct platform_device *pdev);
18}; 18};
19 19
20#endif /* __SH_MOBILE_SDHI_H__ */ 20#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
index 19490b942db..a1c1f321e51 100644
--- a/include/linux/mmc/tmio.h
+++ b/include/linux/mmc/tmio.h
@@ -12,8 +12,8 @@
12 * 12 *
13 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3 13 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
14 */ 14 */
15#ifndef _LINUX_MMC_TMIO_H_ 15#ifndef LINUX_MMC_TMIO_H
16#define _LINUX_MMC_TMIO_H_ 16#define LINUX_MMC_TMIO_H
17 17
18#define CTL_SD_CMD 0x00 18#define CTL_SD_CMD 0x00
19#define CTL_ARG_REG 0x04 19#define CTL_ARG_REG 0x04
@@ -21,6 +21,7 @@
21#define CTL_XFER_BLK_COUNT 0xa 21#define CTL_XFER_BLK_COUNT 0xa
22#define CTL_RESPONSE 0x0c 22#define CTL_RESPONSE 0x0c
23#define CTL_STATUS 0x1c 23#define CTL_STATUS 0x1c
24#define CTL_STATUS2 0x1e
24#define CTL_IRQ_MASK 0x20 25#define CTL_IRQ_MASK 0x20
25#define CTL_SD_CARD_CLK_CTL 0x24 26#define CTL_SD_CARD_CLK_CTL 0x24
26#define CTL_SD_XFER_LEN 0x26 27#define CTL_SD_XFER_LEN 0x26
@@ -30,6 +31,7 @@
30#define CTL_TRANSACTION_CTL 0x34 31#define CTL_TRANSACTION_CTL 0x34
31#define CTL_SDIO_STATUS 0x36 32#define CTL_SDIO_STATUS 0x36
32#define CTL_SDIO_IRQ_MASK 0x38 33#define CTL_SDIO_IRQ_MASK 0x38
34#define CTL_DMA_ENABLE 0xd8
33#define CTL_RESET_SD 0xe0 35#define CTL_RESET_SD 0xe0
34#define CTL_SDIO_REGS 0x100 36#define CTL_SDIO_REGS 0x100
35#define CTL_CLK_AND_WAIT_CTL 0x138 37#define CTL_CLK_AND_WAIT_CTL 0x138
@@ -60,4 +62,4 @@
60 62
61#define TMIO_BBS 512 /* Boot block size */ 63#define TMIO_BBS 512 /* Boot block size */
62 64
63#endif /* _LINUX_MMC_TMIO_H_ */ 65#endif /* LINUX_MMC_TMIO_H */