mmcreg.h (183542) | mmcreg.h (183704) |
---|---|
1/*- 2 * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 34 unchanged lines hidden (view full) --- 43 * right of the SD Group, SD-3C LLC, the SD Card Association or any third 44 * parties, which may result from its use. No license is granted by 45 * implication, estoppel or otherwise under any patent or other rights of the 46 * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing 47 * herein shall be construed as an obligation by the SD Group, the SD-3C LLC 48 * or the SD Card Association to disclose or distribute any technical 49 * information, know-how or other confidential information to any third party. 50 * | 1/*- 2 * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 34 unchanged lines hidden (view full) --- 43 * right of the SD Group, SD-3C LLC, the SD Card Association or any third 44 * parties, which may result from its use. No license is granted by 45 * implication, estoppel or otherwise under any patent or other rights of the 46 * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing 47 * herein shall be construed as an obligation by the SD Group, the SD-3C LLC 48 * or the SD Card Association to disclose or distribute any technical 49 * information, know-how or other confidential information to any third party. 50 * |
51 * $FreeBSD: head/sys/dev/mmc/mmcreg.h 183542 2008-10-02 07:06:59Z imp $ | 51 * $FreeBSD: head/sys/dev/mmc/mmcreg.h 183704 2008-10-08 17:35:41Z mav $ |
52 */ 53 54#ifndef DEV_MMC_MMCREG_H 55#define DEV_MMC_MMCREG_H 56 57/* 58 * This file contains the register definitions for the mmc and sd busses. 59 * They are taken from publicly available sources. --- 21 unchanged lines hidden (view full) --- 81 82/* Possible response types defined in the standard: */ 83#define MMC_RSP_NONE (0) 84#define MMC_RSP_R1 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE) 85#define MMC_RSP_R1B (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE | MMC_RSP_BUSY) 86#define MMC_RSP_R2 (MMC_RSP_PRESENT | MMC_RSP_136 | MMC_RSP_CRC) 87#define MMC_RSP_R3 (MMC_RSP_PRESENT) 88#define MMC_RSP_R6 (MMC_RSP_PRESENT | MMC_RSP_CRC) | 52 */ 53 54#ifndef DEV_MMC_MMCREG_H 55#define DEV_MMC_MMCREG_H 56 57/* 58 * This file contains the register definitions for the mmc and sd busses. 59 * They are taken from publicly available sources. --- 21 unchanged lines hidden (view full) --- 81 82/* Possible response types defined in the standard: */ 83#define MMC_RSP_NONE (0) 84#define MMC_RSP_R1 (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE) 85#define MMC_RSP_R1B (MMC_RSP_PRESENT | MMC_RSP_CRC | MMC_RSP_OPCODE | MMC_RSP_BUSY) 86#define MMC_RSP_R2 (MMC_RSP_PRESENT | MMC_RSP_136 | MMC_RSP_CRC) 87#define MMC_RSP_R3 (MMC_RSP_PRESENT) 88#define MMC_RSP_R6 (MMC_RSP_PRESENT | MMC_RSP_CRC) |
89/* R7 -- new in sd 2.0 */ | 89#define MMC_RSP_R7 (MMC_RSP_PRESENT | MMC_RSP_CRC) |
90#define MMC_RSP(x) ((x) & MMC_RSP_MASK) 91 uint32_t retries; 92 uint32_t error; 93#define MMC_ERR_NONE 0 94#define MMC_ERR_TIMEOUT 1 95#define MMC_ERR_BADCRC 2 96#define MMC_ERR_FIFO 3 97#define MMC_ERR_FAILED 4 --- 78 unchanged lines hidden (view full) --- 176/* Class 0 and 1: Basic commands & read stream commands */ 177#define MMC_GO_IDLE_STATE 0 178#define MMC_SEND_OP_COND 1 179#define MMC_ALL_SEND_CID 2 180#define MMC_SET_RELATIVE_ADDR 3 181#define SD_SEND_RELATIVE_ADDR 3 182#define MMC_SET_DSR 4 183 /* reserved: 5 */ | 90#define MMC_RSP(x) ((x) & MMC_RSP_MASK) 91 uint32_t retries; 92 uint32_t error; 93#define MMC_ERR_NONE 0 94#define MMC_ERR_TIMEOUT 1 95#define MMC_ERR_BADCRC 2 96#define MMC_ERR_FIFO 3 97#define MMC_ERR_FAILED 4 --- 78 unchanged lines hidden (view full) --- 176/* Class 0 and 1: Basic commands & read stream commands */ 177#define MMC_GO_IDLE_STATE 0 178#define MMC_SEND_OP_COND 1 179#define MMC_ALL_SEND_CID 2 180#define MMC_SET_RELATIVE_ADDR 3 181#define SD_SEND_RELATIVE_ADDR 3 182#define MMC_SET_DSR 4 183 /* reserved: 5 */ |
184#define MMC_SWITCH_FUNC 6 185#define MMC_SWITCH_FUNC_CMDS 0 186#define MMC_SWITCH_FUNC_SET 1 187#define MMC_SWITCH_FUNC_CLR 2 188#define MMC_SWITCH_FUNC_WR 3 |
|
184#define MMC_SELECT_CARD 7 185#define MMC_DESELECT_CARD 7 | 189#define MMC_SELECT_CARD 7 190#define MMC_DESELECT_CARD 7 |
186#define MMC_SEND_IF_COND 8 | 191#define MMC_SEND_EXT_CSD 8 192#define SD_SEND_IF_COND 8 |
187#define MMC_SEND_CSD 9 188#define MMC_SEND_CID 10 189#define MMC_READ_DAT_UNTIL_STOP 11 190#define MMC_STOP_TRANSMISSION 12 191#define MMC_SEND_STATUS 13 | 193#define MMC_SEND_CSD 9 194#define MMC_SEND_CID 10 195#define MMC_READ_DAT_UNTIL_STOP 11 196#define MMC_STOP_TRANSMISSION 12 197#define MMC_SEND_STATUS 13 |
192 /* reserved: 14 */ | 198#define MMC_BUSTEST_R 14 |
193#define MMC_GO_INACTIVE_STATE 15 | 199#define MMC_GO_INACTIVE_STATE 15 |
200#define MMC_BUSTEST_W 19 |
|
194 195/* Class 2: Block oriented read commands */ 196#define MMC_SET_BLOCKLEN 16 197#define MMC_READ_SINGLE_BLOCK 17 198#define MMC_READ_MULTIPLE_BLOCK 18 199 /* reserved: 19 */ 200 201/* Class 3: Stream write commands */ --- 70 unchanged lines hidden (view full) --- 272#define ACMD_SET_BUS_WIDTH 6 273#define ACMD_SD_STATUS 13 274#define ACMD_SEND_NUM_WR_BLOCKS 22 275#define ACMD_SET_WR_BLK_ERASE_COUNT 23 276#define ACMD_SD_SEND_OP_COND 41 277#define ACMD_SET_CLR_CARD_DETECT 42 278#define ACMD_SEND_SCR 51 279 | 201 202/* Class 2: Block oriented read commands */ 203#define MMC_SET_BLOCKLEN 16 204#define MMC_READ_SINGLE_BLOCK 17 205#define MMC_READ_MULTIPLE_BLOCK 18 206 /* reserved: 19 */ 207 208/* Class 3: Stream write commands */ --- 70 unchanged lines hidden (view full) --- 279#define ACMD_SET_BUS_WIDTH 6 280#define ACMD_SD_STATUS 13 281#define ACMD_SEND_NUM_WR_BLOCKS 22 282#define ACMD_SET_WR_BLK_ERASE_COUNT 23 283#define ACMD_SD_SEND_OP_COND 41 284#define ACMD_SET_CLR_CARD_DETECT 42 285#define ACMD_SEND_SCR 51 286 |
287/* 288 * EXT_CSD fields 289 */ 290 291#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 292#define EXT_CSD_HS_TIMING 185 /* R/W */ 293#define EXT_CSD_CARD_TYPE 196 /* RO */ 294#define EXT_CSD_REV 192 /* RO */ 295#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 296 297/* 298 * EXT_CSD field definitions 299 */ 300 301#define EXT_CSD_CMD_SET_NORMAL 1 302#define EXT_CSD_CMD_SET_SECURE 2 303#define EXT_CSD_CMD_SET_CPSECURE 4 304 305#define EXT_CSD_CARD_TYPE_26 1 306#define EXT_CSD_CARD_TYPE_52 2 307 308#define EXT_CSD_BUS_WIDTH_1 0 309#define EXT_CSD_BUS_WIDTH_4 1 310#define EXT_CSD_BUS_WIDTH_8 2 311 312/* 313 * SD bus widths 314 */ 315#define SD_BUS_WIDTH_1 0 316#define SD_BUS_WIDTH_4 2 317 |
|
280/* OCR bits */ 281 282/* 283 * in SD 2.0 spec, bits 8-14 are now marked reserved 284 * Low voltage in SD2.0 spec is bit 7, TBD voltage 285 * Low voltage in MC 3.31 spec is bit 7, 1.65-1.95V 286 * Specs prior to MMC 3.31 defined bits 0-7 as voltages down to 1.5V. 287 * 3.31 redefined them to be reserved and also said that cards had to --- 35 unchanged lines hidden (view full) --- 323 uint8_t mdt_month; 324 uint8_t prv; 325 uint8_t fwrev; 326}; 327 328struct mmc_csd 329{ 330 uint8_t csd_structure; | 318/* OCR bits */ 319 320/* 321 * in SD 2.0 spec, bits 8-14 are now marked reserved 322 * Low voltage in SD2.0 spec is bit 7, TBD voltage 323 * Low voltage in MC 3.31 spec is bit 7, 1.65-1.95V 324 * Specs prior to MMC 3.31 defined bits 0-7 as voltages down to 1.5V. 325 * 3.31 redefined them to be reserved and also said that cards had to --- 35 unchanged lines hidden (view full) --- 361 uint8_t mdt_month; 362 uint8_t prv; 363 uint8_t fwrev; 364}; 365 366struct mmc_csd 367{ 368 uint8_t csd_structure; |
369 uint8_t spec_vers; |
|
331 uint16_t ccc; 332 uint16_t tacc; 333 uint32_t nsac; 334 uint32_t r2w_factor; 335 uint32_t tran_speed; 336 uint32_t read_bl_len; 337 uint32_t write_bl_len; 338 uint32_t vdd_r_curr_min; --- 7 unchanged lines hidden (view full) --- 346 read_blk_misalign:1, 347 write_bl_partial:1, 348 write_blk_misalign:1, 349 dsr_imp:1, 350 erase_blk_en:1, 351 wp_grp_enable:1; 352}; 353 | 370 uint16_t ccc; 371 uint16_t tacc; 372 uint32_t nsac; 373 uint32_t r2w_factor; 374 uint32_t tran_speed; 375 uint32_t read_bl_len; 376 uint32_t write_bl_len; 377 uint32_t vdd_r_curr_min; --- 7 unchanged lines hidden (view full) --- 385 read_blk_misalign:1, 386 write_bl_partial:1, 387 write_blk_misalign:1, 388 dsr_imp:1, 389 erase_blk_en:1, 390 wp_grp_enable:1; 391}; 392 |
393struct mmc_scr 394{ 395 unsigned char sda_vsn; 396 unsigned char bus_widths; 397#define SD_SCR_BUS_WIDTH_1 (1<<0) 398#define SD_SCR_BUS_WIDTH_4 (1<<2) 399}; 400 |
|
354/* 355 * Older versions of the MMC standard had a variable sector size. However, 356 * I've been able to find no old MMC or SD cards that have a non 512 357 * byte sector size anywhere, so we assume that such cards are very rare 358 * and only note their existance in passing here... 359 */ 360#define MMC_SECTOR_SIZE 512 361 362#endif /* DEV_MMCREG_H */ | 401/* 402 * Older versions of the MMC standard had a variable sector size. However, 403 * I've been able to find no old MMC or SD cards that have a non 512 404 * byte sector size anywhere, so we assume that such cards are very rare 405 * and only note their existance in passing here... 406 */ 407#define MMC_SECTOR_SIZE 512 408 409#endif /* DEV_MMCREG_H */ |