aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc/protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mmc/protocol.h')
-rw-r--r--include/linux/mmc/protocol.h74
1 files changed, 71 insertions, 3 deletions
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
index 08dec8d9e703..2dce60c43f4b 100644
--- a/include/linux/mmc/protocol.h
+++ b/include/linux/mmc/protocol.h
@@ -25,14 +25,16 @@
25#ifndef MMC_MMC_PROTOCOL_H 25#ifndef MMC_MMC_PROTOCOL_H
26#define MMC_MMC_PROTOCOL_H 26#define MMC_MMC_PROTOCOL_H
27 27
28/* Standard MMC commands (3.1) type argument response */ 28/* Standard MMC commands (4.1) type argument response */
29 /* class 1 */ 29 /* class 1 */
30#define MMC_GO_IDLE_STATE 0 /* bc */ 30#define MMC_GO_IDLE_STATE 0 /* bc */
31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */ 31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */
32#define MMC_ALL_SEND_CID 2 /* bcr R2 */ 32#define MMC_ALL_SEND_CID 2 /* bcr R2 */
33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ 33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
34#define MMC_SET_DSR 4 /* bc [31:16] RCA */ 34#define MMC_SET_DSR 4 /* bc [31:16] RCA */
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 */
37#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
36#define MMC_SEND_CSD 9 /* ac [31:16] RCA R2 */ 38#define MMC_SEND_CSD 9 /* ac [31:16] RCA R2 */
37#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */ 39#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */
38#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */ 40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */
@@ -80,6 +82,7 @@
80 /* class 8 */ 82 /* class 8 */
81/* This is basically the same command as for MMC with some quirks. */ 83/* This is basically the same command as for MMC with some quirks. */
82#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */ 84#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
85#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
83 86
84 /* Application commands */ 87 /* Application commands */
85#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ 88#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
@@ -88,6 +91,30 @@
88#define SD_APP_SEND_SCR 51 /* adtc R1 */ 91#define SD_APP_SEND_SCR 51 /* adtc R1 */
89 92
90/* 93/*
94 * MMC_SWITCH argument format:
95 *
96 * [31:26] Always 0
97 * [25:24] Access Mode
98 * [23:16] Location of target Byte in EXT_CSD
99 * [15:08] Value Byte
100 * [07:03] Always 0
101 * [02:00] Command Set
102 */
103
104/*
105 * SD_SWITCH argument format:
106 *
107 * [31] Check (0) or switch (1)
108 * [30:24] Reserved (0)
109 * [23:20] Function group 6
110 * [19:16] Function group 5
111 * [15:12] Function group 4
112 * [11:8] Function group 3
113 * [7:4] Function group 2
114 * [3:0] Function group 1
115 */
116
117/*
91 MMC status in R1 118 MMC status in R1
92 Type 119 Type
93 e : error bit 120 e : error bit
@@ -230,13 +257,54 @@ struct _mmc_csd {
230 257
231#define CSD_STRUCT_VER_1_0 0 /* Valid for system specification 1.0 - 1.2 */ 258#define CSD_STRUCT_VER_1_0 0 /* Valid for system specification 1.0 - 1.2 */
232#define CSD_STRUCT_VER_1_1 1 /* Valid for system specification 1.4 - 2.2 */ 259#define CSD_STRUCT_VER_1_1 1 /* Valid for system specification 1.4 - 2.2 */
233#define CSD_STRUCT_VER_1_2 2 /* Valid for system specification 3.1 */ 260#define CSD_STRUCT_VER_1_2 2 /* Valid for system specification 3.1 - 3.2 - 3.31 - 4.0 - 4.1 */
261#define CSD_STRUCT_EXT_CSD 3 /* Version is coded in CSD_STRUCTURE in EXT_CSD */
234 262
235#define CSD_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.2 */ 263#define CSD_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.2 */
236#define CSD_SPEC_VER_1 1 /* Implements system specification 1.4 */ 264#define CSD_SPEC_VER_1 1 /* Implements system specification 1.4 */
237#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */ 265#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */
238#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 */ 266#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 - 3.2 - 3.31 */
267#define CSD_SPEC_VER_4 4 /* Implements system specification 4.0 - 4.1 */
268
269/*
270 * EXT_CSD fields
271 */
272
273#define EXT_CSD_BUS_WIDTH 183 /* R/W */
274#define EXT_CSD_HS_TIMING 185 /* R/W */
275#define EXT_CSD_CARD_TYPE 196 /* RO */
276
277/*
278 * EXT_CSD field definitions
279 */
280
281#define EXT_CSD_CMD_SET_NORMAL (1<<0)
282#define EXT_CSD_CMD_SET_SECURE (1<<1)
283#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
284
285#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
286#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
287
288#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
289#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
290#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
291
292/*
293 * MMC_SWITCH access modes
294 */
295
296#define MMC_SWITCH_MODE_CMD_SET 0x00 /* Change the command set */
297#define MMC_SWITCH_MODE_SET_BITS 0x01 /* Set bits which are 1 in value */
298#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */
299#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
300
301/*
302 * SCR field definitions
303 */
239 304
305#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
306#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
307#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
240 308
241/* 309/*
242 * SD bus widths 310 * SD bus widths