40#define MMC_NAME_PREFIX "MMC"
42#define MMC_DEVICE_DESCRIPTION "MMC/SD Device"
43#define MMC_STORAGE_DESCRIPTION "MMC/SD Storage Device"
45#define MMC_STATUS_TIMER_INTERVAL 1000
47#define MMC_DEFAULT_BLOCKSIZE 512
48#define MMC_DEFAULT_BLOCKSHIFT 9
51#define MMC_TYPE_NONE 0
54#define MMC_TYPE_SDIO 3
55#define MMC_TYPE_SD_COMBO 4
60#define MMC_STATE_EJECTED 0
61#define MMC_STATE_INSERTED 1
63#define MMC_STATE_MAX 1
66#define MMC_FLAG_NONE 0x00000000
67#define MMC_FLAG_CARD_PRESENT 0x00000001
68#define MMC_FLAG_WRITE_PROTECT 0x00000002
69#define MMC_FLAG_HIGH_CAPACITY 0x00000004
70#define MMC_FLAG_EXT_CAPACITY 0x00000008
71#define MMC_FLAG_UHS_I 0x00000010
72#define MMC_FLAG_UHS_II 0x00000020
73#define MMC_FLAG_BLOCK_ADDRESSED 0x00000040
74#define MMC_FLAG_AUTO_BLOCK_COUNT 0x00000080
75#define MMC_FLAG_AUTO_COMMAND_STOP 0x00000100
76#define MMC_FLAG_DDR_MODE 0x00000200
77#define MMC_FLAG_NON_REMOVABLE 0x00000400
78#define MMC_FLAG_SET_BLOCK_COUNT 0x00000800
81#define MMC_STATUS_SUCCESS 0
82#define MMC_STATUS_TIMEOUT 1
83#define MMC_STATUS_NO_MEDIA 2
84#define MMC_STATUS_HARDWARE_ERROR 3
85#define MMC_STATUS_INVALID_DATA 4
86#define MMC_STATUS_INVALID_PARAMETER 5
87#define MMC_STATUS_INVALID_SEQUENCE 6
88#define MMC_STATUS_OUT_OF_MEMORY 7
89#define MMC_STATUS_UNSUPPORTED_REQUEST 8
90#define MMC_STATUS_NOT_PROCESSED 9
91#define MMC_STATUS_OPERATION_FAILED 10
92#define MMC_STATUS_DEVICE_DETACHED 11
93#define MMC_STATUS_DEVICE_UNSUPPORTED 12
94#define MMC_STATUS_NOT_BOUND 13
95#define MMC_STATUS_ALREADY_BOUND 14
96#define MMC_STATUS_NOT_READY 15
99#define SDIO_VERSION_SDIO 0x00040000
100#define SDIO_VERSION_1_00 (SDIO_VERSION_SDIO | 0x0100)
101#define SDIO_VERSION_1_10 (SDIO_VERSION_SDIO | 0x010a)
102#define SDIO_VERSION_1_20 (SDIO_VERSION_SDIO | 0x0114)
103#define SDIO_VERSION_2_00 (SDIO_VERSION_SDIO | 0x0200)
104#define SDIO_VERSION_3_00 (SDIO_VERSION_SDIO | 0x0300)
106#define SD_VERSION_SD 0x00020000
107#define SD_VERSION_1_0 (SD_VERSION_SD | 0x0100)
108#define SD_VERSION_1_10 (SD_VERSION_SD | 0x010a)
109#define SD_VERSION_2 (SD_VERSION_SD | 0x0200)
110#define SD_VERSION_3 (SD_VERSION_SD | 0x0300)
111#define SD_VERSION_4 (SD_VERSION_SD | 0x0400)
113#define MMC_VERSION_MMC 0x00010000
114#define MMC_VERSION_1_2 (MMC_VERSION_MMC | 0x0102)
115#define MMC_VERSION_1_4 (MMC_VERSION_MMC | 0x0104)
116#define MMC_VERSION_2_2 (MMC_VERSION_MMC | 0x0202)
117#define MMC_VERSION_3 (MMC_VERSION_MMC | 0x0300)
118#define MMC_VERSION_4 (MMC_VERSION_MMC | 0x0400)
119#define MMC_VERSION_4_1 (MMC_VERSION_MMC | 0x0401)
120#define MMC_VERSION_4_2 (MMC_VERSION_MMC | 0x0402)
121#define MMC_VERSION_4_3 (MMC_VERSION_MMC | 0x0403)
122#define MMC_VERSION_4_41 (MMC_VERSION_MMC | 0x0429)
123#define MMC_VERSION_4_5 (MMC_VERSION_MMC | 0x0405)
124#define MMC_VERSION_5_0 (MMC_VERSION_MMC | 0x0500)
125#define MMC_VERSION_5_1 (MMC_VERSION_MMC | 0x0501)
126#define MMC_VERSION_UNKNOWN (MMC_VERSION_MMC)
129#define MMC_CAP_4_BIT_DATA (1 << 0)
130#define MMC_CAP_MMC_HIGHSPEED (1 << 1)
131#define MMC_CAP_SD_HIGHSPEED (1 << 2)
132#define MMC_CAP_SDIO_IRQ (1 << 3)
133#define MMC_CAP_SPI (1 << 4)
134#define MMC_CAP_NEEDS_POLL (1 << 5)
135#define MMC_CAP_8_BIT_DATA (1 << 6)
136#define MMC_CAP_AGGRESSIVE_PM (1 << 7)
137#define MMC_CAP_NONREMOVABLE (1 << 8)
138#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9)
139#define MMC_CAP_3_3V_DDR (1 << 11)
140#define MMC_CAP_1_8V_DDR (1 << 12)
141#define MMC_CAP_1_2V_DDR (1 << 13)
142#define MMC_CAP_DDR (MMC_CAP_3_3V_DDR | MMC_CAP_1_8V_DDR | MMC_CAP_1_2V_DDR)
143#define MMC_CAP_POWER_OFF_CARD (1 << 14)
144#define MMC_CAP_BUS_WIDTH_TEST (1 << 15)
145#define MMC_CAP_UHS_SDR12 (1 << 16)
146#define MMC_CAP_UHS_SDR25 (1 << 17)
147#define MMC_CAP_UHS_SDR50 (1 << 18)
148#define MMC_CAP_UHS_SDR104 (1 << 19)
149#define MMC_CAP_UHS_DDR50 (1 << 20)
150#define MMC_CAP_UHS (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_DDR50)
151#define MMC_CAP_SYNC_RUNTIME_PM (1 << 21)
152#define MMC_CAP_NEED_RSP_BUSY (1 << 22)
153#define MMC_CAP_DRIVER_TYPE_A (1 << 23)
154#define MMC_CAP_DRIVER_TYPE_C (1 << 24)
155#define MMC_CAP_DRIVER_TYPE_D (1 << 25)
156#define MMC_CAP_DONE_COMPLETE (1 << 27)
157#define MMC_CAP_CD_WAKE (1 << 28)
158#define MMC_CAP_CMD_DURING_TFR (1 << 29)
159#define MMC_CAP_CMD23 (1 << 30)
160#define MMC_CAP_HW_RESET (1 << 31)
163#define MMC_CAP2_BOOTPART_NOACC (1 << 0)
164#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2)
165#define MMC_CAP2_FULL_PWR_CYCLE_IN_SUSPEND (1 << 3)
166#define MMC_CAP2_HS200_1_8V_SDR (1 << 5)
167#define MMC_CAP2_HS200_1_2V_SDR (1 << 6)
168#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | MMC_CAP2_HS200_1_2V_SDR)
169#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10)
170#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11)
171#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14)
172#define MMC_CAP2_HS400_1_8V (1 << 15)
173#define MMC_CAP2_HS400_1_2V (1 << 16)
174#define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V)
175#define MMC_CAP2_HSX00_1_8V (MMC_CAP2_HS200_1_8V_SDR | MMC_CAP2_HS400_1_8V)
176#define MMC_CAP2_HSX00_1_2V (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V)
177#define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
178#define MMC_CAP2_NO_WRITE_PROTECT (1 << 18)
179#define MMC_CAP2_NO_SDIO (1 << 19)
180#define MMC_CAP2_HS400_ES (1 << 20)
181#define MMC_CAP2_NO_SD (1 << 21)
182#define MMC_CAP2_NO_MMC (1 << 22)
183#define MMC_CAP2_CQE (1 << 23)
184#define MMC_CAP2_CQE_DCMD (1 << 24)
185#define MMC_CAP2_AVOID_3_3V (1 << 25)
186#define MMC_CAP2_MERGE_CAPABLE (1 << 26)
189#define MMC_DATA_READ 1
190#define MMC_DATA_WRITE 2
193#define MMC_BUS_WIDTH_1 0
194#define MMC_BUS_WIDTH_4 2
195#define MMC_BUS_WIDTH_8 3
198#define MMC_BUS_SPEED_DEFAULT 0
199#define MMC_BUS_SPEED_HS26 26000000
200#define MMC_BUS_SPEED_HS52 52000000
201#define MMC_BUS_SPEED_DDR 52000000
202#define MMC_BUS_SPEED_HS200 200000000
205#define MMC_TIMING_LEGACY 0
206#define MMC_TIMING_MMC_HS 1
207#define MMC_TIMING_SD_HS 2
208#define MMC_TIMING_UHS_SDR12 3
209#define MMC_TIMING_UHS_SDR25 4
210#define MMC_TIMING_UHS_SDR50 5
211#define MMC_TIMING_UHS_SDR104 6
212#define MMC_TIMING_UHS_DDR50 7
213#define MMC_TIMING_MMC_DDR52 8
214#define MMC_TIMING_MMC_HS200 9
215#define MMC_TIMING_MMC_HS400 10
218#define MMC_SIGNAL_VOLTAGE_330 0
219#define MMC_SIGNAL_VOLTAGE_180 1
220#define MMC_SIGNAL_VOLTAGE_120 2
223#define MMC_SET_DRIVER_TYPE_B 0
224#define MMC_SET_DRIVER_TYPE_A 1
225#define MMC_SET_DRIVER_TYPE_C 2
226#define MMC_SET_DRIVER_TYPE_D 3
230#define MMC_CMD_GO_IDLE_STATE 0
231#define MMC_CMD_SEND_OP_COND 1
232#define MMC_CMD_ALL_SEND_CID 2
233#define MMC_CMD_SET_RELATIVE_ADDR 3
234#define MMC_CMD_SET_DSR 4
235#define MMC_CMD_SLEEP_AWAKE 5
236#define MMC_CMD_SWITCH 6
237#define MMC_CMD_SELECT_CARD 7
238#define MMC_CMD_SEND_EXT_CSD 8
239#define MMC_CMD_SEND_CSD 9
240#define MMC_CMD_SEND_CID 10
241#define MMC_CMD_READ_DAT_UNTIL_STOP 11
242#define MMC_CMD_STOP_TRANSMISSION 12
243#define MMC_CMD_SEND_STATUS 13
244#define MMC_CMD_BUS_TEST_R 14
245#define MMC_CMD_GO_INACTIVE_STATE 15
246#define MMC_CMD_BUS_TEST_W 19
247#define MMC_CMD_SPI_READ_OCR 58
248#define MMC_CMD_SPI_CRC_ON_OFF 59
251#define MMC_CMD_SET_BLOCKLEN 16
252#define MMC_CMD_READ_SINGLE_BLOCK 17
253#define MMC_CMD_READ_MULTIPLE_BLOCK 18
254#define MMC_CMD_SEND_TUNING_BLOCK 19
255#define MMC_CMD_SEND_TUNING_BLOCK_HS200 21
258#define MMC_CMD_WRITE_DAT_UNTIL_STOP 20
261#define MMC_CMD_SET_BLOCK_COUNT 23
262#define MMC_CMD_WRITE_SINGLE_BLOCK 24
263#define MMC_CMD_WRITE_MULTIPLE_BLOCK 25
264#define MMC_CMD_PROGRAM_CID 26
265#define MMC_CMD_PROGRAM_CSD 27
268#define MMC_CMD_SET_WRITE_PROT 28
269#define MMC_CMD_CLR_WRITE_PROT 29
270#define MMC_CMD_SEND_WRITE_PROT 30
273#define MMC_CMD_ERASE_GROUP_START 35
274#define MMC_CMD_ERASE_GROUP_END 36
275#define MMC_CMD_ERASE 38
278#define MMC_CMD_FAST_IO 39
279#define MMC_CMD_GO_IRQ_STATE 40
282#define MMC_CMD_LOCK_UNLOCK 42
285#define MMC_CMD_APP_CMD 55
286#define MMC_CMD_GEN_CMD 56
287#define MMC_CMD_RES_MAN 62
289#define MMC_CMD62_ARG1 0xEFAC62EC
290#define MMC_CMD62_ARG2 0x00CBAEA7
294#define MMC_RSP_PRESENT (1 << 0)
295#define MMC_RSP_136 (1 << 1)
296#define MMC_RSP_CRC (1 << 2)
297#define MMC_RSP_BUSY (1 << 3)
298#define MMC_RSP_OPCODE (1 << 4)
301#define MMC_RSP_NONE (0)
302#define MMC_RSP_R1 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE)
303#define MMC_RSP_R1B (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE | MMC_RSP_BUSY)
304#define MMC_RSP_R2 (MMC_RSP_PRESENT | MMC_RSP_136 | MMC_RSP_CRC)
305#define MMC_RSP_R3 (MMC_RSP_PRESENT)
306#define MMC_RSP_R4 (MMC_RSP_PRESENT)
307#define MMC_RSP_R5 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE)
308#define MMC_RSP_R6 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE)
309#define MMC_RSP_R7 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE)
312#define MMC_CMD_MASK (3 << 5)
313#define MMC_CMD_AC (0 << 5)
314#define MMC_CMD_ADTC (1 << 5)
315#define MMC_CMD_BC (2 << 5)
316#define MMC_CMD_BCR (3 << 5)
319#define MMC_RSP_SPI_S1 (1 << 7)
320#define MMC_RSP_SPI_S2 (1 << 8)
321#define MMC_RSP_SPI_B4 (1 << 9)
322#define MMC_RSP_SPI_BUSY (1 << 10)
325#define MMC_RSP_SPI_R1 (MMC_RSP_SPI_S1)
326#define MMC_RSP_SPI_R1B (MMC_RSP_SPI_S1 | MMC_RSP_SPI_BUSY)
327#define MMC_RSP_SPI_R2 (MMC_RSP_SPI_S1 | MMC_RSP_SPI_S2)
328#define MMC_RSP_SPI_R3 (MMC_RSP_SPI_S1 | MMC_RSP_SPI_B4)
329#define MMC_RSP_SPI_R4 (MMC_RSP_SPI_S1 | MMC_RSP_SPI_B4)
330#define MMC_RSP_SPI_R5 (MMC_RSP_SPI_S1 | MMC_RSP_SPI_S2)
331#define MMC_RSP_SPI_R7 (MMC_RSP_SPI_S1 | MMC_RSP_SPI_B4)
335#define MMC_RSP_R1_OUT_OF_RANGE (1 << 31)
336#define MMC_RSP_R1_ADDRESS_ERROR (1 << 30)
337#define MMC_RSP_R1_BLOCK_LEN_ERROR (1 << 29)
338#define MMC_RSP_R1_ERASE_SEQ_ERROR (1 << 28)
339#define MMC_RSP_R1_ERASE_PARAM (1 << 27)
340#define MMC_RSP_R1_WP_VIOLATION (1 << 26)
341#define MMC_RSP_R1_CARD_IS_LOCKED (1 << 25)
342#define MMC_RSP_R1_LOCK_UNLOCK_FAILED (1 << 24)
343#define MMC_RSP_R1_COM_CRC_ERROR (1 << 23)
344#define MMC_RSP_R1_ILLEGAL_COMMAND (1 << 22)
345#define MMC_RSP_R1_CARD_ECC_FAILED (1 << 21)
346#define MMC_RSP_R1_CC_ERROR (1 << 20)
347#define MMC_RSP_R1_ERROR (1 << 19)
348#define MMC_RSP_R1_UNDERRUN (1 << 18)
349#define MMC_RSP_R1_OVERRUN (1 << 17)
350#define MMC_RSP_R1_CID_CSD_OVERWRITE (1 << 16)
351#define MMC_RSP_R1_WP_ERASE_SKIP (1 << 15)
352#define MMC_RSP_R1_CARD_ECC_DISABLED (1 << 14)
353#define MMC_RSP_R1_ERASE_RESET (1 << 13)
356#define MMC_RSP_R1_READY_FOR_DATA (1 << 8)
357#define MMC_RSP_R1_SWITCH_ERROR (1 << 7)
358#define MMC_RSP_R1_EXCEPTION_EVENT (1 << 6)
359#define MMC_RSP_R1_APP_CMD (1 << 5)
360#define MMC_RSP_R1_AKE_SEQ_ERROR (1 << 3)
363#define MMC_RSP_R1_SPI_IDLE (1 << 0)
364#define MMC_RSP_R1_SPI_ERASE_RESET (1 << 1)
365#define MMC_RSP_R1_SPI_ILLEGAL_COMMAND (1 << 2)
366#define MMC_RSP_R1_SPI_COM_CRC (1 << 3)
367#define MMC_RSP_R1_SPI_ERASE_SEQ (1 << 4)
368#define MMC_RSP_R1_SPI_ADDRESS (1 << 5)
369#define MMC_RSP_R1_SPI_PARAMETER (1 << 6)
373#define MMC_RSP_R2_SPI_CARD_LOCKED (1 << 8)
374#define MMC_RSP_R2_SPI_WP_ERASE_SKIP (1 << 9)
375#define MMC_RSP_R2_SPI_LOCK_UNLOCK_FAIL MMC_RSP_R2_SPI_WP_ERASE_SKIP
376#define MMC_RSP_R2_SPI_ERROR (1 << 10)
377#define MMC_RSP_R2_SPI_CC_ERROR (1 << 11)
378#define MMC_RSP_R2_SPI_CARD_ECC_ERROR (1 << 12)
379#define MMC_RSP_R2_SPI_WP_VIOLATION (1 << 13)
380#define MMC_RSP_R2_SPI_ERASE_PARAM (1 << 14)
381#define MMC_RSP_R2_SPI_OUT_OF_RANGE (1 << 15)
382#define MMC_RSP_R2_SPI_CSD_OVERWRITE MMC_RSP_R2_SPI_OUT_OF_RANGE
385#define MMC_OCR_BUSY 0x80000000
386#define MMC_OCR_HCS 0x40000000
387#define MMC_OCR_UHS_II 0x20000000
388#define MMC_OCR_S18A 0x01000000
389#define MMC_OCR_VOLTAGE_MASK 0x007FFF80
390#define MMC_OCR_ACCESS_MODE 0x60000000
394#define MMC_CARD_STATUS_MASK (~0x0206BF7F)
395#define MMC_CARD_STATUS_ERROR (1 << 19)
396#define MMC_CARD_STATUS_CURRENT_STATE (0x0F << 9)
397#define MMC_CARD_STATUS_READY_FOR_DATA (1 << 8)
398#define MMC_CARD_STATUS_SWITCH_ERROR (1 << 7)
401#define MMC_CURRENT_STATE_IDLE (0 << 9)
402#define MMC_CURRENT_STATE_READY (1 << 9)
403#define MMC_CURRENT_STATE_IDENT (2 << 9)
404#define MMC_CURRENT_STATE_STBY (3 << 9)
405#define MMC_CURRENT_STATE_TRAN (4 << 9)
406#define MMC_CURRENT_STATE_DATA (5 << 9)
407#define MMC_CURRENT_STATE_RCV (6 << 9)
408#define MMC_CURRENT_STATE_PRG (7 << 9)
409#define MMC_CURRENT_STATE_DIS (8 << 9)
415#define MMC_CID_PNM0 3
416#define MMC_CID_PNM1 4
417#define MMC_CID_PNM2 5
418#define MMC_CID_PNM3 6
419#define MMC_CID_PNM4 7
420#define MMC_CID_PNM5 8
421#define MMC_CID_PNM6 9
422#define MMC_CID_PRV 10
423#define MMC_CID_HRV 11
424#define MMC_CID_FRV 12
425#define MMC_CID_PSN 13
426#define MMC_CID_MDT_YEAR 14
427#define MMC_CID_MDT_MONTH 15
428#define MMC_CID_CRC 16
432#define MMC_CSD_STRUCTURE 1
433#define MMC_CSD_SPECVER 2
434#define MMC_CSD_TAAC_UNIT 3
435#define MMC_CSD_TAAC_VALUE 4
436#define MMC_CSD_NSAC 5
437#define MMC_CSD_TRAN_SPEED_UNIT 6
438#define MMC_CSD_TRAN_SPEED_VALUE 37
440#define MMC_CSD_READ_BL_LEN 8
441#define MMC_CSD_READ_BL_PARTIAL 9
442#define MMC_CSD_WRITE_BLK_MISALIGN 10
443#define MMC_CSD_READ_BLK_MISALIGN 11
444#define MMC_CSD_DSR_IMP 12
445#define MMC_CSD_C_SIZE 13
446#define MMC_CSD_VDD_R_CURR_MIN 14
447#define MMC_CSD_VDD_R_CURR_MAX 15
448#define MMC_CSD_VDD_W_CURR_MIN 16
449#define MMC_CSD_VDD_W_CURR_MAX 17
450#define MMC_CSD_C_SIZE_MULT 18
451#define MMC_CSD_ERASE_BLK_EN 19
452#define MMC_CSD_SECTOR_SIZE 20
453#define MMC_CSD_ERASE_GRP_SIZE 21
454#define MMC_CSD_ERASE_GRP_MULT 22
455#define MMC_CSD_WP_GRP_SIZE 23
456#define MMC_CSD_WP_GRP_ENABLE 24
457#define MMC_CSD_DEFAULT_ECC 25
458#define MMC_CSD_R2W_FACTOR 26
459#define MMC_CSD_WRITE_BL_LEN 27
460#define MMC_CSD_WRITE_BL_PARTIAL 28
461#define MMC_CSD_CONTENT_PROT_APP 29
462#define MMC_CSD_FILE_FORMAT_GRP 30
463#define MMC_CSD_COPY 31
464#define MMC_CSD_PERM_WRITE_PROTECT 32
465#define MMC_CSD_TMP_WRITE_PROTECT 33
466#define MMC_CSD_FILE_FORMAT 34
467#define MMC_CSD_ECC 35
468#define MMC_CSD_CRC 36
471#define MMC_CSD_STRUCT_VER_1_0 0
472#define MMC_CSD_STRUCT_VER_1_1 1
473#define MMC_CSD_STRUCT_VER_1_2 2
474#define MMC_CSD_STRUCT_EXT_CSD 3
477#define MMC_CSD_SPEC_VER_0 0
478#define MMC_CSD_SPEC_VER_1 1
479#define MMC_CSD_SPEC_VER_2 2
480#define MMC_CSD_SPEC_VER_3 3
481#define MMC_CSD_SPEC_VER_4 4
484static const uint32_t MMC_CSD_TAAC_UNITS[] = {
495static const uint32_t MMC_CSD_TAAC_VALUES[] = {
514#define MMC_CCC_BASIC (1 << 0)
515#define MMC_CCC_STREAM_READ (1 << 1)
516#define MMC_CCC_BLOCK_READ (1 << 2)
517#define MMC_CCC_STREAM_WRITE (1 << 3)
518#define MMC_CCC_BLOCK_WRITE (1 << 4)
519#define MMC_CCC_ERASE (1 << 5)
520#define MMC_CCC_WRITE_PROT (1 << 6)
521#define MMC_CCC_LOCK_CARD (1 << 7)
522#define MMC_CCC_APP_SPEC (1 << 8)
523#define MMC_CCC_IO_MODE (1 << 9)
524#define MMC_CCC_SWITCH (1 << 10)
525#define MMC_CCC_EXTENSION (1 << 11)
528static const uint32_t MMC_CSD_TRAN_SPEED_UNITS[] = {
539static const uint32_t MMC_CSD_TRAN_SPEED_VALUES[] = {
557#define SECURE_ERASE 0x80000000
560#define MMC_VDD_165_195 0x00000080
561#define MMC_VDD_20_21 0x00000100
562#define MMC_VDD_21_22 0x00000200
563#define MMC_VDD_22_23 0x00000400
564#define MMC_VDD_23_24 0x00000800
565#define MMC_VDD_24_25 0x00001000
566#define MMC_VDD_25_26 0x00002000
567#define MMC_VDD_26_27 0x00004000
568#define MMC_VDD_27_28 0x00008000
569#define MMC_VDD_28_29 0x00010000
570#define MMC_VDD_29_30 0x00020000
571#define MMC_VDD_30_31 0x00040000
572#define MMC_VDD_31_32 0x00080000
573#define MMC_VDD_32_33 0x00100000
574#define MMC_VDD_33_34 0x00200000
575#define MMC_VDD_34_35 0x00400000
576#define MMC_VDD_35_36 0x00800000
579#define MMC_SWITCH_MODE_CMD_SET 0x00
580#define MMC_SWITCH_MODE_SET_BITS 0x01
581#define MMC_SWITCH_MODE_CLEAR_BITS 0x02
582#define MMC_SWITCH_MODE_WRITE_BYTE 0x03
585#define EXT_CSD_CMDQ_MODE_EN 15
586#define EXT_CSD_FLUSH_CACHE 32
587#define EXT_CSD_CACHE_CTRL 33
588#define EXT_CSD_POWER_OFF_NOTIFICATION 34
589#define EXT_CSD_PACKED_FAILURE_INDEX 35
590#define EXT_CSD_PACKED_CMD_STATUS 36
591#define EXT_CSD_EXP_EVENTS_STATUS 54
592#define EXT_CSD_EXP_EVENTS_CTRL 56
593#define EXT_CSD_DATA_SECTOR_SIZE 61
594#define EXT_CSD_ENH_START_ADDR 136
595#define EXT_CSD_ENH_SIZE_MULT 140
596#define EXT_CSD_GP_SIZE_MULT 143
597#define EXT_CSD_PARTITION_SETTING_COMPLETED 155
598#define EXT_CSD_PARTITION_ATTRIBUTE 156
599#define EXT_CSD_MAX_ENH_SIZE_MULT 157
600#define EXT_CSD_PARTITION_SUPPORT 160
601#define EXT_CSD_HPI_MGMT 161
602#define EXT_CSD_RST_N_FUNCTION 162
603#define EXT_CSD_BKOPS_EN 163
604#define EXT_CSD_BKOPS_START 164
605#define EXT_CSD_SANITIZE_START 165
606#define EXT_CSD_WR_REL_PARAM 166
607#define EXT_CSD_WR_REL_SET 167
608#define EXT_CSD_RPMB_MULT 168
609#define EXT_CSD_FW_CONFIG 169
610#define EXT_CSD_BOOT_WP 173
611#define EXT_CSD_ERASE_GROUP_DEF 175
612#define EXT_CSD_BOOT_BUS_CONDITIONS 177
613#define EXT_CSD_PART_CONFIG 179
614#define EXT_CSD_ERASED_MEM_CONT 181
615#define EXT_CSD_BUS_WIDTH 183
616#define EXT_CSD_STROBE_SUPPORT 184
617#define EXT_CSD_HS_TIMING 185
618#define EXT_CSD_POWER_CLASS 187
619#define EXT_CSD_REV 192
620#define EXT_CSD_STRUCTURE 194
621#define EXT_CSD_CARD_TYPE 196
622#define EXT_CSD_DRIVER_STRENGTH 197
623#define EXT_CSD_OUT_OF_INTERRUPT_TIME 198
624#define EXT_CSD_PART_SWITCH_TIME 199
625#define EXT_CSD_PWR_CL_52_195 200
626#define EXT_CSD_PWR_CL_26_195 201
627#define EXT_CSD_PWR_CL_52_360 202
628#define EXT_CSD_PWR_CL_26_360 203
629#define EXT_CSD_SEC_CNT 212
630#define EXT_CSD_S_A_TIMEOUT 217
631#define EXT_CSD_REL_WR_SEC_C 222
632#define EXT_CSD_HC_WP_GRP_SIZE 221
633#define EXT_CSD_ERASE_TIMEOUT_MULT 223
634#define EXT_CSD_HC_ERASE_GRP_SIZE 224
635#define EXT_CSD_BOOT_SIZE_MULT 226
636#define EXT_CSD_SEC_TRIM_MULT 229
637#define EXT_CSD_SEC_ERASE_MULT 230
638#define EXT_CSD_SEC_FEATURE_SUPPORT 231
639#define EXT_CSD_TRIM_MULT 232
640#define EXT_CSD_PWR_CL_200_195 236
641#define EXT_CSD_PWR_CL_200_360 237
642#define EXT_CSD_PWR_CL_DDR_52_195 238
643#define EXT_CSD_PWR_CL_DDR_52_360 239
644#define EXT_CSD_BKOPS_STATUS 246
645#define EXT_CSD_POWER_OFF_LONG_TIME 247
646#define EXT_CSD_GENERIC_CMD6_TIME 248
647#define EXT_CSD_CACHE_SIZE 249
648#define EXT_CSD_PWR_CL_DDR_200_360 253
649#define EXT_CSD_FIRMWARE_VERSION 254
650#define EXT_CSD_PRE_EOL_INFO 267
651#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A 268
652#define EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B 269
653#define EXT_CSD_CMDQ_DEPTH 307
654#define EXT_CSD_CMDQ_SUPPORT 308
655#define EXT_CSD_SUPPORTED_MODE 493
656#define EXT_CSD_TAG_UNIT_SIZE 498
657#define EXT_CSD_DATA_TAG_SUPPORT 499
658#define EXT_CSD_MAX_PACKED_WRITES 500
659#define EXT_CSD_MAX_PACKED_READS 501
660#define EXT_CSD_BKOPS_SUPPORT 502
661#define EXT_CSD_HPI_FEATURES 503
664#define EXT_CSD_PARTITION_ATTRIBUTE_ENH_4 0x10
665#define EXT_CSD_PARTITION_ATTRIBUTE_ENH_3 0x08
666#define EXT_CSD_PARTITION_ATTRIBUTE_ENH_2 0x04
667#define EXT_CSD_PARTITION_ATTRIBUTE_ENH_1 0x02
668#define EXT_CSD_PARTITION_ATTRIBUTE_ENH_USR 0x01
670#define EXT_CSD_PARTITION_EXT_ATTRIBUTE_EN 0x04
671#define EXT_CSD_PARTITION_ENH_ATTRIBUTE_EN 0x02
672#define EXT_CSD_PARTITION_PARTITIONING_EN 0x01
674#define EXT_CSD_WR_REL_PARAM_EN (1 << 2)
675#define EXT_CSD_WR_REL_PARAM_EN_RPMB_REL_WR (1 << 4)
677#define EXT_CSD_BOOT_WP_B_PWR_WP_DIS 0x40
678#define EXT_CSD_BOOT_WP_B_PERM_WP_DIS 0x10
679#define EXT_CSD_BOOT_WP_B_PERM_WP_EN 0x04
680#define EXT_CSD_BOOT_WP_B_PWR_WP_EN 0x01
682#define EXT_CSD_PART_CONFIG_ACC_MASK 0x07
683#define EXT_CSD_PART_CONFIG_ACC_BOOT0 0x01
684#define EXT_CSD_PART_CONFIG_ACC_RPMB 0x03
685#define EXT_CSD_PART_CONFIG_ACC_GP0 0x04
687#define EXT_CSD_PART_SETTING_COMPLETED 0x01
688#define EXT_CSD_PART_SUPPORT_PART_EN 0x01
690#define EXT_CSD_CMD_SET_NORMAL (1 << 0)
691#define EXT_CSD_CMD_SET_SECURE (1 << 1)
692#define EXT_CSD_CMD_SET_CPSECURE (1 << 2)
694#define EXT_CSD_CARD_TYPE_HS_26 (1 << 0)
695#define EXT_CSD_CARD_TYPE_HS_52 (1 << 1)
696#define EXT_CSD_CARD_TYPE_HS (EXT_CSD_CARD_TYPE_HS_26 | EXT_CSD_CARD_TYPE_HS_52)
697#define EXT_CSD_CARD_TYPE_DDR_1_8V (1 << 2)
698#define EXT_CSD_CARD_TYPE_DDR_1_2V (1 << 3)
699#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V)
700#define EXT_CSD_CARD_TYPE_HS200_1_8V (1 << 4)
701#define EXT_CSD_CARD_TYPE_HS200_1_2V (1 << 5)
702#define EXT_CSD_CARD_TYPE_HS200 (EXT_CSD_CARD_TYPE_HS200_1_8V | EXT_CSD_CARD_TYPE_HS200_1_2V)
703#define EXT_CSD_CARD_TYPE_HS400_1_8V (1 << 6)
704#define EXT_CSD_CARD_TYPE_HS400_1_2V (1 << 7)
705#define EXT_CSD_CARD_TYPE_HS400 (EXT_CSD_CARD_TYPE_HS400_1_8V | EXT_CSD_CARD_TYPE_HS400_1_2V)
706#define EXT_CSD_CARD_TYPE_HS400ES (1 << 8)
708#define EXT_CSD_BUS_WIDTH_1 0
709#define EXT_CSD_BUS_WIDTH_4 1
710#define EXT_CSD_BUS_WIDTH_8 2
711#define EXT_CSD_DDR_BUS_WIDTH_4 5
712#define EXT_CSD_DDR_BUS_WIDTH_8 6
713#define EXT_CSD_BUS_WIDTH_STROBE 1 << 7
715#define EXT_CSD_TIMING_BC 0
716#define EXT_CSD_TIMING_HS 1
717#define EXT_CSD_TIMING_HS200 2
718#define EXT_CSD_TIMING_HS400 3
719#define EXT_CSD_DRV_STR_SHIFT 4
721#define EXT_CSD_SEC_ER_EN 1 << 0
722#define EXT_CSD_SEC_BD_BLK_EN 1 << 2
723#define EXT_CSD_SEC_GB_CL_EN 1 << 4
724#define EXT_CSD_SEC_SANITIZE 1 << 6
726#define EXT_CSD_RST_N_EN_MASK 0x03
727#define EXT_CSD_RST_N_ENABLED 1
729#define EXT_CSD_NO_POWER_NOTIFICATION 0
730#define EXT_CSD_POWER_ON 1
731#define EXT_CSD_POWER_OFF_SHORT 2
732#define EXT_CSD_POWER_OFF_LONG 3
734#define EXT_CSD_PWR_CL_8BIT_MASK 0xF0
735#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F
736#define EXT_CSD_PWR_CL_8BIT_SHIFT 4
737#define EXT_CSD_PWR_CL_4BIT_SHIFT 0
739#define EXT_CSD_PACKED_EVENT_EN 1 << 3
742#define EXT_CSD_URGENT_BKOPS 1 << 0
743#define EXT_CSD_DYNCAP_NEEDED 1 << 1
744#define EXT_CSD_SYSPOOL_EXHAUSTED 1 << 2
745#define EXT_CSD_PACKED_FAILURE 1 << 3
747#define EXT_CSD_PACKED_GENERIC_ERROR 1 << 0
748#define EXT_CSD_PACKED_INDEXED_ERROR 1 << 1
751#define EXT_CSD_BKOPS_LEVEL_2 0x02
754#define EXT_CSD_MANUAL_BKOPS_MASK 0x01
755#define EXT_CSD_AUTO_BKOPS_MASK 0x02
758#define EXT_CSD_CMDQ_MODE_ENABLED 1 << 0
759#define EXT_CSD_CMDQ_DEPTH_MASK 0x1F
760#define EXT_CSD_CMDQ_SUPPORTED 1 << 0
763#define MMC_HIGH_26_MAX_DTR 26000000
764#define MMC_HIGH_52_MAX_DTR 52000000
765#define MMC_HIGH_DDR_MAX_DTR 52000000
766#define MMC_HS200_MAX_DTR 200000000
769#define MMC_MIN_PART_SWITCH_TIME 300
772#define MMCPART_NOAVAILABLE (0xff)
773#define PART_ACCESS_MASK (0x07)
774#define PART_SUPPORT (0x01)
775#define ENHNCD_SUPPORT (0x02)
776#define PART_ENH_ATTRIB (0x1f)
779#define MMC_MAX_BLOCK_LEN 512
782#define MMC_MAX_BLOCK_COUNT 65535
785#define MMC_NUM_BOOT_PARTITION 2
786#define MMC_NUM_GP_PARTITION 4
787#define MMC_NUM_PHY_PARTITION 7
790#define MMC_DEFAULT_CMD6_TIMEOUT_MS 500
791#define MMC_MIN_CACHE_EN_TIMEOUT_MS 1600
794#define MMC_FIRMWARE_VERSION_LEN 8
797#define MMC_DISCARD_FEATURE 0x01
800#define MMC_BUSY_CMD6 0
801#define MMC_BUSY_ERASE 1
802#define MMC_BUSY_HPI 2
805#define MMC_ERASE_ARG 0x00000000
806#define MMC_SECURE_ERASE_ARG 0x80000000
807#define MMC_TRIM_ARG 0x00000001
808#define MMC_DISCARD_ARG 0x00000003
809#define MMC_SECURE_TRIM1_ARG 0x80000001
810#define MMC_SECURE_TRIM2_ARG 0x80008000
811#define MMC_SECURE_ARGS 0x80000000
812#define MMC_TRIM_ARGS 0x00008001
815#define SD_DEFAULT_BLOCKSIZE 512
816#define SD_DEFAULT_BLOCKSHIFT 9
819#define SD_BUS_WIDTH_1 0
820#define SD_BUS_WIDTH_4 2
823#define SD_BUS_SPEED_DEFAULT 25000000
824#define SD_BUS_SPEED_HS 50000000
825#define SD_BUS_SPEED_UHS_SDR12 25000000
826#define SD_BUS_SPEED_UHS_SDR25 50000000
827#define SD_BUS_SPEED_UHS_DDR50 50000000
828#define SD_BUS_SPEED_UHS_SDR50 100000000
829#define SD_BUS_SPEED_UHS_SDR104 208000000
833#define SD_CMD_SEND_RELATIVE_ADDR 3
834#define SD_CMD_SEND_IF_COND 8
835#define SD_CMD_SWITCH_VOLTAGE 11
838#define SD_CMD_SWITCH 6
841#define SD_CMD_ERASE_WR_BLK_START 32
842#define SD_CMD_ERASE_WR_BLK_END 33
845#define SD_CMD_APP_SET_BUS_WIDTH 6
846#define SD_CMD_APP_SD_STATUS 13
847#define SD_CMD_APP_SEND_NUM_WR_BLKS 22
848#define SD_CMD_APP_SEND_OP_COND 41
849#define SD_CMD_APP_SEND_SCR 51
862#define SD_SWITCH_MODE_CHECK 0
863#define SD_SWITCH_MODE_SWITCH 1
866#define SD_SWITCH_FUNCTION_GROUP_ACCESS 0
867#define SD_SWITCH_FUNCTION_GROUP_COMMAND 1
868#define SD_SWITCH_FUNCTION_GROUP_DRIVER 2
869#define SD_SWITCH_FUNCTION_GROUP_POWER 3
872#define SD_SWITCH_ACCESS_MODE_DEF 0
873#define SD_SWITCH_ACCESS_MODE_HS 1
874#define SD_SWITCH_ACCESS_MODE_SDR50 2
875#define SD_SWITCH_ACCESS_MODE_SDR104 3
876#define SD_SWITCH_ACCESS_MODE_DDR50 4
879#define SD_SWITCH_COMMAND_SYSTEM_DEF 0
880#define SD_SWITCH_COMMAND_SYSTEM_EC 1
881#define SD_SWITCH_COMMAND_SYSTEM_OTP 3
882#define SD_SWITCH_COMMAND_SYSTEM_ASSD 4
885#define SD_SWITCH_DRIVER_STRENGTH_DEF 0
886#define SD_SWITCH_DRIVER_STRENGTH_TYPE_A 1
887#define SD_SWITCH_DRIVER_STRENGTH_TYPE_C 2
888#define SD_SWITCH_DRIVER_STRENGTH_TYPE_D 3
891#define SD_SWITCH_POWER_LIMIT_DEF 0
892#define SD_SWITCH_POWER_LIMIT_144 1
893#define SD_SWITCH_POWER_LIMIT_216 2
894#define SD_SWITCH_POWER_LIMIT_288 3
895#define SD_SWITCH_POWER_LIMIT_180 4
903#define SD_SEND_IF_COND_CHECK_PATTERN 0xAA
904#define SD_SEND_IF_COND_VOLTAGE_MASK 0x00FF8000
907#define SD_SEND_OP_COND_VOLTAGE_MASK 0x00FF8000
910#define SD_OCR_CCS 0x40000000
911#define SD_OCR_UHS_II 0x20000000
912#define SD_OCR_XPC 0x10000000
913#define SD_OCR_S18A 0x01000000
916#define SD_CSD_STRUCT_VER_1_0 0
917#define SD_CSD_STRUCT_VER_2_0 1
921#define SD_SSR_DAT_BUS_WIDTH 1
922#define SD_SSR_SECURED_MODE 2
923#define SD_SSR_SD_CARD_TYPE 3
924#define SD_SSR_SIZE_OF_PROTECTED_AREA 4
925#define SD_SSR_SPEED_CLASS 5
926#define SD_SSR_PERFORMANCE_MOVE 6
927#define SD_SSR_AU_SIZE 7
928#define SD_SSR_ERASE_SIZE 8
929#define SD_SSR_ERASE_TIMEOUT 9
930#define SD_SSR_ERASE_OFFSET 10
931#define SD_SSR_UHS_SPEED_GRADE 11
932#define SD_SSR_UHS_AU_SIZE 12
935#define SD_SSR_BUS_WIDTH_1 0
936#define SD_SSR_BUS_WIDTH_4 2
939#define SD_SSR_CARD_TYPE_RW 0x0000
940#define SD_SSR_CARD_TYPE_ROM 0x0001
941#define SD_SSR_CARD_TYPE_OTP 0x0002
944#define SD_SSR_SPEED_CLASS_0 0x00
945#define SD_SSR_SPEED_CLASS_2 0x01
946#define SD_SSR_SPEED_CLASS_4 0x02
947#define SD_SSR_SPEED_CLASS_6 0x03
948#define SD_SSR_SPEED_CLASS_10 0x04
951static const uint32_t SD_SSR_AU_SIZE_VALUES[] = {
963 0x00800000 + 0x00400000,
965 0x01000000 + 0x00800000,
970#define SD_SSR_UHS_SPEED_GRADE_0 0
971#define SD_SSR_UHS_SPEED_GRADE_1 1
974static const uint32_t SD_SSR_UHS_AU_SIZE_VALUES[] = {
986 0x00800000 + 0x00400000,
988 0x01000000 + 0x00800000,
994#define SD_SWITCH_MAXIMUM_CURRENT 1
995#define SD_SWITCH_GROUP6_SUPPORT 2
996#define SD_SWITCH_GROUP5_SUPPORT 3
997#define SD_SWITCH_GROUP4_SUPPORT 4
998#define SD_SWITCH_GROUP3_SUPPORT 5
999#define SD_SWITCH_GROUP2_SUPPORT 6
1000#define SD_SWITCH_GROUP1_SUPPORT 7
1001#define SD_SWITCH_GROUP6_SELECTION 8
1002#define SD_SWITCH_GROUP5_SELECTION 9
1003#define SD_SWITCH_GROUP4_SELECTION 10
1004#define SD_SWITCH_GROUP3_SELECTION 11
1005#define SD_SWITCH_GROUP2_SELECTION 12
1006#define SD_SWITCH_GROUP1_SELECTION 13
1007#define SD_SWITCH_STRUCT_VERSION 14
1008#define SD_SWITCH_GROUP6_BUSY_STATUS 15
1009#define SD_SWITCH_GROUP5_BUSY_STATUS 16
1010#define SD_SWITCH_GROUP4_BUSY_STATUS 17
1011#define SD_SWITCH_GROUP3_BUSY_STATUS 18
1012#define SD_SWITCH_GROUP2_BUSY_STATUS 19
1013#define SD_SWITCH_GROUP1_BUSY_STATUS 20
1016#define SD_SWITCH_GROUP1_SDR12 (1 << 0)
1017#define SD_SWITCH_GROUP1_HS (1 << 1)
1018#define SD_SWITCH_GROUP1_SDR25 (1 << 1)
1019#define SD_SWITCH_GROUP1_SDR50 (1 << 2)
1020#define SD_SWITCH_GROUP1_SDR104 (1 << 3)
1021#define SD_SWITCH_GROUP1_DDR50 (1 << 4)
1024#define SD_SWITCH_GROUP3_TYPE_B (1 << 0)
1025#define SD_SWITCH_GROUP3_TYPE_A (1 << 1)
1026#define SD_SWITCH_GROUP3_TYPE_C (1 << 2)
1027#define SD_SWITCH_GROUP3_TYPE_D (1 << 3)
1030#define SD_SWITCH_STRUCT_VER_0 0
1031#define SD_SWITCH_STRUCT_VER_1 1
1035#define SD_SCR_STRUCTURE 1
1036#define SD_SCR_SD_SPEC 2
1037#define SD_SCR_DATA_STAT_AFTER_ERASE 3
1038#define SD_SCR_SD_SECURITY 4
1039#define SD_SCR_SD_BUS_WIDTHS 5
1040#define SD_SCR_SD_SPEC3 6
1041#define SD_SCR_EX_SECURITY 7
1042#define SD_SCR_SD_SPEC4 8
1043#define SD_SCR_CMD_SUPPORT 9
1046#define SD_SCR_STRUCT_VER_1_0 0
1049#define SD_SCR_SPEC_VER_0 0
1050#define SD_SCR_SPEC_VER_1 1
1051#define SD_SCR_SPEC_VER_2 2
1054#define SD_SCR_SECURITY_VER_0 0
1055#define SD_SCR_SECURITY_VER_2 2
1056#define SD_SCR_SECURITY_VER_3 3
1057#define SD_SCR_SECURITY_VER_4 4
1060#define SD_SCR_BUS_WIDTH_1 (1 << 0)
1061#define SD_SCR_BUS_WIDTH_4 (1 << 2)
1064#define SD_SCR_EX_SECURITY_VER_0 0
1067#define SD_SCR_CMD20_SUPPORT (1 << 0)
1068#define SD_SCR_CMD23_SUPPORT (1 << 1)
1069#define SD_SCR_CMD48_49_SUPPORT (1 << 2)
1070#define SD_SCR_CMD58_59_SUPPORT (1 << 3)
1074#define SDIO_STATE_DETACHED 0
1075#define SDIO_STATE_DETACHING 1
1076#define SDIO_STATE_ATTACHING 2
1077#define SDIO_STATE_ATTACHED 3
1079#define SDIO_STATE_MAX 3
1082#define SDIO_STATUS_UNBOUND 0
1083#define SDIO_STATUS_BOUND 1
1085#define SDIO_STATUS_MAX 1
1088#define SDIO_CMD_SEND_OP_COND 5
1089#define SDIO_CMD_RW_DIRECT 52
1090#define SDIO_CMD_RW_EXTENDED 53
1110#define SDIO_RSP_R4_18V_PRESENT (1 << 24)
1111#define SDIO_RSP_R4_MEMORY_PRESENT (1 << 27)
1114#define SDIO_RSP_R5_COM_CRC_ERROR (1 << 15)
1115#define SDIO_RSP_R5_ILLEGAL_COMMAND (1 << 14)
1116#define SDIO_RSP_R5_ERROR (1 << 11)
1117#define SDIO_RSP_R5_FUNCTION_NUMBER (1 << 9)
1118#define SDIO_RSP_R5_OUT_OF_RANGE (1 << 8)
1134#define SDIO_CCCR_CCCR 0x00
1135#define SDIO_CCCR_SD 0x01
1136#define SDIO_CCCR_IOEx 0x02
1137#define SDIO_CCCR_IORx 0x03
1138#define SDIO_CCCR_IENx 0x04
1139#define SDIO_CCCR_INTx 0x05
1140#define SDIO_CCCR_ABORT 0x06
1141#define SDIO_CCCR_IF 0x07
1142#define SDIO_CCCR_CAPS 0x08
1143#define SDIO_CCCR_CIS 0x09
1145#define SDIO_CCCR_SUSPEND 0x0c
1146#define SDIO_CCCR_SELx 0x0d
1147#define SDIO_CCCR_EXECx 0x0e
1148#define SDIO_CCCR_READYx 0x0f
1149#define SDIO_CCCR_BLKSIZE 0x10
1150#define SDIO_CCCR_POWER 0x12
1151#define SDIO_CCCR_SPEED 0x13
1152#define SDIO_CCCR_UHS 0x14
1153#define SDIO_CCCR_DRIVE_STRENGTH 0x15
1156#define SDIO_CCCR_REV_1_00 0
1157#define SDIO_CCCR_REV_1_10 1
1158#define SDIO_CCCR_REV_1_20 2
1159#define SDIO_CCCR_REV_3_00 3
1161#define SDIO_SDIO_REV_1_00 0
1162#define SDIO_SDIO_REV_1_10 1
1163#define SDIO_SDIO_REV_1_20 2
1164#define SDIO_SDIO_REV_2_00 3
1165#define SDIO_SDIO_REV_3_00 4
1168#define SDIO_SD_REV_1_01 0
1169#define SDIO_SD_REV_1_10 1
1170#define SDIO_SD_REV_2_00 2
1171#define SDIO_SD_REV_3_00 3
1174#define SDIO_BUS_WIDTH_MASK 0x03
1175#define SDIO_BUS_WIDTH_1BIT 0x00
1176#define SDIO_BUS_WIDTH_RESERVED 0x01
1177#define SDIO_BUS_WIDTH_4BIT 0x02
1178#define SDIO_BUS_ECSI 0x20
1179#define SDIO_BUS_SCSI 0x40
1181#define SDIO_BUS_ASYNC_INT 0x20
1183#define SDIO_BUS_CD_DISABLE 0x80
1186#define SDIO_CCCR_CAP_SDC 0x01
1187#define SDIO_CCCR_CAP_SMB 0x02
1188#define SDIO_CCCR_CAP_SRW 0x04
1189#define SDIO_CCCR_CAP_SBS 0x08
1190#define SDIO_CCCR_CAP_S4MI 0x10
1191#define SDIO_CCCR_CAP_E4MI 0x20
1192#define SDIO_CCCR_CAP_LSC 0x40
1193#define SDIO_CCCR_CAP_4BLS 0x80
1196#define SDIO_POWER_SMPC 0x01
1197#define SDIO_POWER_EMPC 0x02
1200#define SDIO_SPEED_SHS 0x01
1201#define SDIO_SPEED_BSS_SHIFT 1
1202#define SDIO_SPEED_BSS_MASK (7 << SDIO_SPEED_BSS_SHIFT)
1203#define SDIO_SPEED_SDR12 (0 << SDIO_SPEED_BSS_SHIFT)
1204#define SDIO_SPEED_SDR25 (1 << SDIO_SPEED_BSS_SHIFT)
1205#define SDIO_SPEED_SDR50 (2 << SDIO_SPEED_BSS_SHIFT)
1206#define SDIO_SPEED_SDR104 (3 << SDIO_SPEED_BSS_SHIFT)
1207#define SDIO_SPEED_DDR50 (4 << SDIO_SPEED_BSS_SHIFT)
1208#define SDIO_SPEED_EHS SDIO_SPEED_SDR25
1211#define SDIO_UHS_SDR50 0x01
1212#define SDIO_UHS_SDR104 0x02
1213#define SDIO_UHS_DDR50 0x04
1216#define SDIO_SDTx_MASK 0x07
1217#define SDIO_DRIVE_SDTA (1 << 0)
1218#define SDIO_DRIVE_SDTC (1 << 1)
1219#define SDIO_DRIVE_SDTD (1 << 2)
1220#define SDIO_DRIVE_DTSx_MASK 0x03
1221#define SDIO_DRIVE_DTSx_SHIFT 4
1222#define SDIO_DTSx_SET_TYPE_B (0 << SDIO_DRIVE_DTSx_SHIFT)
1223#define SDIO_DTSx_SET_TYPE_A (1 << SDIO_DRIVE_DTSx_SHIFT)
1224#define SDIO_DTSx_SET_TYPE_C (2 << SDIO_DRIVE_DTSx_SHIFT)
1225#define SDIO_DTSx_SET_TYPE_D (3 << SDIO_DRIVE_DTSx_SHIFT)
1228#define SDIO_FBR_BASE(f) ((f) * 0x100)
1229#define SDIO_FBR_STD_IF 0x00
1230#define SDIO_FBR_STD_IF_EXT 0x01
1231#define SDIO_FBR_POWER 0x02
1232#define SDIO_FBR_CIS 0x09
1233#define SDIO_FBR_CSA 0x0C
1234#define SDIO_FBR_CSA_DATA 0x0F
1235#define SDIO_FBR_BLKSIZE 0x10
1238#define SDIO_FBR_SUPPORTS_CSA 0x40
1239#define SDIO_FBR_ENABLE_CSA 0x80
1242#define SDIO_FBR_POWER_SPS 0x01
1243#define SDIO_FBR_POWER_EPS 0x02
1246#define SDIO_CLASS_NONE 0x00
1247#define SDIO_CLASS_UART 0x01
1248#define SDIO_CLASS_BT_A 0x02
1249#define SDIO_CLASS_BT_B 0x03
1250#define SDIO_CLASS_GPS 0x04
1251#define SDIO_CLASS_CAMERA 0x05
1252#define SDIO_CLASS_PHS 0x06
1253#define SDIO_CLASS_WLAN 0x07
1254#define SDIO_CLASS_ATA 0x08
1255#define SDIO_CLASS_BT_AMP 0x09
1258#define SDIO_VENDOR_ID_STE 0x0020
1259#define SDIO_VENDOR_ID_INTEL 0x0089
1260#define SDIO_VENDOR_ID_CGUYS 0x0092
1261#define SDIO_VENDOR_ID_TI 0x0097
1262#define SDIO_VENDOR_ID_ATHEROS 0x0271
1263#define SDIO_VENDOR_ID_BROADCOM 0x02d0
1264#define SDIO_VENDOR_ID_MARVELL 0x02df
1265#define SDIO_VENDOR_ID_MEDIATEK 0x037a
1266#define SDIO_VENDOR_ID_MICROCHIP_WILC 0x0296
1267#define SDIO_VENDOR_ID_SIANO 0x039a
1268#define SDIO_VENDOR_ID_RSI 0x041b
1269#define SDIO_VENDOR_ID_TI_WL1251 0x104c
1272#define SDIO_DEVICE_ID_STE_CW1200 0x2280
1274#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402
1275#define SDIO_DEVICE_ID_INTEL_IWMC3200WIFI 0x1403
1276#define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404
1277#define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405
1278#define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406
1279#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX_2G5 0x1407
1281#define SDIO_DEVICE_ID_CGUYS_EW_CG1102GC 0x0004
1283#define SDIO_DEVICE_ID_TI_WL1271 0x4076
1285#define SDIO_DEVICE_ID_ATHEROS_AR6003_00 0x0300
1286#define SDIO_DEVICE_ID_ATHEROS_AR6003_01 0x0301
1287#define SDIO_DEVICE_ID_ATHEROS_AR6004_00 0x0400
1288#define SDIO_DEVICE_ID_ATHEROS_AR6004_01 0x0401
1289#define SDIO_DEVICE_ID_ATHEROS_AR6004_02 0x0402
1290#define SDIO_DEVICE_ID_ATHEROS_AR6004_18 0x0418
1291#define SDIO_DEVICE_ID_ATHEROS_AR6004_19 0x0419
1292#define SDIO_DEVICE_ID_ATHEROS_AR6005 0x050A
1293#define SDIO_DEVICE_ID_ATHEROS_QCA9377 0x0701
1295#define SDIO_DEVICE_ID_BROADCOM_NINTENDO_WII 0x044b
1296#define SDIO_DEVICE_ID_BROADCOM_43241 0x4324
1297#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329
1298#define SDIO_DEVICE_ID_BROADCOM_4330 0x4330
1299#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334
1300#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
1301#define SDIO_DEVICE_ID_BROADCOM_4339 0x4339
1302#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
1303#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
1304#define SDIO_DEVICE_ID_BROADCOM_CYPRESS_89359 0x4355
1305#define SDIO_DEVICE_ID_BROADCOM_4356 0x4356
1306#define SDIO_DEVICE_ID_BROADCOM_4359 0x4359
1307#define SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373 0x4373
1308#define SDIO_DEVICE_ID_BROADCOM_CYPRESS_43012 0xa804
1309#define SDIO_DEVICE_ID_BROADCOM_43143 0xa887
1310#define SDIO_DEVICE_ID_BROADCOM_43340 0xa94c
1311#define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
1312#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
1313#define SDIO_DEVICE_ID_BROADCOM_43364 0xa9a4
1314#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
1315#define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf
1317#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103
1318#define SDIO_DEVICE_ID_MARVELL_8688_WLAN 0x9104
1319#define SDIO_DEVICE_ID_MARVELL_8688_BT 0x9105
1320#define SDIO_DEVICE_ID_MARVELL_8786_WLAN 0x9116
1321#define SDIO_DEVICE_ID_MARVELL_8787_WLAN 0x9119
1322#define SDIO_DEVICE_ID_MARVELL_8787_BT 0x911a
1323#define SDIO_DEVICE_ID_MARVELL_8787_BT_AMP 0x911b
1324#define SDIO_DEVICE_ID_MARVELL_8797_F0 0x9128
1325#define SDIO_DEVICE_ID_MARVELL_8797_WLAN 0x9129
1326#define SDIO_DEVICE_ID_MARVELL_8797_BT 0x912a
1327#define SDIO_DEVICE_ID_MARVELL_8897_WLAN 0x912d
1328#define SDIO_DEVICE_ID_MARVELL_8897_BT 0x912e
1329#define SDIO_DEVICE_ID_MARVELL_8887_F0 0x9134
1330#define SDIO_DEVICE_ID_MARVELL_8887_WLAN 0x9135
1331#define SDIO_DEVICE_ID_MARVELL_8887_BT 0x9136
1332#define SDIO_DEVICE_ID_MARVELL_8801_WLAN 0x9139
1333#define SDIO_DEVICE_ID_MARVELL_8997_F0 0x9140
1334#define SDIO_DEVICE_ID_MARVELL_8997_WLAN 0x9141
1335#define SDIO_DEVICE_ID_MARVELL_8997_BT 0x9142
1336#define SDIO_DEVICE_ID_MARVELL_8977_WLAN 0x9145
1337#define SDIO_DEVICE_ID_MARVELL_8977_BT 0x9146
1338#define SDIO_DEVICE_ID_MARVELL_8987_WLAN 0x9149
1339#define SDIO_DEVICE_ID_MARVELL_8987_BT 0x914a
1341#define SDIO_DEVICE_ID_MEDIATEK_MT7663 0x7663
1342#define SDIO_DEVICE_ID_MEDIATEK_MT7668 0x7668
1344#define SDIO_DEVICE_ID_MICROCHIP_WILC1000 0x5347
1346#define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201
1347#define SDIO_DEVICE_ID_SIANO_NICE 0x0202
1348#define SDIO_DEVICE_ID_SIANO_VEGA_A0 0x0300
1349#define SDIO_DEVICE_ID_SIANO_VENICE 0x0301
1350#define SDIO_DEVICE_ID_SIANO_MING 0x0302
1351#define SDIO_DEVICE_ID_SIANO_PELE 0x0500
1352#define SDIO_DEVICE_ID_SIANO_RIO 0x0600
1353#define SDIO_DEVICE_ID_SIANO_DENVER_2160 0x0700
1354#define SDIO_DEVICE_ID_SIANO_DENVER_1530 0x0800
1355#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100
1356#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347
1358#define SDIO_DEVICE_ID_TI_WL1251 0x9066
1361#define CISTPL_NULL 0x00
1362#define CISTPL_CHECKSUM 0x10
1363#define CISTPL_VERS_1 0x15
1364#define CISTPL_ALTSTR 0x16
1365#define CISTPL_MANFID 0x20
1366#define CISTPL_FUNCID 0x21
1367#define CISTPL_FUNCE 0x22
1368#define CISTPL_SDIO_STD 0x91
1369#define CISTPL_SDIO_EXT 0x92
1370#define CISTPL_END 0xFF
1372#define SDIO_MAX_FUNCTIONS 7
1374#define SDIO_READ_CIS_TIMEOUT_MS (10 * 1000)
1377#define SDHCI_NAME_PREFIX "SDHCI"
1380#define SDHCI_TYPE_NONE 0
1381#define SDHCI_TYPE_MMC 1
1382#define SDHCI_TYPE_SD 2
1383#define SDHCI_TYPE_MMCI 3
1385#define SDHCI_TYPE_MAX 3
1388#define SDHCI_STATE_DISABLED 0
1389#define SDHCI_STATE_ENABLED 1
1391#define SDHCI_STATE_MAX 1
1394#define SDHCI_FLAG_NONE 0x00000000
1395#define SDHCI_FLAG_SDMA 0x00000001
1396#define SDHCI_FLAG_ADMA 0x00000002
1397#define SDHCI_FLAG_SPI 0x00000004
1398#define SDHCI_FLAG_CRC_ENABLE 0x00000008
1399#define SDHCI_FLAG_NON_STANDARD 0x00000010
1400#define SDHCI_FLAG_AUTO_CMD12 0x00000020
1401#define SDHCI_FLAG_AUTO_CMD23 0x00000040
1402#define SDHCI_FLAG_64_BIT_DMA 0x00000080
1403#define SDHCI_FLAG_EXTERNAL_DMA 0x00000100
1404#define SDHCI_FLAG_BUS_ADDRESSES 0x00000200
1407#define SDHCI_DMA_ADDRESS 0x00
1408#define SDHCI_ARGUMENT2 SDHCI_DMA_ADDRESS
1409#define SDHCI_32BIT_BLK_CNT SDHCI_DMA_ADDRESS
1410#define SDHCI_BLOCK_SIZE 0x04
1411#define SDHCI_BLOCK_COUNT 0x06
1412#define SDHCI_ARGUMENT 0x08
1413#define SDHCI_TRANSFER_MODE 0x0C
1414#define SDHCI_COMMAND 0x0E
1415#define SDHCI_RESPONSE 0x10
1416#define SDHCI_BUFFER 0x20
1417#define SDHCI_PRESENT_STATE 0x24
1418#define SDHCI_HOST_CONTROL 0x28
1419#define SDHCI_POWER_CONTROL 0x29
1420#define SDHCI_BLOCK_GAP_CONTROL 0x2A
1421#define SDHCI_WAKE_UP_CONTROL 0x2B
1422#define SDHCI_CLOCK_CONTROL 0x2C
1423#define SDHCI_TIMEOUT_CONTROL 0x2E
1424#define SDHCI_SOFTWARE_RESET 0x2F
1425#define SDHCI_INT_STATUS 0x30
1426#define SDHCI_INT_ENABLE 0x34
1427#define SDHCI_SIGNAL_ENABLE 0x38
1428#define SDHCI_AUTO_CMD_STATUS 0x3C
1429#define SDHCI_HOST_CONTROL2 0x3E
1430#define SDHCI_CAPABILITIES 0x40
1431#define SDHCI_CAPABILITIES_1 0x44
1432#define SDHCI_MAX_CURRENT 0x48
1434#define SDHCI_SET_ACMD12_ERROR 0x50
1435#define SDHCI_SET_INT_ERROR 0x52
1436#define SDHCI_ADMA_ERROR 0x54
1438#define SDHCI_ADMA_ADDRESS 0x58
1439#define SDHCI_ADMA_ADDRESS_HI 0x5C
1441#define SDHCI_PRESET_FOR_SDR12 0x66
1442#define SDHCI_PRESET_FOR_SDR25 0x68
1443#define SDHCI_PRESET_FOR_SDR50 0x6A
1444#define SDHCI_PRESET_FOR_SDR104 0x6C
1445#define SDHCI_PRESET_FOR_DDR50 0x6E
1447#define SDHCI_PRESET_FOR_HS400 0x74
1449#define SDHCI_SLOT_INT_STATUS 0xFC
1450#define SDHCI_HOST_VERSION 0xFE
1453#define SDHCI_TRNS_DMA 0x01
1454#define SDHCI_TRNS_BLK_CNT_EN 0x02
1455#define SDHCI_TRNS_AUTO_CMD12 0x04
1456#define SDHCI_TRNS_AUTO_CMD23 0x08
1457#define SDHCI_TRNS_AUTO_SEL SDHCI_TRNS_AUTO_CMD12 | SDHCI_TRNS_AUTO_CMD23
1458#define SDHCI_TRNS_READ 0x10
1459#define SDHCI_TRNS_MULTI 0x20
1462#define SDHCI_CMD_RESP_MASK 0x03
1463#define SDHCI_CMD_CRC 0x08
1464#define SDHCI_CMD_INDEX 0x10
1465#define SDHCI_CMD_DATA 0x20
1466#define SDHCI_CMD_ABORTCMD 0xC0
1469#define SDHCI_CMD_RESP_NONE 0x00
1470#define SDHCI_CMD_RESP_LONG 0x01
1471#define SDHCI_CMD_RESP_SHORT 0x02
1472#define SDHCI_CMD_RESP_SHORT_BUSY 0x03
1475#define SDHCI_CMD_INHIBIT 0x00000001
1476#define SDHCI_DATA_INHIBIT 0x00000002
1477#define SDHCI_DOING_WRITE 0x00000100
1478#define SDHCI_DOING_READ 0x00000200
1479#define SDHCI_SPACE_AVAILABLE 0x00000400
1480#define SDHCI_DATA_AVAILABLE 0x00000800
1481#define SDHCI_CARD_PRESENT 0x00010000
1482#define SDHCI_CARD_STATE_STABLE 0x00020000
1483#define SDHCI_CARD_DETECT_PIN_LEVEL 0x00040000
1484#define SDHCI_WRITE_PROTECT 0x00080000
1485#define SDHCI_DATA_LEVEL_MASK 0x00F00000
1486#define SDHCI_DATA_0_LEVEL_MASK 0x00100000
1487#define SDHCI_CMD_LEVEL 0x01000000
1490#define SDHCI_CTRL_LED 0x01
1491#define SDHCI_CTRL_4BITBUS 0x02
1492#define SDHCI_CTRL_HISPD 0x04
1493#define SDHCI_CTRL_DMA_MASK 0x18
1494#define SDHCI_CTRL_SDMA 0x00
1495#define SDHCI_CTRL_ADMA1 0x08
1496#define SDHCI_CTRL_ADMA32 0x10
1497#define SDHCI_CTRL_ADMA64 0x18
1498#define SDHCI_CTRL_ADMA3 0x18
1499#define SDHCI_CTRL_8BITBUS 0x20
1500#define SDHCI_CTRL_CD_TEST_INS 0x40
1501#define SDHCI_CTRL_CD_TEST 0x80
1504#define SDHCI_POWER_ON 0x01
1505#define SDHCI_POWER_180 0x0A
1506#define SDHCI_POWER_300 0x0C
1507#define SDHCI_POWER_330 0x0E
1510#define SDHCI_WAKE_ON_INT 0x01
1511#define SDHCI_WAKE_ON_INSERT 0x02
1512#define SDHCI_WAKE_ON_REMOVE 0x04
1515#define SDHCI_DIVIDER_SHIFT 8
1516#define SDHCI_DIVIDER_HI_SHIFT 6
1517#define SDHCI_DIV_MASK 0xFF
1518#define SDHCI_DIV_MASK_LEN 8
1519#define SDHCI_DIV_HI_MASK 0x0300
1520#define SDHCI_PROG_CLOCK_MODE 0x0020
1521#define SDHCI_CLOCK_CARD_EN 0x0004
1522#define SDHCI_CLOCK_PLL_EN 0x0008
1523#define SDHCI_CLOCK_INT_STABLE 0x0002
1524#define SDHCI_CLOCK_INT_EN 0x0001
1527#define SDHCI_RESET_ALL 0x01
1528#define SDHCI_RESET_CMD 0x02
1529#define SDHCI_RESET_DATA 0x04
1532#define SDHCI_INT_RESPONSE 0x00000001
1533#define SDHCI_INT_DATA_END 0x00000002
1534#define SDHCI_INT_BLK_GAP 0x00000004
1535#define SDHCI_INT_DMA_END 0x00000008
1536#define SDHCI_INT_SPACE_AVAIL 0x00000010
1537#define SDHCI_INT_DATA_AVAIL 0x00000020
1538#define SDHCI_INT_CARD_INSERT 0x00000040
1539#define SDHCI_INT_CARD_REMOVE 0x00000080
1540#define SDHCI_INT_CARD_INT 0x00000100
1541#define SDHCI_INT_RETUNE 0x00001000
1542#define SDHCI_INT_CQE 0x00004000
1543#define SDHCI_INT_ERROR 0x00008000
1544#define SDHCI_INT_TIMEOUT 0x00010000
1545#define SDHCI_INT_CRC 0x00020000
1546#define SDHCI_INT_END_BIT 0x00040000
1547#define SDHCI_INT_INDEX 0x00080000
1548#define SDHCI_INT_DATA_TIMEOUT 0x00100000
1549#define SDHCI_INT_DATA_CRC 0x00200000
1550#define SDHCI_INT_DATA_END_BIT 0x00400000
1551#define SDHCI_INT_BUS_POWER 0x00800000
1552#define SDHCI_INT_AUTO_CMD_ERR 0x01000000
1553#define SDHCI_INT_ADMA_ERROR 0x02000000
1555#define SDHCI_INT_NORMAL_MASK 0x00007FFF
1556#define SDHCI_INT_ERROR_MASK 0xFFFF8000
1558#define SDHCI_INT_CMD_MASK (SDHCI_INT_RESPONSE | SDHCI_INT_TIMEOUT | SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX | SDHCI_INT_AUTO_CMD_ERR)
1559#define SDHCI_INT_DATA_MASK (SDHCI_INT_DATA_END | SDHCI_INT_DMA_END | SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_END_BIT | SDHCI_INT_ADMA_ERROR | SDHCI_INT_BLK_GAP)
1560#define SDHCI_INT_ALL_MASK (LongWord(-1))
1562#define SDHCI_CQE_INT_ERR_MASK (SDHCI_INT_ADMA_ERROR | SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC | SDHCI_INT_TIMEOUT)
1563#define SDHCI_CQE_INT_MASK (SDHCI_CQE_INT_ERR_MASK | SDHCI_INT_CQE)
1566#define SDHCI_AUTO_CMD_TIMEOUT 0x00000002
1567#define SDHCI_AUTO_CMD_CRC 0x00000004
1568#define SDHCI_AUTO_CMD_END_BIT 0x00000008
1569#define SDHCI_AUTO_CMD_INDEX 0x00000010
1572#define SDHCI_CTRL_UHS_MASK 0x0007
1573#define SDHCI_CTRL_UHS_SDR12 0x0000
1574#define SDHCI_CTRL_UHS_SDR25 0x0001
1575#define SDHCI_CTRL_UHS_SDR50 0x0002
1576#define SDHCI_CTRL_UHS_SDR104 0x0003
1577#define SDHCI_CTRL_UHS_DDR50 0x0004
1578#define SDHCI_CTRL_HS400 0x0005
1579#define SDHCI_CTRL_VDD_180 0x0008
1580#define SDHCI_CTRL_DRV_TYPE_MASK 0x0030
1581#define SDHCI_CTRL_DRV_TYPE_B 0x0000
1582#define SDHCI_CTRL_DRV_TYPE_A 0x0010
1583#define SDHCI_CTRL_DRV_TYPE_C 0x0020
1584#define SDHCI_CTRL_DRV_TYPE_D 0x0030
1585#define SDHCI_CTRL_EXEC_TUNING 0x0040
1586#define SDHCI_CTRL_TUNED_CLK 0x0080
1587#define SDHCI_CMD23_ENABLE 0x0800
1588#define SDHCI_CTRL_V4_MODE 0x1000
1589#define SDHCI_CTRL_64BIT_ADDR 0x2000
1590#define SDHCI_CTRL_PRESET_VAL_ENABLE 0x8000
1593#define SDHCI_TIMEOUT_CLK_MASK 0x0000003F
1594#define SDHCI_TIMEOUT_CLK_SHIFT 0
1595#define SDHCI_TIMEOUT_CLK_UNIT 0x00000080
1596#define SDHCI_CLOCK_BASE_MASK 0x00003F00
1597#define SDHCI_CLOCK_V3_BASE_MASK 0x0000FF00
1598#define SDHCI_CLOCK_BASE_SHIFT 8
1599#define SDHCI_CLOCK_BASE_MULTIPLIER 1000000
1600#define SDHCI_MAX_BLOCK_MASK 0x00030000
1601#define SDHCI_MAX_BLOCK_SHIFT 16
1602#define SDHCI_CAN_DO_8BIT 0x00040000
1603#define SDHCI_CAN_DO_ADMA2 0x00080000
1604#define SDHCI_CAN_DO_ADMA1 0x00100000
1605#define SDHCI_CAN_DO_HISPD 0x00200000
1606#define SDHCI_CAN_DO_SDMA 0x00400000
1607#define SDHCI_CAN_VDD_330 0x01000000
1608#define SDHCI_CAN_VDD_300 0x02000000
1609#define SDHCI_CAN_VDD_180 0x04000000
1610#define SDHCI_CAN_64BIT_V4 0x08000000
1611#define SDHCI_CAN_64BIT 0x10000000
1614#define SDHCI_SUPPORT_SDR50 0x00000001
1615#define SDHCI_SUPPORT_SDR104 0x00000002
1616#define SDHCI_SUPPORT_DDR50 0x00000004
1617#define SDHCI_DRIVER_TYPE_A 0x00000010
1618#define SDHCI_DRIVER_TYPE_C 0x00000020
1619#define SDHCI_DRIVER_TYPE_D 0x00000040
1620#define SDHCI_RETUNING_TIMER_COUNT_MASK 0x00000F00
1621#define SDHCI_USE_SDR50_TUNING 0x00002000
1622#define SDHCI_RETUNING_MODE_MASK 0x0000C000
1623#define SDHCI_CLOCK_MUL_MASK 0x00FF0000
1624#define SDHCI_CAN_DO_ADMA3 0x08000000
1625#define SDHCI_SUPPORT_HS400 0x80000000
1628#define SDHCI_MAX_CURRENT_LIMIT 0x000000FF
1629#define SDHCI_MAX_CURRENT_330_MASK 0x000000FF
1630#define SDHCI_MAX_CURRENT_300_MASK 0x0000FF00
1631#define SDHCI_MAX_CURRENT_180_MASK 0x00FF0000
1632#define SDHCI_MAX_CURRENT_MULTIPLIER 4
1635#define SDHCI_PRESET_DRV_MASK 0x0000C000
1636#define SDHCI_PRESET_DRV_SHIFT 14
1637#define SDHCI_PRESET_CLKGEN_SEL 1 << 10
1638#define SDHCI_PRESET_SDCLK_FREQ_MASK 0x000003FF
1641#define SDHCI_VENDOR_VER_MASK 0xFF00
1642#define SDHCI_VENDOR_VER_SHIFT 8
1643#define SDHCI_SPEC_VER_MASK 0x00FF
1644#define SDHCI_SPEC_VER_SHIFT 0
1645#define SDHCI_SPEC_100 0
1646#define SDHCI_SPEC_200 1
1647#define SDHCI_SPEC_300 2
1648#define SDHCI_SPEC_400 3
1649#define SDHCI_SPEC_410 4
1650#define SDHCI_SPEC_420 5
1653#define SDHCI_MAX_CLOCK_DIV_SPEC_200 256
1654#define SDHCI_MAX_CLOCK_DIV_SPEC_300 2046
1658#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1 << 0)
1659#define SDHCI_QUIRK_FORCE_DMA (1 << 1)
1660#define SDHCI_QUIRK_NO_CARD_NO_RESET (1 << 2)
1661#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1 << 3)
1662#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1 << 4)
1663#define SDHCI_QUIRK_BROKEN_DMA (1 << 5)
1664#define SDHCI_QUIRK_BROKEN_ADMA (1 << 6)
1665#define SDHCI_QUIRK_32BIT_DMA_ADDR (1 << 7)
1666#define SDHCI_QUIRK_32BIT_DMA_SIZE (1 << 8)
1667#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1 << 9)
1668#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1 << 10)
1669#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1 << 11)
1670#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1 << 12)
1671#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1 << 13)
1672#define SDHCI_QUIRK_NO_BUSY_IRQ (1 << 14)
1673#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1 << 15)
1674#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1 << 16)
1675#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1 << 18)
1676#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1 << 20)
1677#define SDHCI_QUIRK_NO_MULTIBLOCK (1 << 21)
1678#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1 << 22)
1679#define SDHCI_QUIRK_DELAY_AFTER_POWER (1 << 23)
1680#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1 << 24)
1681#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1 << 25)
1682#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1 << 26)
1683#define SDHCI_QUIRK_MISSING_CAPS (1 << 27)
1684#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1 << 28)
1685#define SDHCI_QUIRK_NO_HISPD_BIT (1 << 29)
1686#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1 << 30)
1687#define SDHCI_QUIRK_UNSTABLE_RO_DETECT (1 << 31)
1691#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1 << 0)
1692#define SDHCI_QUIRK2_HOST_NO_CMD23 (1 << 1)
1693#define SDHCI_QUIRK2_NO_1_8_V (1 << 2)
1694#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1 << 3)
1695#define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1 << 4)
1696#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1 << 5)
1697#define SDHCI_QUIRK2_BROKEN_HS200 (1 << 6)
1698#define SDHCI_QUIRK2_BROKEN_DDR50 (1 << 7)
1699#define SDHCI_QUIRK2_STOP_WITH_TC (1 << 8)
1700#define SDHCI_QUIRK2_BROKEN_64_BIT_DMA (1 << 9)
1701#define SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD (1 << 10)
1702#define SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 (1 << 11)
1703#define SDHCI_QUIRK2_TUNING_WORK_AROUND (1 << 12)
1704#define SDHCI_QUIRK2_SUPPORT_SINGLE (1 << 13)
1705#define SDHCI_QUIRK2_ACMD23_BROKEN (1 << 14)
1706#define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1 << 15)
1707#define SDHCI_QUIRK2_RSP_136_HAS_CRC (1 << 16)
1708#define SDHCI_QUIRK2_DISABLE_HW_TIMEOUT (1 << 17)
1709#define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1 << 18)
1713#define SDHCI_DEFAULT_BOUNDARY_SIZE (512 * 1024)
1714#define SDHCI_DEFAULT_BOUNDARY_ARG 7
1717#define SDHCI_ADMA2_32_DESC_SIZE 8
1720#define SDHCI_ADMA2_ALIGN 4
1721#define SDHCI_ADMA2_MASK (SDHCI_ADMA2_ALIGN - 1)
1724#define SDHCI_ADMA2_DESC_ALIGN 8
1727#define SDHCI_ADMA2_64_DESC_SIZE 12
1728#define SDHCI_ADMA2_64_DESC_V4_SIZE 16
1731#define SDHCI_ADMA2_DESC_ATTR_VALID 0x01
1732#define SDHCI_ADMA2_DESC_ATTR_END 0x02
1733#define SDHCI_ADMA2_DESC_ATTR_INT 0x04
1734#define SDHCI_ADMA2_DESC_ATTR_NOP 0x00
1735#define SDHCI_ADMA2_DESC_ATTR_TRAN 0x20
1736#define SDHCI_ADMA2_DESC_ATTR_LINK 0x30
1738#define SDHCI_ADMA2_DESC_TRAN_VALID SDHCI_ADMA2_DESC_ATTR_TRAN | SDHCI_ADMA2_DESC_ATTR_VALID
1739#define SDHCI_ADMA2_DESC_NOP_END_VALID SDHCI_ADMA2_DESC_ATTR_NOP | SDHCI_ADMA2_DESC_ATTR_END | SDHCI_ADMA2_DESC_ATTR_VALID
1740#define SDHCI_ADMA2_DESC_END SDHCI_ADMA2_DESC_ATTR_END
1743#define SDHCI_MAX_SEGS 128
1746#define SDHCI_TIMEOUT_VALUE 0x0E
struct _DEVICE DEVICE
Definition devices.h:373
struct _DRIVER DRIVER
Definition devices.h:465
struct _DMA_REQUEST DMA_REQUEST
Forward declared to satisfy DMAHost.
Definition dma.h:91
int32_t LONGBOOL
Compatibility with FPC LongBool type (4 bytes).
Definition globaltypes.h:56
#define STDCALL
Definition globaltypes.h:45
#define PACKED
Definition globaltypes.h:48
HANDLE SPIN_HANDLE
Definition globaltypes.h:104
HANDLE WORKER_HANDLE
Definition globaltypes.h:120
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
HANDLE SEMAPHORE_HANDLE
Definition globaltypes.h:107
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
struct _MMC_CARD_IDENTIFICATION_DATA MMC_CARD_IDENTIFICATION_DATA
uint32_t STDCALL sdhci_host_destroy(SDHCI_HOST *sdhci)
Destroy an existing SDHCI entry.
uint32_t STDCALL mmc_stop(void)
uint32_t STDCALL mmc_device_get_card_detect(MMC_DEVICE *mmc)
uint32_t STDCALL(* sdhci_host_stop_proc)(SDHCI_HOST *sdhci)
Definition mmc.h:2246
uint32_t STDCALL mmc_device_set_driver_stage(MMC_DEVICE *mmc, uint32_t driverstage)
uint32_t STDCALL sdhci_host_finish_data(SDHCI_HOST *sdhci)
Default finish data function for SDHCI host controllers Called by Interrupt Data handler when data is...
uint32_t STDCALL sdhci_device_state_to_string(uint32_t sdhcistate, char *name, uint32_t len)
uint32_t STDCALL sdhci_host_set_timing(SDHCI_HOST *sdhci, uint32_t timing)
Default set timing function for SDHCI host controllers.
uint32_t STDCALL sdio_function_write(SDIO_FUNCTION *func, uint32_t address, void *buffer, uint32_t size)
Wrapper for writing multiple bytes to an SDIO function.
uint32_t STDCALL sdio_function_write_byte(SDIO_FUNCTION *func, uint32_t address, uint8_t input)
Wrapper for writing a single byte to an SDIO function.
uint32_t STDCALL sd_device_send_sd_configuration(MMC_DEVICE *mmc)
SDHCI_HOST *STDCALL sdhci_host_create_ex(uint32_t size)
Create a new SDHCI entry.
uint8_t STDCALL(* sdhci_host_read_byte_proc)(SDHCI_HOST *sdhci, uint32_t reg)
Definition mmc.h:2250
uint32_t STDCALL sd_device_send_relative_address(MMC_DEVICE *mmc)
struct _SD_STATUS_DATA SD_STATUS_DATA
Definition mmc.h:1962
uint32_t STDCALL mmc_extract_bits_ex(void *buffer, uint32_t length, uint32_t start, uint32_t size)
Length is the size of the buffer in LongWords, Start is the starting bit to extract,...
uint32_t STDCALL mmc_device_set_clock(MMC_DEVICE *mmc, uint32_t clock)
uint32_t STDCALL sdio_device_read_common_cis(MMC_DEVICE *mmc)
uint32_t STDCALL sd_device_decode_sd_status(MMC_DEVICE *mmc)
void STDCALL(* sdhci_host_write_byte_proc)(SDHCI_HOST *sdhci, uint32_t reg, uint8_t value)
Definition mmc.h:2253
uint32_t STDCALL mmc_device_get_extended_card_specific(MMC_DEVICE *mmc)
BOOL STDCALL sdhci_has_cmd23(SDHCI_HOST *sdhci)
uint32_t STDCALL sdio_device_read_write_extended(MMC_DEVICE *mmc, BOOL write, uint32_t operation, uint32_t address, BOOL increment, void *buffer, uint32_t blockcount, uint32_t blocksize)
uint32_t STDCALL(* sdhci_host_unlock_proc)(SDHCI_HOST *sdhci)
Definition mmc.h:2248
uint32_t STDCALL sdhci_host_start(SDHCI_HOST *sdhci)
Default host start function for SDHCI host controllers Called automatically to start each registered ...
uint32_t STDCALL sd_get_max_clock(MMC_DEVICE *mmc)
Determine the Maximum Clock (DTR) for the current card.
uint32_t STDCALL sd_device_switch_highspeed(MMC_DEVICE *mmc)
uint32_t STDCALL(* sdhci_host_prepare_dma_proc)(SDHCI_HOST *sdhci, MMC_COMMAND *command)
Definition mmc.h:2264
uint32_t STDCALL sdio_device_read_write_direct(MMC_DEVICE *mmc, BOOL write, uint32_t operation, uint32_t address, uint8_t input, uint8_t *output)
uint32_t STDCALL sdhci_host_transfer_pio(SDHCI_HOST *sdhci)
Default PIO transfer function for SDHCI host controllers.
uint32_t STDCALL sdio_function_set_block_size(SDIO_FUNCTION *func, uint32_t blocksize)
SDIO_DRIVER *STDCALL sdio_driver_find(uint32_t driverid)
Find a driver by Id in the SDIO Driver table.
uint32_t STDCALL sd_get_csd_value(MMC_DEVICE *mmc, uint32_t version, uint32_t value)
Extract a CSD field value from the 128 bit Card Specific register.
uint32_t STDCALL sdio_function_write_read_byte(SDIO_FUNCTION *func, uint32_t address, uint8_t input, uint8_t *output)
Wrapper for performing a read after write (RAW) operation on an SDIO function.
uint32_t STDCALL sdhci_host_set_bus_width(SDHCI_HOST *sdhci, uint32_t buswidth)
Default set bus width function for SDHCI host controllers.
uint32_t STDCALL sdhci_host_command_interrupt(SDHCI_HOST *sdhci, uint32_t interruptmask, uint32_t *returnmask)
Default command interrupt processing function for SDHCI host controllers Called by SDHCI controller i...
uint32_t STDCALL(* sdio_driver_bind_proc)(MMC_DEVICE *mmc, SDIO_FUNCTION *func)
Definition mmc.h:2186
uint32_t STDCALL mmc_device_send_card_specific(MMC_DEVICE *mmc)
SDIO_FUNCTION *STDCALL sdio_function_find_by_id(MMC_DEVICE *mmc, uint16_t vendorid, uint16_t deviceid)
MMC_DEVICE *STDCALL mmc_device_check(MMC_DEVICE *mmc)
SDIO_DRIVER *STDCALL sdio_driver_create(void)
Driver Methods.
void STDCALL sdhci_host_write_long(SDHCI_HOST *sdhci, uint32_t reg, uint32_t value)
Default write longword function for SDHCI host controllers.
uint32_t STDCALL sdio_function_register_interrupt(SDIO_FUNCTION *func, sdio_interrupt_handler handler)
#define MMC_FIRMWARE_VERSION_LEN
Definition mmc.h:794
MMC_DEVICE *STDCALL mmc_device_create_ex(uint32_t size)
Create a new MMC entry.
struct _MMC_CARD_SPECIFIC_MM_C22_ERASE_DATA MMC_CARD_SPECIFIC_MM_C22_ERASE_DATA
uint32_t STDCALL sdhci_host_set_control_register(SDHCI_HOST *sdhci)
Default set control register function for SDHCI host controllers.
uint32_t STDCALL(* mmc_enumerate_cb)(MMC_DEVICE *mmc, void *data)
Definition mmc.h:2034
uint32_t STDCALL sdio_device_process_interrupts(MMC_DEVICE *mmc)
uint32_t STDCALL sdio_device_read_function_cis(SDIO_FUNCTION *func)
struct _SDHCI_HOST SDHCI_HOST
Definition mmc.h:2237
uint32_t STDCALL mmc_device_send_all_card_identification(MMC_DEVICE *mmc)
size_t STDCALL sdhci_host_get_adma_address(SDHCI_HOST *sdhci)
Get the DMA address of the ADMA table for the current request.
void STDCALL(* sdio_interrupt_handler)(SDIO_FUNCTION *func)
Definition mmc.h:2155
uint32_t STDCALL sdio_function_read_byte(SDIO_FUNCTION *func, uint32_t address, uint8_t *output)
Wrapper for reading a single byte from an SDIO function.
uint32_t STDCALL sd_device_switch(MMC_DEVICE *mmc, int mode, int group, uint8_t value, void *buffer)
uint32_t STDCALL mmc_device_spi_set_crc(MMC_DEVICE *mmc, BOOL enable)
uint32_t STDCALL sdio_host_dispatch_interrupt(SDHCI_HOST *sdhci, BOOL irq, BOOL fiq)
Host Methods.
void STDCALL(* sdhci_host_write_word_proc)(SDHCI_HOST *sdhci, uint32_t reg, uint16_t value)
Definition mmc.h:2254
uint32_t STDCALL sdio_device_send_operation_condition(MMC_DEVICE *mmc, BOOL probe)
struct _SDIO_CIS SDIO_CIS
Forward declared to satisfy MMCDevice.
Definition mmc.h:2029
void STDCALL sdhci_host_write_adma_descriptor(SDHCI_HOST *sdhci, void *descriptor, uint16_t command, uint16_t len, size_t address)
Write the properties to an ADMA descriptor.
uint32_t STDCALL sd_get_switch_value(MMC_DEVICE *mmc, uint32_t value)
Extract a Switch field value from the 512 bit SD Switch status.
uint32_t STDCALL sdio_function_write_long(SDIO_FUNCTION *func, uint32_t address, uint32_t input)
Wrapper for writing a single longword to an SDIO function.
uint32_t STDCALL sd_device_get_card_specific(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_host_set_clock_divider(SDHCI_HOST *sdhci, int index, uint32_t divider)
Default set clock divider function for SDHCI host controllers.
uint32_t STDCALL(* sdio_function_enumerate_cb)(SDIO_FUNCTION *func, void *data)
Definition mmc.h:2158
void STDCALL mmc_async_start(SDHCI_HOST *sdhci)
uint32_t STDCALL mmc_device_type_to_string(uint32_t mmctype, char *string, uint32_t len)
uint32_t STDCALL(* sdhci_host_set_timing_proc)(SDHCI_HOST *sdhci, uint32_t timing)
Definition mmc.h:2260
uint32_t STDCALL sdio_function_enumerate(MMC_DEVICE *mmc, sdio_function_enumerate_cb callback, void *data)
uint32_t STDCALL(* sdhci_host_hardware_reset_proc)(SDHCI_HOST *sdhci)
Definition mmc.h:2257
BOOL STDCALL mmc_is_sd(MMC_DEVICE *mmc)
struct _MMC_DATA MMC_DATA
Definition mmc.h:1751
uint32_t STDCALL(* mmc_device_send_command_proc)(MMC_DEVICE *mmc, MMC_COMMAND *command)
Definition mmc.h:2043
uint32_t STDCALL sdio_function_read(SDIO_FUNCTION *func, uint32_t address, void *buffer, uint32_t size)
Wrapper for reading multiple bytes from an SDIO function.
uint32_t STDCALL mmc_device_get_write_protect(MMC_DEVICE *mmc)
BOOL STDCALL mmc_is_non_removable(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_host_notification(SDHCI_HOST *sdhci, sdhci_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
uint32_t STDCALL mmc_device_select_card(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_device_poll_for_busy(MMC_DEVICE *mmc, uint32_t timeout, uint32_t command)
Poll the specified MMC device for command completion using busy status.
struct _SDIO_TUPLE SDIO_TUPLE
Forward declared to satisfy MMCDevice.
Definition mmc.h:2030
uint32_t STDCALL mmc_timing_to_string(uint32_t timing, char *string, uint32_t len)
Translates an MMC timing into a string.
uint32_t STDCALL mmc_device_set_bus_width(MMC_DEVICE *mmc, uint32_t width)
SDHCI_HOST *STDCALL sdhci_host_create(void)
Create a new SDHCI entry.
void STDCALL sdhci_host_set_adma_address(SDHCI_HOST *sdhci, size_t address)
Set the address of the transfer data in the Advanced DMA (ADMA) registers.
MMC_DEVICE *STDCALL mmc_device_find_by_device(DEVICE *device)
Find an MMC/SD device by the matching DeviceData property.
uint32_t STDCALL sd_device_send_operation_condition(MMC_DEVICE *mmc, BOOL probe)
uint32_t STDCALL mmc_device_remove(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_get_count(void)
Get the current SDHCI count.
uint32_t STDCALL(* sdhci_host_setup_card_irq_proc)(SDHCI_HOST *sdhci, LONGBOOL enable)
Definition mmc.h:2267
uint32_t STDCALL(* sdhci_host_start_dma_proc)(SDHCI_HOST *sdhci, MMC_COMMAND *command)
Definition mmc.h:2265
uint32_t STDCALL sdio_function_read_long(SDIO_FUNCTION *func, uint32_t address, uint32_t *output)
Wrapper for reading a single longword from an SDIO function.
uint32_t STDCALL(* mmc_device_set_ios_proc)(MMC_DEVICE *mmc)
Definition mmc.h:2044
uint8_t STDCALL sdhci_host_read_byte(SDHCI_HOST *sdhci, uint32_t reg)
Default read byte function for SDHCI host controllers.
uint32_t STDCALL sdio_version_to_string(uint32_t version, char *string, uint32_t len)
Translates an SDIO version into a string.
SDHCI_HOST *STDCALL sdio_function_get_sdhci(SDIO_FUNCTION *func)
MMC_DEVICE *STDCALL mmc_device_find_by_description(const char *description)
SDIO_DRIVER *STDCALL sdio_driver_find_by_name(const char *name)
Find a driver by name in the Driver table.
struct _MMC_CARD_SPECIFIC_SD_ERASE_DATA MMC_CARD_SPECIFIC_SD_ERASE_DATA
uint16_t STDCALL sdhci_get_version(SDHCI_HOST *sdhci)
uint32_t STDCALL(* mmc_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition mmc.h:2036
uint32_t STDCALL mmc_device_stop_transmission(MMC_DEVICE *mmc)
union _MMC_CARD_SPECIFIC_ERASE_DATA MMC_CARD_SPECIFIC_ERASE_DATA
uint32_t STDCALL sdio_function_bind(SDIO_FUNCTION *func, SDIO_DRIVER *driver)
uint32_t STDCALL mmc_get_csd_value(MMC_DEVICE *mmc, uint32_t value)
Extract a CSD field value from the 128 bit Card Specific register.
uint32_t STDCALL mmc_driver_type_to_string(uint32_t drivertype, char *string, uint32_t len)
Translates an MMC driver type into a string.
uint32_t STDCALL(* mmc_device_initialize_proc)(MMC_DEVICE *mmc)
Definition mmc.h:2039
uint32_t STDCALL sdio_device_read_cis(MMC_DEVICE *mmc, SDIO_FUNCTION *func)
uint32_t STDCALL sdio_function_read_word(SDIO_FUNCTION *func, uint32_t address, uint16_t *output)
Wrapper for reading a single word from an SDIO function.
uint32_t STDCALL mmc_device_register(MMC_DEVICE *mmc)
Register a new MMC in the MMC table.
uint32_t STDCALL mmc_extract_bits(void *buffer, uint32_t start, uint32_t size)
Start is the starting bit to extract, Size is the number of bits to extract Start is the LSB so to ex...
struct _MMC_CARD_SPECIFIC_MM_C31_ERASE_DATA MMC_CARD_SPECIFIC_MM_C31_ERASE_DATA
uint32_t STDCALL sdhci_host_start_dma(SDHCI_HOST *sdhci, MMC_COMMAND *command)
Default DMA transfer start function for SDHCI host controllers.
uint32_t STDCALL sdio_device_read_cccr(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_device_switch(MMC_DEVICE *mmc, uint8_t setting, uint8_t index, uint8_t value, uint32_t timeout)
Modifies an Extended CSD register for the specificed MMC device.
uint32_t STDCALL sdio_function_status_to_string(uint32_t sdiostatus, char *string, uint32_t len)
uint32_t STDCALL mmc_device_decode_card_specific(MMC_DEVICE *mmc)
Given a 128-bit response, decode to our card CSD structure.
struct _MMC_COMMAND MMC_COMMAND
Definition mmc.h:1752
uint32_t STDCALL mmc_device_read_blocks(MMC_DEVICE *mmc, int64_t start, int64_t count, void *buffer)
uint32_t STDCALL sdhci_host_set_power(SDHCI_HOST *sdhci, uint16_t power)
Default set power function for SDHCI host controllers.
uint32_t STDCALL sd_device_send_application_command(MMC_DEVICE *mmc, MMC_COMMAND *command)
uint32_t STDCALL(* sdhci_host_set_control_register_proc)(SDHCI_HOST *sdhci)
Definition mmc.h:2263
uint32_t STDCALL mmc_device_write_blocks(MMC_DEVICE *mmc, int64_t start, int64_t count, void *buffer)
uint32_t STDCALL sdhci_host_setup_card_irq(SDHCI_HOST *sdhci, LONGBOOL enable)
Default Card IRQ setup function for SDHCI host controllers.
uint32_t STDCALL(* sdhci_host_set_clock_divider_proc)(SDHCI_HOST *sdhci, int index, uint32_t divider)
Definition mmc.h:2262
uint16_t STDCALL sdhci_get_command(uint16_t command)
BOOL STDCALL mmc_is_sdio(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_device_poll_for_busy_ex(MMC_DEVICE *mmc, uint32_t timeout, uint32_t command, BOOL sendstatus, BOOL retrycrcerror)
Poll the specified MMC device for command completion using busy status.
uint32_t STDCALL sdhci_host_reset(SDHCI_HOST *sdhci, uint8_t mask)
Default software reset function for SDHCI host controllers.
struct _SDIO_CCCR SDIO_CCCR
Forward declared to satisfy MMCDevice.
Definition mmc.h:2028
uint32_t STDCALL sdio_driver_destroy(SDIO_DRIVER *driver)
Destroy an existing SDIO Driver entry.
BOOL STDCALL sdhci_is_spi(SDHCI_HOST *sdhci)
struct _SD_CONFIGURATION_DATA SD_CONFIGURATION_DATA
Definition mmc.h:2009
void STDCALL sdhci_host_complete_dma(DMA_REQUEST *request)
Default DMA request completion callback for SDHCI host controllers.
uint32_t STDCALL(* sdhci_host_complete_card_irq_proc)(SDHCI_HOST *sdhci)
Definition mmc.h:2268
void STDCALL sdhci_host_set_sdma_address(SDHCI_HOST *sdhci, size_t address)
Set the address of the transfer data in the Simple DMA (SDMA) register.
uint32_t STDCALL sdio_function_state_to_notification(uint32_t state)
Convert a Device state value into the notification code for device notifications.
uint32_t STDCALL mmc_device_send_operation_condition(MMC_DEVICE *mmc, BOOL probe)
uint32_t STDCALL sdhci_host_register(SDHCI_HOST *sdhci)
Register a new SDHCI in the SDHCI table.
uint32_t STDCALL mmc_version_to_string(uint32_t version, char *string, uint32_t len)
Translates an MMC version into a string.
uint32_t STDCALL mmc_get_cid_value(MMC_DEVICE *mmc, uint32_t version, uint32_t value)
Extract a CID field value from the 128 bit Card Identification register.
void STDCALL sdhci_host_write_byte(SDHCI_HOST *sdhci, uint32_t reg, uint8_t value)
Default write byte function for SDHCI host controllers.
uint32_t STDCALL sd_device_decode_sd_configuration(MMC_DEVICE *mmc)
Given a 64-bit response, decode to our card SCR structure.
uint32_t STDCALL(* sdhci_host_lock_proc)(SDHCI_HOST *sdhci)
Definition mmc.h:2247
BOOL STDCALL sdhci_has_dma(SDHCI_HOST *sdhci)
uint32_t STDCALL sdio_driver_enumerate(sdio_driver_enumerate_cb callback, void *data)
uint32_t STDCALL(* sdhci_host_stop_dma_proc)(SDHCI_HOST *sdhci, MMC_COMMAND *command)
Definition mmc.h:2266
MMC_DEVICE *STDCALL mmc_device_find_by_name(const char *name)
SDIO_DRIVER *STDCALL sdio_driver_check(SDIO_DRIVER *driver)
Check if the supplied SDIO Driver is in the driver table.
uint32_t STDCALL sdio_function_read_write_extended(SDIO_FUNCTION *func, BOOL write, uint32_t address, BOOL increment, void *buffer, uint32_t size)
Perform an SDIO read or write to the specified function at the specified address Handles splitting an...
uint32_t STDCALL mmc_device_deregister(MMC_DEVICE *mmc)
Deregister a MMC from the MMC table.
uint32_t STDCALL mmc_device_send_card_status(MMC_DEVICE *mmc)
struct _SDIO_FUNCTION SDIO_FUNCTION
Forward declared to satisfy MMCDevice.
Definition mmc.h:2031
uint32_t STDCALL sdio_device_bind_functions(MMC_DEVICE *mmc)
Attempt to bind SDIO functions on an MMC device to one of the registered drivers.
uint32_t STDCALL mmc_device_send_command(MMC_DEVICE *mmc, MMC_COMMAND *command)
uint32_t STDCALL sdio_device_disable_wide_bus(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_device_decode_extended_card_specific(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_host_data_interrupt(SDHCI_HOST *sdhci, uint32_t interruptmask)
Default data interrupt processing function for SDHCI host controllers Called by SDHCI controller inte...
BOOL STDCALL sdhci_auto_cmd23(SDHCI_HOST *sdhci)
uint32_t STDCALL(* sdhci_enumerate_cb)(SDHCI_HOST *sdhci, void *data)
Definition mmc.h:2240
uint32_t STDCALL mmc_device_set_block_length(MMC_DEVICE *mmc, uint32_t length)
uint32_t STDCALL mmc_device_set_ios(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_device_enumerate(mmc_enumerate_cb callback, void *data)
uint16_t STDCALL(* sdhci_host_read_word_proc)(SDHCI_HOST *sdhci, uint32_t reg)
Definition mmc.h:2251
uint32_t STDCALL(* sdhci_host_start_proc)(SDHCI_HOST *sdhci)
Definition mmc.h:2245
MMC_DEVICE *STDCALL mmc_device_find(uint32_t mmcid)
uint32_t STDCALL(* sdio_driver_enumerate_cb)(SDIO_DRIVER *driver, void *data)
Definition mmc.h:2183
uint32_t STDCALL(* mmc_device_deinitialize_proc)(MMC_DEVICE *mmc)
Definition mmc.h:2040
uint32_t STDCALL sdio_device_switch_highspeed(MMC_DEVICE *mmc, BOOL enable)
uint32_t STDCALL(* sdhci_host_reset_proc)(SDHCI_HOST *sdhci, uint8_t mask)
Definition mmc.h:2256
uint32_t STDCALL mmc_device_initialize(MMC_DEVICE *mmc)
BOOL STDCALL mmc_has_extended_csd(MMC_DEVICE *mmc)
uint32_t STDCALL sdio_function_enable(SDIO_FUNCTION *func)
uint32_t STDCALL sdio_device_unbind_functions(MMC_DEVICE *mmc, SDIO_DRIVER *driver)
Unbind SDIO functions on an MMC device from a driver.
uint32_t STDCALL sdhci_device_type_to_string(uint32_t sdhcitype, char *name, uint32_t len)
uint32_t STDCALL mmc_device_spi_read_operation_condition(MMC_DEVICE *mmc, BOOL highcapacity)
uint32_t STDCALL sdio_device_register_interrupt(MMC_DEVICE *mmc, SDIO_FUNCTION *func, sdio_interrupt_handler handler)
SDHCI_HOST *STDCALL mmc_get_sdhci(MMC_DEVICE *mmc)
SDIO_FUNCTION *STDCALL sdio_function_find(MMC_DEVICE *mmc, uint32_t number)
uint16_t STDCALL sdhci_make_block_size(uint16_t dma, uint16_t blocksize)
uint32_t STDCALL sdio_device_deregister_interrupt(MMC_DEVICE *mmc, SDIO_FUNCTION *func)
uint32_t STDCALL sdio_driver_get_count(void)
Get the current SDIO driver count.
uint32_t STDCALL mmc_device_state_to_string(uint32_t mmcstate, char *string, uint32_t len)
uint32_t STDCALL sdhci_host_read_long(SDHCI_HOST *sdhci, uint32_t reg)
Default read longword function for SDHCI host controllers.
uint32_t STDCALL mmc_device_erase_blocks(MMC_DEVICE *mmc, int64_t start, int64_t count)
uint32_t STDCALL mmc_device_send_extended_card_specific(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_device_deinitialize(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_host_lock(SDHCI_HOST *sdhci)
Default host lock function for SDHCI host controllers.
uint32_t STDCALL sd_device_decode_card_specific(MMC_DEVICE *mmc)
Given a 128-bit response, decode to our card CSD structure.
uint32_t STDCALL sdhci_version_to_string(uint32_t version, char *name, uint32_t len)
Translate an SDHCI version into a string.
BOOL STDCALL mmc_has_set_block_count(MMC_DEVICE *mmc)
struct _MMC_CARD_SPECIFIC_DATA MMC_CARD_SPECIFIC_DATA
Definition mmc.h:1833
uint32_t STDCALL mmc_get_count(void)
Get the current MMC count.
uint32_t STDCALL sdio_function_status_to_notification(uint32_t status)
Convert a Device status value into the notification code for device notifications.
uint32_t STDCALL sdio_driver_deregister(SDIO_DRIVER *driver)
Deregister a Driver from the SDIO Driver table.
uint32_t STDCALL sdio_function_write_word(SDIO_FUNCTION *func, uint32_t address, uint16_t input)
Wrapper for writing a single word to an SDIO function.
BOOL STDCALL mmc_is_multi_command(uint16_t command)
uint32_t STDCALL(* mmc_device_get_write_protect_proc)(MMC_DEVICE *mmc)
Definition mmc.h:2042
uint32_t STDCALL mmc_device_set_timing(MMC_DEVICE *mmc, uint32_t timing)
uint16_t STDCALL sdhci_make_command(uint16_t command, uint16_t flags)
SDIO_FUNCTION *STDCALL sdio_function_allocate(MMC_DEVICE *mmc, uint32_t number)
Function Methods.
MMC_DEVICE *STDCALL mmc_device_create(void)
Create a new MMC entry.
uint32_t STDCALL sdio_device_read_byte(MMC_DEVICE *mmc, uint32_t address, uint8_t *output)
Wrapper for reading a single byte from Function 0.
uint32_t STDCALL sdhci_host_deregister(SDHCI_HOST *sdhci)
Deregister a SDHCI from the SDHCI table.
uint32_t STDCALL sdio_device_enable_highspeed(MMC_DEVICE *mmc)
uint32_t STDCALL(* sdhci_host_signal_proc)(SDHCI_HOST *sdhci, SEMAPHORE_HANDLE semaphore)
Definition mmc.h:2249
uint32_t STDCALL sdhci_host_hardware_reset(SDHCI_HOST *sdhci)
Default hardware reset function for SDHCI host controllers.
uint32_t STDCALL sdhci_power_to_string(uint32_t power, char *name, uint32_t len)
Translate an SDHCI power value into a string.
#define MMC_NUM_GP_PARTITION
Definition mmc.h:786
struct _MMC_EXTENDED_CARD_SPECIFIC_DATA MMC_EXTENDED_CARD_SPECIFIC_DATA
Definition mmc.h:1879
uint32_t STDCALL sdio_function_unbind(SDIO_FUNCTION *func, SDIO_DRIVER *driver)
BOOL STDCALL mmc_has_auto_command_stop(MMC_DEVICE *mmc)
uint32_t STDCALL(* sdhci_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition mmc.h:2242
uint32_t STDCALL sdio_device_write_byte(MMC_DEVICE *mmc, uint32_t address, uint8_t input)
Wrapper for writing a single byte to Function 0.
uint32_t STDCALL mmc_start(void)
uint32_t STDCALL mmc_device_set_block_count(MMC_DEVICE *mmc, uint32_t count, BOOL relative)
uint32_t STDCALL(* sdhci_host_read_long_proc)(SDHCI_HOST *sdhci, uint32_t reg)
Definition mmc.h:2252
size_t STDCALL sdhci_host_get_sdma_address(SDHCI_HOST *sdhci, MMC_COMMAND *command)
Get the DMA address of the transfer data for the current request.
struct _MMC_DEVICE MMC_DEVICE
Definition mmc.h:2027
uint32_t STDCALL mmc_device_go_idle(MMC_DEVICE *mmc)
void STDCALL sdhci_host_write_word(SDHCI_HOST *sdhci, uint32_t reg, uint16_t value)
Default write word function for SDHCI host controllers.
SDHCI_HOST *STDCALL sdhci_host_find(uint32_t sdhciid)
uint32_t STDCALL sd_device_send_interface_condition(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_host_stop(SDHCI_HOST *sdhci)
Default host stop function for SDHCI host controllers Called automatically to stop each registered SD...
uint32_t STDCALL sdhci_host_stop_dma(SDHCI_HOST *sdhci, MMC_COMMAND *command)
Default DMA transfer stop function for SDHCI host controllers.
uint32_t STDCALL sd_bus_width_to_string(uint32_t buswidth, char *string, uint32_t len)
Translates an SD bus width into a string.
uint32_t STDCALL(* sdhci_host_set_buswidth_proc)(SDHCI_HOST *sdhci, uint32_t buswidth)
Definition mmc.h:2261
uint32_t STDCALL sdhci_host_signal(SDHCI_HOST *sdhci, SEMAPHORE_HANDLE semaphore)
Default host semaphore signal function for SDHCI host controllers.
void STDCALL(* sdhci_host_write_long_proc)(SDHCI_HOST *sdhci, uint32_t reg, uint32_t value)
Definition mmc.h:2255
uint32_t STDCALL sdhci_host_state_to_notification(uint32_t state)
Convert a Host state value into the notification code for device notifications.
uint32_t STDCALL sdio_device_enable_wide_bus(MMC_DEVICE *mmc)
uint32_t STDCALL sdio_driver_register(SDIO_DRIVER *driver)
Register a new Driver in the SDIO Driver table.
uint32_t STDCALL sd_device_decode_sd_switch(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_status_to_string(uint32_t status, char *string, uint32_t len)
Translates an MMC status code into a string describing it.
uint32_t STDCALL mmc_device_deselect_card(MMC_DEVICE *mmc)
struct _SDHCI_ADMA2_DESCRIPTOR64 SDHCI_ADMA2_DESCRIPTOR64
Definition mmc.h:2216
uint32_t STDCALL mmc_device_switch_ex(MMC_DEVICE *mmc, uint8_t setting, uint8_t index, uint8_t value, uint32_t timeout, uint32_t timing, BOOL sendstatus, BOOL retrycrcerror)
Modifies an Extended CSD register for the specificed MMC device.
uint32_t STDCALL sdhci_host_transfer_dma(SDHCI_HOST *sdhci)
Default DMA transfer function for SDHCI host controllers.
uint32_t STDCALL sd_get_scr_value(MMC_DEVICE *mmc, uint32_t value)
Extract an SCR field value from the 64 bit SD Configuration register.
SDHCI_HOST *STDCALL sdhci_host_check(SDHCI_HOST *sdhci)
Check if the supplied SDHCI is in the SDHCI table.
uint32_t STDCALL mmc_device_send_card_identification(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_device_notification(MMC_DEVICE *mmc, mmc_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
uint32_t STDCALL(* mmc_device_get_card_detect_proc)(MMC_DEVICE *mmc)
Definition mmc.h:2041
uint32_t STDCALL sd_device_set_bus_width(MMC_DEVICE *mmc, uint32_t width)
uint32_t STDCALL mmc_bus_width_to_string(uint32_t buswidth, char *string, uint32_t len)
Translates an MMC bus width into a string.
struct _SDHCI_ADMA2_DESCRIPTOR32 SDHCI_ADMA2_DESCRIPTOR32
Definition mmc.h:2205
struct _SDHCI_ADMA2_DESCRIPTOR64_V4 SDHCI_ADMA2_DESCRIPTOR64_V4
Definition mmc.h:2226
uint32_t STDCALL sd_device_decode_card_identification(MMC_DEVICE *mmc)
Given a 128-bit response, decode to our card CID structure.
uint32_t STDCALL sdio_function_disable(SDIO_FUNCTION *func)
uint32_t STDCALL(* sdhci_host_set_power_proc)(SDHCI_HOST *sdhci, uint16_t power)
Definition mmc.h:2258
uint32_t STDCALL sd_device_send_sd_switch(MMC_DEVICE *mmc)
uint32_t STDCALL mmc_device_insert(MMC_DEVICE *mmc)
struct _SD_SWITCH_DATA SD_SWITCH_DATA
Definition mmc.h:1982
uint32_t STDCALL(* sdio_driver_unbind_proc)(MMC_DEVICE *mmc, SDIO_FUNCTION *func)
Definition mmc.h:2187
uint32_t STDCALL sdio_device_read_fbr(SDIO_FUNCTION *func)
uint32_t STDCALL sdhci_host_finish_command(SDHCI_HOST *sdhci)
Default finish command function for SDHCI host controllers Called by Interrupt Command handler when a...
uint32_t STDCALL sd_get_ssr_value(MMC_DEVICE *mmc, uint32_t value)
Extract an SCR field value from the 512 bit SD Status register.
#define SDIO_MAX_FUNCTIONS
Definition mmc.h:1372
uint32_t STDCALL sd_device_get_card_identification(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_host_prepare_dma(SDHCI_HOST *sdhci, MMC_COMMAND *command)
Default DMA transfer prepare function for SDHCI host controllers.
uint32_t STDCALL mmc_signal_voltage_to_string(uint32_t signalvoltage, char *string, uint32_t len)
Translates an MMC signal voltage into a string.
uint32_t STDCALL sdhci_host_state_to_string(uint32_t sdhcistate, char *name, uint32_t len)
uint32_t STDCALL mmc_device_set_relative_address(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_host_unlock(SDHCI_HOST *sdhci)
Default host unlock function for SDHCI host controllers.
uint32_t STDCALL(* sdhci_host_set_clock_proc)(SDHCI_HOST *sdhci, uint32_t clock)
Definition mmc.h:2259
SDIO_DRIVER *STDCALL sdio_driver_create_ex(uint32_t size)
Create a new SDIO Driver entry.
uint32_t STDCALL mmc_device_decode_card_identification(MMC_DEVICE *mmc)
Given a 128-bit response, decode to our card CID structure.
uint32_t STDCALL sdio_function_state_to_string(uint32_t sdiostate, char *string, uint32_t len)
uint32_t STDCALL sdhci_host_complete_card_irq(SDHCI_HOST *sdhci)
Default Card IRQ completion function for SDHCI host controllers.
uint32_t STDCALL sdio_function_deregister_interrupt(SDIO_FUNCTION *func)
uint32_t STDCALL sd_device_send_sd_status(MMC_DEVICE *mmc)
uint32_t STDCALL sdhci_host_set_clock(SDHCI_HOST *sdhci, uint32_t clock)
Default set clock function for SDHCI host controllers.
MMC_DEVICE *STDCALL sdio_function_get_mmc(SDIO_FUNCTION *func)
BOOL STDCALL mmc_has_auto_block_count(MMC_DEVICE *mmc)
uint32_t STDCALL sd_version_to_string(uint32_t version, char *string, uint32_t len)
Translates an SD version into a string.
uint32_t STDCALL sdio_function_release(SDIO_FUNCTION *func)
uint32_t STDCALL sdhci_host_enumerate(sdhci_enumerate_cb callback, void *data)
uint32_t STDCALL sdio_device_reset(MMC_DEVICE *mmc)
Device Methods.
struct _SDIO_DRIVER SDIO_DRIVER
Forward declared to satisfy SDIOFunction.
Definition mmc.h:2152
uint32_t STDCALL sdio_device_get_max_clock(MMC_DEVICE *mmc)
Determine the Maximum Clock (DTR) for the current SDIO device.
uint32_t STDCALL mmc_device_state_to_notification(uint32_t state)
Convert a Device state value into the notification code for device notifications.
uint32_t STDCALL sd_get_cid_value(MMC_DEVICE *mmc, uint32_t value)
Extract a CID field value from the 128 bit Card Identification register.
uint32_t STDCALL sdhci_host_type_to_string(uint32_t sdhcitype, char *name, uint32_t len)
uint32_t STDCALL mmc_device_destroy(MMC_DEVICE *mmc)
Destroy an existing MMC entry.
uint16_t STDCALL sdhci_host_read_word(SDHCI_HOST *sdhci, uint32_t reg)
Default read word function for SDHCI host controllers.
BOOL STDCALL sdhci_auto_cmd12(SDHCI_HOST *sdhci)
struct _STORAGE_DEVICE STORAGE_DEVICE
Definition storage.h:90
uint8_t manufacturerid
Definition mmc.h:1789
uint8_t firmwarerevision
Definition mmc.h:1794
uint8_t manufacturingmonth
Definition mmc.h:1796
uint8_t productrevision
Definition mmc.h:1792
char productname[8]
Max 0 to 6, 1 extra for null terminator.
Definition mmc.h:1791
uint8_t crc
CRC7 checksum.
Definition mmc.h:1798
uint16_t oemid
Definition mmc.h:1790
uint32_t productserialnumber
Definition mmc.h:1795
uint8_t hardwarerevision
Definition mmc.h:1793
uint16_t manufacturingyear
Definition mmc.h:1797
MMC_CARD_SPECIFIC_ERASE_DATA erase
Erase group details.
Definition mmc.h:1854
BOOL writeprotectgroupenable
Write protect group enable.
Definition mmc.h:1856
uint8_t vddwritecurrentmax
Max. write current @VDD max.
Definition mmc.h:1852
uint32_t dataaccesstime
In Nanoseconds.
Definition mmc.h:1870
uint32_t blockshift
"Normalized" Block Shift
Definition mmc.h:1876
uint32_t blockcount
In "Normalized" Blocks.
Definition mmc.h:1875
BOOL dsrimplemented
DSR implemented.
Definition mmc.h:1847
BOOL temporarywriteprotect
Temporary write protection.
Definition mmc.h:1865
uint32_t erasesize
In Sectors.
Definition mmc.h:1873
BOOL copyflag
Copy flag.
Definition mmc.h:1863
BOOL writeblockpartial
Partial blocks for write allowed.
Definition mmc.h:1860
uint8_t vddwritecurrentmin
Max. write current @VDD min.
Definition mmc.h:1851
uint8_t writeblocklength
Max. write data block length.
Definition mmc.h:1859
uint32_t blocksize
"Normalized" Block Size
Definition mmc.h:1874
uint8_t fileformat
File format.
Definition mmc.h:1866
uint8_t specversion
System specification version (MMC/eMMC Only).
Definition mmc.h:1838
uint8_t fileformatgroup
File format group.
Definition mmc.h:1862
BOOL permanentwriteprotect
Permanent write protection.
Definition mmc.h:1864
uint8_t vddreadcurrentmin
Max. read current @VDD min.
Definition mmc.h:1849
uint8_t defaultecc
Manufacturer default ECC (MMC/eMMC Only).
Definition mmc.h:1857
uint16_t ccc
Card command classes.
Definition mmc.h:1842
BOOL contentprotectapplication
Content protection application (MMC/eMMC Only).
Definition mmc.h:1861
uint8_t devicesizemultiplier
Device size multiplier.
Definition mmc.h:1853
uint8_t readblocklength
Max. read data block length.
Definition mmc.h:1843
BOOL readblockmisalign
Read block misalignment.
Definition mmc.h:1846
BOOL readblockpartial
Partial blocks for read allowed.
Definition mmc.h:1844
uint8_t vddreadcurrentmax
Max. read current @VDD max.
Definition mmc.h:1850
uint32_t datatransferrate
In Hz.
Definition mmc.h:1872
uint8_t crc
CRC.
Definition mmc.h:1868
uint8_t readtowritefactor
Write speed factor.
Definition mmc.h:1858
uint16_t devicesize
Device size.
Definition mmc.h:1848
uint16_t dataaccessclocks
In Clock cycles.
Definition mmc.h:1871
uint8_t ecc
ECC code (MMC/eMMC Only).
Definition mmc.h:1867
uint8_t writeprotectgroupsize
Write protect group size.
Definition mmc.h:1855
uint8_t csdstructure
CSD structure version.
Definition mmc.h:1837
BOOL writeblockmisalign
Write block misalignment.
Definition mmc.h:1845
uint8_t sectorsize
Erase sector size.
Definition mmc.h:1810
uint8_t erasegroupsize
Erase group size.
Definition mmc.h:1811
uint8_t erasegroupmultiplier
Erase group size multiplier.
Definition mmc.h:1817
uint8_t erasegroupsize
Erase group size.
Definition mmc.h:1816
BOOL eraseblockenable
Erase single block enable.
Definition mmc.h:1804
uint8_t sectorsize
Erase sector size.
Definition mmc.h:1805
BOOL tuningcompleted
Definition mmc.h:1766
BOOL datacompleted
Definition mmc.h:1764
uint16_t command
Definition mmc.h:1756
uint32_t argument
Definition mmc.h:1757
uint32_t responsetype
Definition mmc.h:1758
MMC_DATA * data
Definition mmc.h:1761
uint32_t timeout
Milliseconds.
Definition mmc.h:1762
BOOL commandcompleted
Definition mmc.h:1767
uint32_t status
Definition mmc.h:1760
BOOL busycompleted
Definition mmc.h:1765
uint32_t response[4]
Definition mmc.h:1759
uint32_t blocksremaining
Definition mmc.h:1780
uint32_t blockcount
Definition mmc.h:1777
uint32_t blockoffset
Definition mmc.h:1779
uint32_t blocksize
Definition mmc.h:1776
void * data
Definition mmc.h:1774
uint32_t flags
Definition mmc.h:1775
uint32_t bytestransfered
Definition mmc.h:1782
uint32_t bytesremaining
Definition mmc.h:1781
uint32_t driverstage
Driver Stage Register (DSR) (Word).
Definition mmc.h:2086
uint32_t capabilities
Definition mmc.h:2071
uint32_t commanderrors
Definition mmc.h:2061
uint32_t relativecardaddress
Relative Card Address (RCA) (Word).
Definition mmc.h:2081
LONGBOOL enhancedstrobe
Definition mmc.h:2077
MUTEX_HANDLE lock
Device lock.
Definition mmc.h:2063
uint32_t eraseargument
Definition mmc.h:2075
uint32_t commandcount
Definition mmc.h:2060
uint32_t erasesize
Erase Size in Sectors.
Definition mmc.h:2073
uint32_t cardspecific[4]
Card Specific Data (CSD).
Definition mmc.h:2082
mmc_device_get_card_detect_proc devicegetcarddetect
A Device specific DeviceGetCardDetect method implementing a standard MMC device interface (Or nil if ...
Definition mmc.h:2055
uint32_t sdstatus[16]
SD Status Register (SSR).
Definition mmc.h:2087
DEVICE device
The Device entry for this MMC.
Definition mmc.h:2049
SDIO_TUPLE * tuples
SDIO CIS (Card Information Structure) tuples on this MMC.
Definition mmc.h:2100
MMC_EXTENDED_CARD_SPECIFIC_DATA extendedcardspecificdata
Definition mmc.h:2093
uint32_t drivertype
Definition mmc.h:2068
mmc_device_get_write_protect_proc devicegetwriteprotect
A Device specific DeviceGetWriteProtect method implementing a standard MMC device interface (Or nil i...
Definition mmc.h:2056
uint32_t cardstatus
Card Status Register (CSR).
Definition mmc.h:2085
uint8_t * extendedcardspecific
Extended Card Specific Data (EXTCSD).
Definition mmc.h:2084
mmc_device_deinitialize_proc devicedeinitialize
A Device specific DeviceDeinitialize method implementing a standard MMC device interface (Or nil if t...
Definition mmc.h:2054
uint32_t operationcondition
Operation Condition Register (OCR).
Definition mmc.h:2080
uint32_t mmcstate
MMC state (eg MMC_STATE_INSERTED).
Definition mmc.h:2052
SD_STATUS_DATA sdstatusdata
Definition mmc.h:2094
uint32_t cardidentification[4]
Card Identification Data (CID).
Definition mmc.h:2083
mmc_device_set_ios_proc devicesetios
A Device specific DeviceSetIOS method implementing a standard MMC device interface (Or nil if the def...
Definition mmc.h:2058
MMC_CARD_SPECIFIC_DATA cardspecificdata
Definition mmc.h:2091
MMC_DEVICE * next
Next entry in MMC table.
Definition mmc.h:2108
uint32_t preferrederasesize
Preferred Erase Size in Sectors.
Definition mmc.h:2076
uint32_t eraseshift
Definition mmc.h:2074
uint32_t buswidth
Definition mmc.h:2067
uint32_t interfacecondition
Interface Condition Result.
Definition mmc.h:2079
uint32_t sdiocount
SDIO function count for this MMC (Where Applicable).
Definition mmc.h:2101
MMC_DEVICE * prev
Previous entry in MMC table.
Definition mmc.h:2107
MMC_CARD_IDENTIFICATION_DATA cardidentificationdata
Definition mmc.h:2092
mmc_device_send_command_proc devicesendcommand
A Device specific DeviceSendCommand method implementing a standard MMC device interface (Or nil if th...
Definition mmc.h:2057
uint32_t sdconfiguration[2]
SD Configuration Register (SCR).
Definition mmc.h:2089
uint32_t timing
Definition mmc.h:2066
SDIO_CIS * cis
SDIO Common CIS (Card Information Structure) Information.
Definition mmc.h:2099
SD_CONFIGURATION_DATA sdconfigurationdata
Definition mmc.h:2096
uint32_t clock
Definition mmc.h:2065
SD_SWITCH_DATA sdswitchdata
Definition mmc.h:2095
uint32_t capabilities2
Definition mmc.h:2072
SDIO_CCCR * cccr
SDIO Common Card Register Information.
Definition mmc.h:2098
uint32_t mmcid
Unique Id of this MMC in the MMC table.
Definition mmc.h:2051
uint32_t version
Definition mmc.h:2064
uint32_t sdswitch[16]
SD Switch Status.
Definition mmc.h:2088
STORAGE_DEVICE * storage
The Storage entry for this MMC (Where Applicable).
Definition mmc.h:2105
uint32_t voltages
Definition mmc.h:2070
uint32_t signalvoltage
Definition mmc.h:2069
SDIO_FUNCTION * sdiointerruptfunction
SDIO function for all interrupts (If only one interrupt is registered).
Definition mmc.h:2103
SDIO_FUNCTION * sdiofunctions[SDIO_MAX_FUNCTIONS]
SDIO functions on this MMC (Where Applicable).
Definition mmc.h:2102
mmc_device_initialize_proc deviceinitialize
A Device specific DeviceInitialize method implementing a standard MMC device interface (Or nil if the...
Definition mmc.h:2053
uint8_t poweroffnotification
Power Off Notification (34).
Definition mmc.h:1885
uint8_t erasegroupdef
High-density erase group definition (175).
Definition mmc.h:1890
BOOL enhancedrpmbsupport
Definition mmc.h:1956
uint32_t cachesize
KB.
Definition mmc.h:1940
uint8_t powerclass52mhz195
Power class for 52 MHz at 1.95 V (200).
Definition mmc.h:1908
uint64_t enhancedareasize
KB.
Definition mmc.h:1939
BOOL commandqueuesupport
Command Queue supported.
Definition mmc.h:1947
uint32_t datasectorsize
512 bytes or 4KB
Definition mmc.h:1932
uint8_t hcerasegapsize
High-capacity write protect group size (221).
Definition mmc.h:1900
uint8_t powerclass200mhz360
Power class for 200MHz at VCCQ = 1.95V, VCC = 3.6V (237).
Definition mmc.h:1913
uint8_t erasedmemorycontent
Erased memory content (181).
Definition mmc.h:1892
BOOL manualbkopsenable
Manual BKOPS Supported.
Definition mmc.h:1950
BOOL backgroundoperations
BKOPS Supported.
Definition mmc.h:1949
uint8_t partitionsupport
Partitioning Support (160).
Definition mmc.h:1886
uint32_t featuresupport
Version specific features (eg MMC_DISCARD_FEATURE).
Definition mmc.h:1958
uint8_t outofinterrupttime
Out-of-interrupt busy timing (198).
Definition mmc.h:1897
uint8_t erasetimeoutmult
High-capacity erase timeout (223).
Definition mmc.h:1902
uint32_t hcerasesize
Sectors.
Definition mmc.h:1930
uint32_t genericcmd6time
10ms units
Definition mmc.h:1928
uint32_t hcerasetimeout
Milliseconds.
Definition mmc.h:1931
uint8_t powerclassddr52mhz360
Power class for 52MHz, DDR at VCC = 3.6V (239).
Definition mmc.h:1915
uint8_t reliablesectors
Reliable write sector count (222).
Definition mmc.h:1901
uint8_t secfeaturesupport
Secure Feature support (231).
Definition mmc.h:1906
uint32_t partitionswitchtime
ms
Definition mmc.h:1927
uint8_t trimmult
TRIM Multiplier (232).
Definition mmc.h:1907
uint8_t maxpackedreads
Max packed read commands (501]).
Definition mmc.h:1923
uint8_t hardwareresetfunction
H/W reset function (162]).
Definition mmc.h:1887
uint8_t powerclass52mhz360
Power class for 52 MHz at 3.6 V (202).
Definition mmc.h:1910
uint32_t hsmaxrate
Hz.
Definition mmc.h:1934
uint8_t cachecontrol
Control to turn the Cache ON/OFF (33).
Definition mmc.h:1884
uint32_t availabletypes
Definition mmc.h:1936
uint32_t commandqueuedepth
Command Queue depth.
Definition mmc.h:1948
uint32_t sleepawaketime
100ns units
Definition mmc.h:1926
uint8_t erasedbyte
Value after Erase.
Definition mmc.h:1957
uint32_t hs200maxrate
Hz.
Definition mmc.h:1935
uint8_t secerasemult
Secure Erase Multiplier (230).
Definition mmc.h:1905
uint8_t partconfig
Partition configuration (179).
Definition mmc.h:1891
uint32_t sectors
Definition mmc.h:1925
BOOL hpienable
HPI Enabled.
Definition mmc.h:1953
uint8_t firmwareversion[MMC_FIRMWARE_VERSION_LEN]
(254) (8 bytes)
Definition mmc.h:1918
BOOL partitionsettingcompleted
Enable Bit.
Definition mmc.h:1941
uint64_t partitionsizes[MMC_NUM_GP_PARTITION]
Bytes.
Definition mmc.h:1943
uint8_t writereliabilityparameter
Write reliability parameter register (166]).
Definition mmc.h:1888
BOOL fieldfirmwareupdate
Firmware upgrade support.
Definition mmc.h:1946
uint64_t enhancedareaoffset
Bytes.
Definition mmc.h:1938
uint32_t datatagunitsize
Definition mmc.h:1933
BOOL hpi
HPI (High Priority Interrupt) Supported.
Definition mmc.h:1952
BOOL bootreadonlylockable
Definition mmc.h:1945
uint32_t hpicommand
CMD used as HPI.
Definition mmc.h:1954
uint8_t powerclass200mhz195
Power class for 200MHz, at VCCQ = 1.3V, VCC = 3.6V (236).
Definition mmc.h:1912
uint8_t powerclassddr200mhz360
Power class for 200MHz, DDR at VCC = 3.6V (253).
Definition mmc.h:1916
uint8_t cardtype
Device type (196).
Definition mmc.h:1895
uint8_t revision
Extended CSD revision (192).
Definition mmc.h:1883
uint8_t powerclass26mhz360
Power class for 26 MHz at 3.6 V (203).
Definition mmc.h:1911
uint32_t powerofflongtime
ms
Definition mmc.h:1929
uint8_t sectorcount[4]
Sector Count (212)(4 bytes).
Definition mmc.h:1898
BOOL autobkopsenable
Auto BKOPS Supported.
Definition mmc.h:1951
uint8_t devicelifetimeestimatea
Device life time estimation type A (268).
Definition mmc.h:1920
uint32_t trimtimeout
Milliseconds.
Definition mmc.h:1942
uint64_t rpmbsize
Bytes.
Definition mmc.h:1955
uint8_t maxpackedwrites
Max packed write commands (500).
Definition mmc.h:1922
uint8_t powerclassddr52mhz195
Power class for 52MHz, DDR at VCC = 1.95V (238).
Definition mmc.h:1914
uint32_t bootreadonlysupport
Read Only Lock Support.
Definition mmc.h:1944
uint8_t bkopsstatus
Background operations status (246).
Definition mmc.h:1917
uint8_t sectrimmult
Secure TRIM Multiplier (229).
Definition mmc.h:1904
uint64_t bootpartitionsize
Bytes.
Definition mmc.h:1937
uint8_t rpmbsizemult
RPMB Size Multiplier (168).
Definition mmc.h:1889
uint8_t satimeout
Sleep/awake timeout (217).
Definition mmc.h:1899
uint8_t strobesupport
Strobe Support (184).
Definition mmc.h:1893
uint8_t preendoflifeinfo
Pre EOL information (267).
Definition mmc.h:1919
uint8_t csdstructure
CSD STRUCTURE (194).
Definition mmc.h:1894
uint8_t powerclass26mhz195
Power class for 26 MHz at 1.95 V (201).
Definition mmc.h:1909
uint8_t hcerasegrpsize
High-capacity erase unit size (224).
Definition mmc.h:1903
uint8_t devicelifetimeestimateb
Device life time estimation type B (269).
Definition mmc.h:1921
uint8_t driverstrength
I/O Driver Strength (197).
Definition mmc.h:1896
uint16_t command
Definition mmc.h:2208
uint16_t len
Definition mmc.h:2209
uint32_t address
Definition mmc.h:2210
uint16_t command
Definition mmc.h:2229
uint32_t addresshigh
Definition mmc.h:2232
uint32_t addresslow
Definition mmc.h:2231
uint16_t len
Definition mmc.h:2230
uint32_t reserved
Definition mmc.h:2233
uint16_t command
Definition mmc.h:2219
uint32_t addresshigh
Definition mmc.h:2222
uint32_t addresslow
Definition mmc.h:2221
uint16_t len
Definition mmc.h:2220
uint32_t capabilities
Host configured capabilities flags.
Definition mmc.h:2320
sdhci_host_read_byte_proc hostreadbyte
A Host specific HostReadByte method implementing a standard SDHCI host interface (Or nil if the defau...
Definition mmc.h:2282
sdhci_host_stop_proc hoststop
A Host specific HostStop method implementing a standard SDHCI host interface.
Definition mmc.h:2278
LONGBOOL cardirqenabled
SDIO card interrupt is enabled.
Definition mmc.h:2332
sdhci_host_write_long_proc hostwritelong
A Host specific HostWriteLong method implementing a standard SDHCI host interface (Or nil if the defa...
Definition mmc.h:2287
MUTEX_HANDLE lock
Host lock (Mutex) for use by other functions.
Definition mmc.h:2309
sdhci_host_prepare_dma_proc hostpreparedma
A Host specific HostPrepareDMA method implementing a standard SDHCI host interface (Or nil if the def...
Definition mmc.h:2296
uint32_t sdhciid
Unique Id of this SDHCI in the SDHCI table.
Definition mmc.h:2275
sdhci_host_set_power_proc hostsetpower
A Host specific HostSetPower method implementing a standard SDHCI host interface (Or nil if the defau...
Definition mmc.h:2290
uint32_t cardirqcount
SDIO card interrupt function registered count.
Definition mmc.h:2335
uint32_t admabuffersize
ADMA alignment buffers size in bytes (If applicable).
Definition mmc.h:2349
uint32_t datarequestcount
Number of data requests that have been submitted to this host.
Definition mmc.h:2362
uint32_t requestcount
Number of requests that have been submitted to this host.
Definition mmc.h:2360
uint32_t minimumdmasize
Minimum size for DMA read or write (Use PIO if less).
Definition mmc.h:2329
sdhci_host_set_clock_proc hostsetclock
A Host specific HostSetClock method implementing a standard SDHCI host interface (Or nil if the defau...
Definition mmc.h:2291
sdhci_host_set_buswidth_proc hostsetbuswidth
A Host specific HostSetBusWidth method implementing a standard SDHCI host interface (Or nil if the de...
Definition mmc.h:2293
uint32_t maximumrequestsize
Host configured maximum request size.
Definition mmc.h:2327
MMC_DEVICE * cardirqdevice
SDIO card interrupt device.
Definition mmc.h:2334
uint32_t interruptcount
Number of interrupt requests received by the host.
Definition mmc.h:2366
uint32_t sdmaboundary
SDMA buffer boundary argument.
Definition mmc.h:2344
sdhci_host_complete_card_irq_proc hostcompletecardirq
A Host specific HostCompleteCardIRQ method implementing a standard SDHCI host interface (Or nil if th...
Definition mmc.h:2300
mmc_device_get_card_detect_proc devicegetcarddetect
A Device specific DeviceGetCardDetect method implementing a standard MMC device interface (Or nil if ...
Definition mmc.h:2303
uint32_t maximumblockcount
Host configured maximum block count.
Definition mmc.h:2326
DEVICE device
The Device entry for this SDHCI.
Definition mmc.h:2273
mmc_device_get_write_protect_proc devicegetwriteprotect
A Device specific DeviceGetWriteProtect method implementing a standard MMC device interface (Or nil i...
Definition mmc.h:2304
sdhci_host_reset_proc hostreset
A Host specific HostReset method implementing a standard SDHCI host interface (Or nil if the default ...
Definition mmc.h:2288
mmc_device_deinitialize_proc devicedeinitialize
A Device specific DeviceDeinitialize method implementing a standard MMC device interface (Or nil if t...
Definition mmc.h:2302
sdhci_host_set_control_register_proc hostsetcontrolregister
Definition mmc.h:2295
SDHCI_HOST * next
Next entry in SDHCI table.
Definition mmc.h:2371
mmc_device_set_ios_proc devicesetios
A Device specific DeviceSetIOS method implementing a standard MMC device interface (Or nil if the def...
Definition mmc.h:2306
sdhci_host_lock_proc hostlock
A Host specific HostLock method implementing a standard SDHCI host interface.
Definition mmc.h:2279
sdhci_host_start_dma_proc hoststartdma
A Host specific HostStartDMA method implementing a standard SDHCI host interface (Or nil if the defau...
Definition mmc.h:2297
uint32_t dmaslave
External DMA slave (DREQ) Id for this device (If applicable).
Definition mmc.h:2341
SPIN_HANDLE spin
Host lock (Spin) for use by interrupt handlers.
Definition mmc.h:2308
uint32_t clockmaximum
Host predefined maximum clock frequency.
Definition mmc.h:2356
SDHCI_ADMA2_DESCRIPTOR64_V4 * admatable
ADMA descriptors for current request (If applicable).
Definition mmc.h:2345
uint32_t maximumfrequency
Host configured maximum frequency (Hz).
Definition mmc.h:2324
uint32_t buswidth
Host current bus width.
Definition mmc.h:2317
void * dmabuffer
DMA bounce buffer for the current request (If applicable).
Definition mmc.h:2342
sdhci_host_write_word_proc hostwriteword
A Host specific HostWriteWord method implementing a standard SDHCI host interface (Or nil if the defa...
Definition mmc.h:2286
DMA_DATA dmadata
External DMA data descriptor for current request (If applicable).
Definition mmc.h:2339
uint32_t admatablecount
ADMA descriptor table entry count (If applicable).
Definition mmc.h:2348
uint32_t admadescriptorsize
ADMA descriptor size in bytes (If applicable).
Definition mmc.h:2350
uint32_t piodatatransfercount
Number of data requests that have been submitted for PIO transfer on this host.
Definition mmc.h:2364
WORKER_HANDLE cardirqworker
SDIO card interrupt current worker.
Definition mmc.h:2333
mmc_device_send_command_proc devicesendcommand
A Device specific DeviceSendCommand method implementing a standard MMC device interface (Or nil if th...
Definition mmc.h:2305
sdhci_host_unlock_proc hostunlock
A Host specific HostUnlock method implementing a standard SDHCI host interface.
Definition mmc.h:2280
SEMAPHORE_HANDLE dmawait
External DMA completed semaphore.
Definition mmc.h:2340
uint32_t dmadatatransfercount
Number of data requests that have been submitted for DMA transfer on this host.
Definition mmc.h:2365
uint32_t dmadirection
DMA data direction for current request (If applicable).
Definition mmc.h:2343
sdhci_host_setup_card_irq_proc hostsetupcardirq
A Host specific HostSetupCardIRQ method implementing a standard SDHCI host interface (Or nil if the d...
Definition mmc.h:2299
LONGBOOL usedma
Use DMA for the current data transfer.
Definition mmc.h:2338
uint32_t commandinterruptcount
Number of command interrupt requests received by the host.
Definition mmc.h:2368
void * admabuffer
ADMA alignment buffers for the current request (If applicable).
Definition mmc.h:2346
sdhci_host_read_word_proc hostreadword
A Host specific HostReadWord method implementing a standard SDHCI host interface (Or nil if the defau...
Definition mmc.h:2283
uint32_t presetvoltages
Host predefined voltage flags.
Definition mmc.h:2352
uint32_t presetcapabilities2
Host predefined additional capabilities flags.
Definition mmc.h:2354
sdhci_host_start_proc hoststart
A Host specific HostStart method implementing a standard SDHCI host interface.
Definition mmc.h:2277
sdhci_host_write_byte_proc hostwritebyte
A Host specific HostWriteByte method implementing a standard SDHCI host interface (Or nil if the defa...
Definition mmc.h:2285
uint32_t timing
Host current timing.
Definition mmc.h:2316
void * address
Host register base address.
Definition mmc.h:2310
uint32_t commandrequestcount
Number of command requests that have been submitted to this host.
Definition mmc.h:2363
sdhci_host_hardware_reset_proc hosthardwarereset
A Host specific HostHardwareReset method implementing a standard SDHCI host interface (Or nil if the ...
Definition mmc.h:2289
sdhci_host_read_long_proc hostreadlong
A Host specific HostReadLong method implementing a standard SDHCI host interface (Or nil if the defau...
Definition mmc.h:2284
uint32_t clock
Host current clock.
Definition mmc.h:2314
uint32_t capabilities2
Host configured additional capabilities flags.
Definition mmc.h:2321
uint32_t driverstageregister
Host predefined driver stage register (DSR).
Definition mmc.h:2357
uint32_t version
Host version information.
Definition mmc.h:2311
sdhci_host_signal_proc hostsignal
A Host specific HostSignal method implementing a standard SDHCI host interface.
Definition mmc.h:2281
LONGBOOL presetenabled
Version 3.00 Preset Values Enabled (If applicable).
Definition mmc.h:2331
SEMAPHORE_HANDLE wait
Command completed semaphore.
Definition mmc.h:2337
uint32_t clockminimum
Host predefined minimum clock frequency.
Definition mmc.h:2355
uint32_t maximumbusytimeout
Host configured maximum busy timeout (Milliseconds).
Definition mmc.h:2328
uint32_t voltages
Host configured voltage flags.
Definition mmc.h:2319
uint32_t minimumfrequency
Host configured minimum frequency (Hz).
Definition mmc.h:2323
sdhci_host_stop_dma_proc hoststopdma
A Host specific HostStopDMA method implementing a standard SDHCI host interface (Or nil if the defaul...
Definition mmc.h:2298
uint32_t quirks2
Host additional quirks/bugs flags.
Definition mmc.h:2313
LONGBOOL enablev4mode
Enable SDHCI version 4 protocol support.
Definition mmc.h:2358
uint32_t admatablesize
ADMA descriptor table size in bytes (If applicable).
Definition mmc.h:2347
uint32_t presetcapabilities
Host predefined capabilities flags.
Definition mmc.h:2353
uint32_t requesterrors
Number of requests that have failed on this host.
Definition mmc.h:2361
uint32_t interrupts
Host interrupts to be handled.
Definition mmc.h:2318
SDHCI_HOST * prev
Previous entry in SDHCI table.
Definition mmc.h:2370
sdhci_host_set_timing_proc hostsettiming
A Host specific HostSetTiming method implementing a standard SDHCI host interface (Or nil if the defa...
Definition mmc.h:2292
uint32_t maximumpioblocks
Maximum blocks for PIO read or write (Use DMA if greater).
Definition mmc.h:2330
sdhci_host_set_clock_divider_proc hostsetclockdivider
Definition mmc.h:2294
uint32_t timeoutfrequency
Host configured timeout clock frequency (KHz).
Definition mmc.h:2322
uint32_t sdhcistate
SDHCI state (eg SDHCI_STATE_ENABLED).
Definition mmc.h:2276
uint32_t power
Host current power.
Definition mmc.h:2315
uint32_t maximumblocksize
Host configured maximum block size.
Definition mmc.h:2325
uint32_t datainterruptcount
Number of data interrupt requests received by the host.
Definition mmc.h:2367
mmc_device_initialize_proc deviceinitialize
A Device specific DeviceInitialize method implementing a standard MMC device interface (Or nil if the...
Definition mmc.h:2301
MMC_COMMAND * command
Currently processing command.
Definition mmc.h:2336
uint32_t quirks
Host quirks/bugs flags.
Definition mmc.h:2312
uint8_t sdversion
SD Specification Version (04h).
Definition mmc.h:2119
uint8_t sdioversion
SDIO Specification Version (00h).
Definition mmc.h:2118
BOOL multiblock
Card Capability Multi Block Transfer (SMB).
Definition mmc.h:2126
uint8_t cccrbusspeed
CCCR Bus Speed Select Register (13h).
Definition mmc.h:2122
uint8_t cccrcapabilities
CCCR Capabilities Register (08h).
Definition mmc.h:2120
BOOL highspeed
Support High Speed (SHS).
Definition mmc.h:2130
BOOL lowspeed
Card Capability Low Speed Card (LSC).
Definition mmc.h:2127
uint8_t cccrdriverstrength
CCCR Driver Strength Register (15h).
Definition mmc.h:2124
BOOL widebus
Card Capability 4-bit Mode for Low Speed Card (4BLS).
Definition mmc.h:2128
uint8_t cccrversion
CCCR (Card Common Control Register) Version (00h).
Definition mmc.h:2117
uint8_t cccruhssupport
CCCR UHS-I Support Register (14h).
Definition mmc.h:2123
BOOL highpower
Support Master Power Control (SMPC).
Definition mmc.h:2129
uint8_t cccrpowercontrol
CCCR Power Control Register (12h).
Definition mmc.h:2121
uint32_t maxclock
Definition mmc.h:2139
uint16_t vendor
Definition mmc.h:2136
uint16_t device
Definition mmc.h:2137
uint16_t blocksize
Definition mmc.h:2138
MUTEX_HANDLE lock
Driver lock.
Definition mmc.h:2197
DRIVER driver
The Driver entry for this SDIO Driver.
Definition mmc.h:2192
SDIO_DRIVER * prev
Previous entry in Driver table.
Definition mmc.h:2199
SDIO_DRIVER * next
Next entry in Driver table.
Definition mmc.h:2200
sdio_driver_unbind_proc driverunbind
A Driver specific DriverUnbind method implementing the standard SDIO driver interface.
Definition mmc.h:2195
sdio_driver_bind_proc driverbind
A Driver specific DriverBind method implementing the standard SDIO driver interface.
Definition mmc.h:2194
sdio_interrupt_handler handler
Interrupt handler for this function.
Definition mmc.h:2173
uint32_t enabletimeout
Function enable timeout.
Definition mmc.h:2172
SDIO_TUPLE * tuples
CIS (Card Information Structure) tuples for this function.
Definition mmc.h:2175
uint32_t maxblocksize
Maximum block size.
Definition mmc.h:2171
SDIO_DRIVER * driver
Driver this function is bound to, if any.
Definition mmc.h:2176
uint32_t blocksize
Current block size.
Definition mmc.h:2170
void * dmabuffer
DMA compatible buffer for small reads and writes.
Definition mmc.h:2174
uint16_t deviceid
Device Id.
Definition mmc.h:2169
void * driverdata
Private data for the driver of this SDIO device.
Definition mmc.h:2177
MMC_DEVICE * mmc
The MMC device for this function.
Definition mmc.h:2165
uint32_t sdiostate
SDIO function state (eg SDIO_STATE_ATTACHED).
Definition mmc.h:2163
uint32_t sdiostatus
SDIO function status (eg SDIO_STATUS_BOUND).
Definition mmc.h:2164
uint16_t vendorid
Vendor Id.
Definition mmc.h:2168
uint32_t number
The function number.
Definition mmc.h:2166
uint8_t classid
Standard class Id.
Definition mmc.h:2167
SDIO_TUPLE * next
Definition mmc.h:2145
uint8_t data[]
Definition mmc.h:2148
uint8_t code
Definition mmc.h:2146
uint8_t size
Definition mmc.h:2147
uint8_t extendedsecurity
Extended Security Support.
Definition mmc.h:2019
BOOL specversion4
Spec. Version 4.00 or higher.
Definition mmc.h:2020
uint8_t buswidths
DAT Bus widths supported.
Definition mmc.h:2017
uint8_t security
CPRM Security Support.
Definition mmc.h:2016
uint8_t erasedbyte
Value after Erase.
Definition mmc.h:2023
uint8_t specversion
SD Memory Card - Spec. Version.
Definition mmc.h:2014
uint8_t dataaftererase
Data status after erases.
Definition mmc.h:2015
uint8_t scrstructure
SCR Structure version.
Definition mmc.h:2013
BOOL specversion3
Spec. Version 3.00 or higher.
Definition mmc.h:2018
uint8_t commandsupport
Command Support bits.
Definition mmc.h:2021
uint8_t erasetimeout
Timeout value for erasing areas specified by UNIT_OF_ERASE_AU.
Definition mmc.h:1973
uint16_t erasesize
Number of AUs to be erased at a time.
Definition mmc.h:1972
uint8_t uhsallocationunitsize
Size of Allocation Unit for UHS mode.
Definition mmc.h:1978
uint16_t cardtype
In the future, the 8 LSBs will be used to define different variations of an SD Memory Card (Each bit ...
Definition mmc.h:1968
uint8_t eraseoffset
Fixed offset value added to erase time.
Definition mmc.h:1974
BOOL securedmode
Card is in Secured Mode of operation (refer to the "Part 3 Security Specification").
Definition mmc.h:1967
uint8_t buswidth
Shows the currently defined data bus width that was defined by SET_BUS_WIDTH command.
Definition mmc.h:1966
uint8_t performancemove
Performance of move indicated by 1 [MB/s] step.
Definition mmc.h:1971
uint8_t allocationunitsize
Size of Allocation Unit.
Definition mmc.h:1977
uint8_t uhsspeedgrade
Speed Grade for UHS mode.
Definition mmc.h:1975
uint8_t speedclass
Speed Class of the card.
Definition mmc.h:1970
uint32_t protectedsize
Size of protected area.
Definition mmc.h:1969
uint16_t maximumcurrent
Maximum Current/Power Consumption.
Definition mmc.h:1986
uint16_t group2busystatus
Busy Status of functions in group 2.
Definition mmc.h:2004
uint16_t group3busystatus
Busy Status of functions in group 3.
Definition mmc.h:2003
uint16_t group4busystatus
Busy Status of functions in group 4.
Definition mmc.h:2002
uint8_t group1selection
Function Selection of Function Group 1.
Definition mmc.h:1998
uint16_t group1busystatus
Busy Status of functions in group 1.
Definition mmc.h:2005
uint16_t group4support
Support Bits of Functions in Function Group 4.
Definition mmc.h:1989
uint16_t group6busystatus
Busy Status of functions in group 6.
Definition mmc.h:2000
uint8_t structureversion
Data Structure Version.
Definition mmc.h:1999
uint16_t group6support
Support Bits of Functions in Function Group 6.
Definition mmc.h:1987
uint16_t group2support
Support Bits of Functions in Function Group 2.
Definition mmc.h:1991
uint16_t group5support
Support Bits of Functions in Function Group 5.
Definition mmc.h:1988
uint16_t group5busystatus
Busy Status of functions in group 5.
Definition mmc.h:2001
uint8_t group3selection
Function Selection of Function Group 3.
Definition mmc.h:1996
uint8_t group6selection
Function Selection of Function Group 6.
Definition mmc.h:1993
uint8_t group5selection
Function Selection of Function Group 5.
Definition mmc.h:1994
uint8_t group2selection
Function Selection of Function Group 2.
Definition mmc.h:1997
uint8_t group4selection
Function Selection of Function Group 4.
Definition mmc.h:1995
uint16_t group3support
Support Bits of Functions in Function Group 3.
Definition mmc.h:1990
uint16_t group1support
Support Bits of Functions in Function Group 1.
Definition mmc.h:1992
MMC_CARD_SPECIFIC_MM_C22_ERASE_DATA MMC22
Definition mmc.h:1823
MMC_CARD_SPECIFIC_MM_C31_ERASE_DATA MMC31
Definition mmc.h:1826
MMC_CARD_SPECIFIC_SD_ERASE_DATA SD
Definition mmc.h:1829