1163516Simp/*- 2163516Simp * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3163516Simp * 4163516Simp * Redistribution and use in source and binary forms, with or without 5163516Simp * modification, are permitted provided that the following conditions 6163516Simp * are met: 7163516Simp * 1. Redistributions of source code must retain the above copyright 8163516Simp * notice, this list of conditions and the following disclaimer. 9163516Simp * 2. Redistributions in binary form must reproduce the above copyright 10163516Simp * notice, this list of conditions and the following disclaimer in the 11163516Simp * documentation and/or other materials provided with the distribution. 12163516Simp * 13163516Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14163516Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15163516Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16163516Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17163516Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18163516Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19163516Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20163516Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21163516Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22163516Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23163516Simp * 24170002Simp * Portions of this software may have been developed with reference to 25170002Simp * the SD Simplified Specification. The following disclaimer may apply: 26170002Simp * 27170002Simp * The following conditions apply to the release of the simplified 28170002Simp * specification ("Simplified Specification") by the SD Card Association and 29170002Simp * the SD Group. The Simplified Specification is a subset of the complete SD 30170002Simp * Specification which is owned by the SD Card Association and the SD 31170002Simp * Group. This Simplified Specification is provided on a non-confidential 32170002Simp * basis subject to the disclaimers below. Any implementation of the 33170002Simp * Simplified Specification may require a license from the SD Card 34170002Simp * Association, SD Group, SD-3C LLC or other third parties. 35170002Simp * 36170002Simp * Disclaimers: 37170002Simp * 38170002Simp * The information contained in the Simplified Specification is presented only 39170002Simp * as a standard specification for SD Cards and SD Host/Ancillary products and 40170002Simp * is provided "AS-IS" without any representations or warranties of any 41170002Simp * kind. No responsibility is assumed by the SD Group, SD-3C LLC or the SD 42170002Simp * Card Association for any damages, any infringements of patents or other 43170002Simp * right of the SD Group, SD-3C LLC, the SD Card Association or any third 44170002Simp * parties, which may result from its use. No license is granted by 45170002Simp * implication, estoppel or otherwise under any patent or other rights of the 46170002Simp * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing 47170002Simp * herein shall be construed as an obligation by the SD Group, the SD-3C LLC 48170002Simp * or the SD Card Association to disclose or distribute any technical 49170002Simp * information, know-how or other confidential information to any third party. 50170002Simp * 51163516Simp * $FreeBSD: releng/11.0/sys/dev/mmc/mmcreg.h 298955 2016-05-03 03:41:25Z pfg $ 52163516Simp */ 53163516Simp 54163516Simp#ifndef DEV_MMC_MMCREG_H 55163516Simp#define DEV_MMC_MMCREG_H 56163516Simp 57163516Simp/* 58163516Simp * This file contains the register definitions for the mmc and sd busses. 59163516Simp * They are taken from publicly available sources. 60163516Simp */ 61163516Simp 62163516Simpstruct mmc_data; 63163516Simpstruct mmc_request; 64163516Simp 65163516Simpstruct mmc_command { 66163516Simp uint32_t opcode; 67163516Simp uint32_t arg; 68163516Simp uint32_t resp[4]; 69163516Simp uint32_t flags; /* Expected responses */ 70163516Simp#define MMC_RSP_PRESENT (1ul << 0) /* Response */ 71163516Simp#define MMC_RSP_136 (1ul << 1) /* 136 bit response */ 72163516Simp#define MMC_RSP_CRC (1ul << 2) /* Expect valid crc */ 73163516Simp#define MMC_RSP_BUSY (1ul << 3) /* Card may send busy */ 74163516Simp#define MMC_RSP_OPCODE (1ul << 4) /* Response include opcode */ 75163516Simp#define MMC_RSP_MASK 0x1ful 76163516Simp#define MMC_CMD_AC (0ul << 5) /* Addressed Command, no data */ 77163516Simp#define MMC_CMD_ADTC (1ul << 5) /* Addressed Data transfer cmd */ 78163516Simp#define MMC_CMD_BC (2ul << 5) /* Broadcast command, no response */ 79163516Simp#define MMC_CMD_BCR (3ul << 5) /* Broadcast command with response */ 80163516Simp#define MMC_CMD_MASK (3ul << 5) 81163516Simp 82163516Simp/* Possible response types defined in the standard: */ 83163516Simp#define MMC_RSP_NONE (0) 84163516Simp#define MMC_RSP_R1 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE) 85163516Simp#define MMC_RSP_R1B (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE | MMC_RSP_BUSY) 86163516Simp#define MMC_RSP_R2 (MMC_RSP_PRESENT | MMC_RSP_136 | MMC_RSP_CRC) 87163516Simp#define MMC_RSP_R3 (MMC_RSP_PRESENT) 88297329Skan#define MMC_RSP_R4 (MMC_RSP_PRESENT) 89297329Skan#define MMC_RSP_R5 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE) 90297329Skan#define MMC_RSP_R5B (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE | MMC_RSP_BUSY) 91297329Skan#define MMC_RSP_R6 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE) 92297329Skan#define MMC_RSP_R7 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE) 93163516Simp#define MMC_RSP(x) ((x) & MMC_RSP_MASK) 94163516Simp uint32_t retries; 95163516Simp uint32_t error; 96163516Simp#define MMC_ERR_NONE 0 97163516Simp#define MMC_ERR_TIMEOUT 1 98163516Simp#define MMC_ERR_BADCRC 2 99163516Simp#define MMC_ERR_FIFO 3 100163516Simp#define MMC_ERR_FAILED 4 101163516Simp#define MMC_ERR_INVALID 5 102183468Simp#define MMC_ERR_NO_MEMORY 6 103188044Simp#define MMC_ERR_MAX 6 104163516Simp struct mmc_data *data; /* Data segment with cmd */ 105163516Simp struct mmc_request *mrq; /* backpointer to request */ 106163516Simp}; 107163516Simp 108163516Simp/* 109163516Simp * R1 responses 110163516Simp * 111163516Simp * Types (per SD 2.0 standard) 112163516Simp * e : error bit 113163516Simp * s : status bit 114163516Simp * r : detected and set for the actual command response 115163516Simp * x : Detected and set during command execution. The host can get 116163516Simp * the status by issuing a command with R1 response. 117163516Simp * 118163516Simp * Clear Condition (per SD 2.0 standard) 119163516Simp * a : according to the card current state. 120163516Simp * b : always related to the previous command. reception of a valid 121163516Simp * command will clear it (with a delay of one command). 122163516Simp * c : clear by read 123163516Simp */ 124163516Simp#define R1_OUT_OF_RANGE (1u << 31) /* erx, c */ 125163516Simp#define R1_ADDRESS_ERROR (1u << 30) /* erx, c */ 126163516Simp#define R1_BLOCK_LEN_ERROR (1u << 29) /* erx, c */ 127163516Simp#define R1_ERASE_SEQ_ERROR (1u << 28) /* er, c */ 128163516Simp#define R1_ERASE_PARAM (1u << 27) /* erx, c */ 129163516Simp#define R1_WP_VIOLATION (1u << 26) /* erx, c */ 130163516Simp#define R1_CARD_IS_LOCKED (1u << 25) /* sx, a */ 131163516Simp#define R1_LOCK_UNLOCK_FAILED (1u << 24) /* erx, c */ 132163516Simp#define R1_COM_CRC_ERROR (1u << 23) /* er, b */ 133163516Simp#define R1_ILLEGAL_COMMAND (1u << 22) /* er, b */ 134163516Simp#define R1_CARD_ECC_FAILED (1u << 21) /* erx, c */ 135163516Simp#define R1_CC_ERROR (1u << 20) /* erx, c */ 136163516Simp#define R1_ERROR (1u << 19) /* erx, c */ 137163516Simp#define R1_CSD_OVERWRITE (1u << 16) /* erx, c */ 138163516Simp#define R1_WP_ERASE_SKIP (1u << 15) /* erx, c */ 139163516Simp#define R1_CARD_ECC_DISABLED (1u << 14) /* sx, a */ 140163516Simp#define R1_ERASE_RESET (1u << 13) /* sr, c */ 141163516Simp#define R1_CURRENT_STATE_MASK (0xfu << 9) /* sx, b */ 142163516Simp#define R1_READY_FOR_DATA (1u << 8) /* sx, a */ 143163516Simp#define R1_APP_CMD (1u << 5) /* sr, c */ 144163516Simp#define R1_AKE_SEQ_ERROR (1u << 3) /* er, c */ 145234524Smarius#define R1_STATUS(x) ((x) & 0xFFFFE000) 146234524Smarius#define R1_CURRENT_STATE(x) (((x) & R1_CURRENT_STATE_MASK) >> 9) 147163516Simp#define R1_STATE_IDLE 0 148163516Simp#define R1_STATE_READY 1 149163516Simp#define R1_STATE_IDENT 2 150163516Simp#define R1_STATE_STBY 3 151163516Simp#define R1_STATE_TRAN 4 152163516Simp#define R1_STATE_DATA 5 153163516Simp#define R1_STATE_RCV 6 154163516Simp#define R1_STATE_PRG 7 155163516Simp#define R1_STATE_DIS 8 156163516Simp 157163516Simpstruct mmc_data { 158163516Simp size_t len; /* size of the data */ 159163516Simp size_t xfer_len; 160163516Simp void *data; /* data buffer */ 161163516Simp uint32_t flags; 162163516Simp#define MMC_DATA_WRITE (1UL << 0) 163163516Simp#define MMC_DATA_READ (1UL << 1) 164163516Simp#define MMC_DATA_STREAM (1UL << 2) 165163516Simp#define MMC_DATA_MULTI (1UL << 3) 166163516Simp struct mmc_request *mrq; 167163516Simp}; 168163516Simp 169163516Simpstruct mmc_request { 170163516Simp struct mmc_command *cmd; 171163516Simp struct mmc_command *stop; 172163516Simp void (*done)(struct mmc_request *); /* Completion function */ 173163516Simp void *done_data; /* requestor set data */ 174163516Simp uint32_t flags; 175163516Simp#define MMC_REQ_DONE 1 176163516Simp}; 177163516Simp 178163516Simp/* Command definitions */ 179163516Simp 180163516Simp/* Class 0 and 1: Basic commands & read stream commands */ 181163516Simp#define MMC_GO_IDLE_STATE 0 182163516Simp#define MMC_SEND_OP_COND 1 183163516Simp#define MMC_ALL_SEND_CID 2 184163516Simp#define MMC_SET_RELATIVE_ADDR 3 185163516Simp#define SD_SEND_RELATIVE_ADDR 3 186163516Simp#define MMC_SET_DSR 4 187163516Simp /* reserved: 5 */ 188183704Smav#define MMC_SWITCH_FUNC 6 189183704Smav#define MMC_SWITCH_FUNC_CMDS 0 190183704Smav#define MMC_SWITCH_FUNC_SET 1 191183704Smav#define MMC_SWITCH_FUNC_CLR 2 192183704Smav#define MMC_SWITCH_FUNC_WR 3 193163516Simp#define MMC_SELECT_CARD 7 194163516Simp#define MMC_DESELECT_CARD 7 195183704Smav#define MMC_SEND_EXT_CSD 8 196183704Smav#define SD_SEND_IF_COND 8 197163516Simp#define MMC_SEND_CSD 9 198163516Simp#define MMC_SEND_CID 10 199163516Simp#define MMC_READ_DAT_UNTIL_STOP 11 200163516Simp#define MMC_STOP_TRANSMISSION 12 201163516Simp#define MMC_SEND_STATUS 13 202183704Smav#define MMC_BUSTEST_R 14 203163516Simp#define MMC_GO_INACTIVE_STATE 15 204183704Smav#define MMC_BUSTEST_W 19 205163516Simp 206163516Simp/* Class 2: Block oriented read commands */ 207163516Simp#define MMC_SET_BLOCKLEN 16 208163516Simp#define MMC_READ_SINGLE_BLOCK 17 209163516Simp#define MMC_READ_MULTIPLE_BLOCK 18 210163516Simp /* reserved: 19 */ 211163516Simp 212163516Simp/* Class 3: Stream write commands */ 213163516Simp#define MMC_WRITE_DAT_UNTIL_STOP 20 214163516Simp /* reserved: 21 */ 215163516Simp /* reserved: 22 */ 216163516Simp 217163516Simp/* Class 4: Block oriented write commands */ 218163516Simp#define MMC_SET_BLOCK_COUNT 23 219163516Simp#define MMC_WRITE_BLOCK 24 220163516Simp#define MMC_WRITE_MULTIPLE_BLOCK 25 221163516Simp#define MMC_PROGARM_CID 26 222163516Simp#define MMC_PROGRAM_CSD 27 223163516Simp 224163516Simp/* Class 6: Block oriented write protection commands */ 225163516Simp#define MMC_SET_WRITE_PROT 28 226163516Simp#define MMC_CLR_WRITE_PROT 29 227163516Simp#define MMC_SEND_WRITE_PROT 30 228163516Simp /* reserved: 31 */ 229163516Simp 230163516Simp/* Class 5: Erase commands */ 231163516Simp#define SD_ERASE_WR_BLK_START 32 232163516Simp#define SD_ERASE_WR_BLK_END 33 233163516Simp /* 34 -- reserved old command */ 234163516Simp#define MMC_ERASE_GROUP_START 35 235163516Simp#define MMC_ERASE_GROUP_END 36 236163516Simp /* 37 -- reserved old command */ 237163516Simp#define MMC_ERASE 38 238163516Simp 239163516Simp/* Class 9: I/O mode commands */ 240163516Simp#define MMC_FAST_IO 39 241163516Simp#define MMC_GO_IRQ_STATE 40 242163516Simp /* reserved: 41 */ 243163516Simp 244163516Simp/* Class 7: Lock card */ 245163516Simp#define MMC_LOCK_UNLOCK 42 246163516Simp /* reserved: 43 */ 247163516Simp /* reserved: 44 */ 248163516Simp /* reserved: 45 */ 249163516Simp /* reserved: 46 */ 250163516Simp /* reserved: 47 */ 251163516Simp /* reserved: 48 */ 252163516Simp /* reserved: 49 */ 253163516Simp /* reserved: 50 */ 254163516Simp /* reserved: 51 */ 255163516Simp /* reserved: 54 */ 256163516Simp 257163516Simp/* Class 8: Application specific commands */ 258163516Simp#define MMC_APP_CMD 55 259163516Simp#define MMC_GEN_CMD 56 260163516Simp /* reserved: 57 */ 261163516Simp /* reserved: 58 */ 262163516Simp /* reserved: 59 */ 263163516Simp /* reserved for mfg: 60 */ 264163516Simp /* reserved for mfg: 61 */ 265163516Simp /* reserved for mfg: 62 */ 266163516Simp /* reserved for mfg: 63 */ 267163516Simp 268163516Simp/* Class 9: I/O cards (sd) */ 269163516Simp#define SD_IO_RW_DIRECT 52 270163516Simp#define SD_IO_RW_EXTENDED 53 271163516Simp 272163516Simp/* Class 10: Switch function commands */ 273163516Simp#define SD_SWITCH_FUNC 6 274163516Simp /* reserved: 34 */ 275163516Simp /* reserved: 35 */ 276163516Simp /* reserved: 36 */ 277163516Simp /* reserved: 37 */ 278163516Simp /* reserved: 50 */ 279163516Simp /* reserved: 57 */ 280163516Simp 281163516Simp 282163516Simp/* Application specific commands for SD */ 283163516Simp#define ACMD_SET_BUS_WIDTH 6 284163516Simp#define ACMD_SD_STATUS 13 285163516Simp#define ACMD_SEND_NUM_WR_BLOCKS 22 286163516Simp#define ACMD_SET_WR_BLK_ERASE_COUNT 23 287163516Simp#define ACMD_SD_SEND_OP_COND 41 288163516Simp#define ACMD_SET_CLR_CARD_DETECT 42 289163516Simp#define ACMD_SEND_SCR 51 290163516Simp 291183704Smav/* 292183704Smav * EXT_CSD fields 293183704Smav */ 294184033Smav#define EXT_CSD_ERASE_GRP_DEF 175 /* R/W */ 295183704Smav#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 296183704Smav#define EXT_CSD_HS_TIMING 185 /* R/W */ 297183704Smav#define EXT_CSD_CARD_TYPE 196 /* RO */ 298183704Smav#define EXT_CSD_REV 192 /* RO */ 299183704Smav#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 300184033Smav#define EXT_CSD_ERASE_TO_MULT 223 /* RO */ 301184033Smav#define EXT_CSD_ERASE_GRP_SIZE 224 /* RO */ 302183704Smav 303183704Smav/* 304183704Smav * EXT_CSD field definitions 305183704Smav */ 306183704Smav#define EXT_CSD_CMD_SET_NORMAL 1 307183704Smav#define EXT_CSD_CMD_SET_SECURE 2 308183704Smav#define EXT_CSD_CMD_SET_CPSECURE 4 309183704Smav 310183704Smav#define EXT_CSD_CARD_TYPE_26 1 311183704Smav#define EXT_CSD_CARD_TYPE_52 2 312183704Smav 313183704Smav#define EXT_CSD_BUS_WIDTH_1 0 314183704Smav#define EXT_CSD_BUS_WIDTH_4 1 315183704Smav#define EXT_CSD_BUS_WIDTH_8 2 316183704Smav 317188044Simp#define MMC_TYPE_26_MAX_HS 26000000 318188044Simp#define MMC_TYPE_52_MAX_HS 52000000 319188044Simp 320183704Smav/* 321183704Smav * SD bus widths 322183704Smav */ 323183704Smav#define SD_BUS_WIDTH_1 0 324183704Smav#define SD_BUS_WIDTH_4 2 325183704Smav 326188044Simp/* 327188044Simp * SD Switch 328188044Simp */ 329188044Simp#define SD_SWITCH_MODE_CHECK 0 330188044Simp#define SD_SWITCH_MODE_SET 1 331188044Simp#define SD_SWITCH_GROUP1 0 332188044Simp#define SD_SWITCH_NORMAL_MODE 0 333188044Simp#define SD_SWITCH_HS_MODE 1 334188044Simp#define SD_SWITCH_NOCHANGE 0xF 335188044Simp 336234524Smarius#define SD_CLR_CARD_DETECT 0 337234524Smarius#define SD_SET_CARD_DETECT 1 338234524Smarius 339188044Simp#define SD_MAX_HS 50000000 340188044Simp 341163516Simp/* OCR bits */ 342163516Simp 343163516Simp/* 344163516Simp * in SD 2.0 spec, bits 8-14 are now marked reserved 345163516Simp * Low voltage in SD2.0 spec is bit 7, TBD voltage 346163516Simp * Low voltage in MC 3.31 spec is bit 7, 1.65-1.95V 347163516Simp * Specs prior to MMC 3.31 defined bits 0-7 as voltages down to 1.5V. 348163516Simp * 3.31 redefined them to be reserved and also said that cards had to 349163516Simp * support the 2.7-3.6V and fixed the OCR to be 0xfff8000 for high voltage 350163516Simp * cards. MMC 4.0 says that a dual voltage card responds with 0xfff8080. 351163516Simp * Looks like the fine-grained control of the voltage tolerance ranges 352163516Simp * was abandoned. 353163516Simp * 354163516Simp * The MMC_OCR_CCS appears to be valid for only SD cards. 355163516Simp */ 356183468Simp#define MMC_OCR_VOLTAGE 0x3fffffffU /* Vdd Voltage mask */ 357163516Simp#define MMC_OCR_LOW_VOLTAGE (1u << 7) /* Low Voltage Range -- tbd */ 358163516Simp#define MMC_OCR_200_210 (1U << 8) /* Vdd voltage 2.00 ~ 2.10 */ 359245755Sgonzo#define MMC_OCR_MIN_VOLTAGE_SHIFT 8 360163516Simp#define MMC_OCR_210_220 (1U << 9) /* Vdd voltage 2.10 ~ 2.20 */ 361163516Simp#define MMC_OCR_220_230 (1U << 10) /* Vdd voltage 2.20 ~ 2.30 */ 362163516Simp#define MMC_OCR_230_240 (1U << 11) /* Vdd voltage 2.30 ~ 2.40 */ 363163516Simp#define MMC_OCR_240_250 (1U << 12) /* Vdd voltage 2.40 ~ 2.50 */ 364163516Simp#define MMC_OCR_250_260 (1U << 13) /* Vdd voltage 2.50 ~ 2.60 */ 365163516Simp#define MMC_OCR_260_270 (1U << 14) /* Vdd voltage 2.60 ~ 2.70 */ 366163516Simp#define MMC_OCR_270_280 (1U << 15) /* Vdd voltage 2.70 ~ 2.80 */ 367163516Simp#define MMC_OCR_280_290 (1U << 16) /* Vdd voltage 2.80 ~ 2.90 */ 368163516Simp#define MMC_OCR_290_300 (1U << 17) /* Vdd voltage 2.90 ~ 3.00 */ 369163516Simp#define MMC_OCR_300_310 (1U << 18) /* Vdd voltage 3.00 ~ 3.10 */ 370163516Simp#define MMC_OCR_310_320 (1U << 19) /* Vdd voltage 3.10 ~ 3.20 */ 371163516Simp#define MMC_OCR_320_330 (1U << 20) /* Vdd voltage 3.20 ~ 3.30 */ 372163516Simp#define MMC_OCR_330_340 (1U << 21) /* Vdd voltage 3.30 ~ 3.40 */ 373163516Simp#define MMC_OCR_340_350 (1U << 22) /* Vdd voltage 3.40 ~ 3.50 */ 374163516Simp#define MMC_OCR_350_360 (1U << 23) /* Vdd voltage 3.50 ~ 3.60 */ 375245755Sgonzo#define MMC_OCR_MAX_VOLTAGE_SHIFT 23 376163516Simp#define MMC_OCR_CCS (1u << 30) /* Card Capacity status (SD vs SDHC) */ 377163516Simp#define MMC_OCR_CARD_BUSY (1U << 31) /* Card Power up status */ 378163516Simp 379163516Simp/* CSD -- decoded structure */ 380163516Simpstruct mmc_cid { 381163516Simp uint32_t mid; 382163516Simp char pnm[8]; 383163516Simp uint32_t psn; 384163516Simp uint16_t oid; 385163516Simp uint16_t mdt_year; 386163516Simp uint8_t mdt_month; 387163516Simp uint8_t prv; 388163516Simp uint8_t fwrev; 389163516Simp}; 390163516Simp 391234524Smariusstruct mmc_csd 392163516Simp{ 393163516Simp uint8_t csd_structure; 394183704Smav uint8_t spec_vers; 395163516Simp uint16_t ccc; 396163516Simp uint16_t tacc; 397163516Simp uint32_t nsac; 398163516Simp uint32_t r2w_factor; 399163516Simp uint32_t tran_speed; 400163516Simp uint32_t read_bl_len; 401163516Simp uint32_t write_bl_len; 402163516Simp uint32_t vdd_r_curr_min; 403163516Simp uint32_t vdd_r_curr_max; 404163516Simp uint32_t vdd_w_curr_min; 405163516Simp uint32_t vdd_w_curr_max; 406163516Simp uint32_t wp_grp_size; 407184033Smav uint32_t erase_sector; 408163516Simp uint64_t capacity; 409163516Simp unsigned int read_bl_partial:1, 410163516Simp read_blk_misalign:1, 411163516Simp write_bl_partial:1, 412163516Simp write_blk_misalign:1, 413163516Simp dsr_imp:1, 414163516Simp erase_blk_en:1, 415163516Simp wp_grp_enable:1; 416163516Simp}; 417163516Simp 418183704Smavstruct mmc_scr 419183704Smav{ 420183704Smav unsigned char sda_vsn; 421183704Smav unsigned char bus_widths; 422183704Smav#define SD_SCR_BUS_WIDTH_1 (1<<0) 423183704Smav#define SD_SCR_BUS_WIDTH_4 (1<<2) 424183704Smav}; 425183704Smav 426184033Smavstruct mmc_sd_status 427184033Smav{ 428184033Smav uint8_t bus_width; 429184033Smav uint8_t secured_mode; 430184033Smav uint16_t card_type; 431184033Smav uint16_t prot_area; 432184033Smav uint8_t speed_class; 433184033Smav uint8_t perf_move; 434184033Smav uint8_t au_size; 435184033Smav uint16_t erase_size; 436184033Smav uint8_t erase_timeout; 437184033Smav uint8_t erase_offset; 438184033Smav}; 439184033Smav 440183542Simp/* 441183542Simp * Older versions of the MMC standard had a variable sector size. However, 442183542Simp * I've been able to find no old MMC or SD cards that have a non 512 443183542Simp * byte sector size anywhere, so we assume that such cards are very rare 444298955Spfg * and only note their existence in passing here... 445183542Simp */ 446183542Simp#define MMC_SECTOR_SIZE 512 447183542Simp 448163516Simp#endif /* DEV_MMCREG_H */ 449