xref: /openbmc/qemu/hw/sd/sdmmc-internal.h (revision f64e7531)
1 /*
2  * SD/MMC cards common
3  *
4  * Copyright (c) 2018  Philippe Mathieu-Daudé <f4bug@amsat.org>
5  *
6  * This work is licensed under the terms of the GNU GPL, version 2 or later.
7  * See the COPYING file in the top-level directory.
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef SDMMC_INTERNAL_H
12 #define SDMMC_INTERNAL_H
13 
14 /*
15  * EXT_CSD Modes segment
16  *
17  * Define the configuration the Device is working in.
18  * These modes can be changed by the host by means of the SWITCH command.
19  */
20 #define EXT_CSD_CMDQ_MODE_EN            15      /* R/W */
21 #define EXT_CSD_FLUSH_CACHE             32      /* W */
22 #define EXT_CSD_CACHE_CTRL              33      /* R/W */
23 #define EXT_CSD_POWER_OFF_NOTIFICATION  34      /* R/W */
24 #define EXT_CSD_PACKED_FAILURE_INDEX    35      /* RO */
25 #define EXT_CSD_PACKED_CMD_STATUS       36      /* RO */
26 #define EXT_CSD_EXP_EVENTS_STATUS       54      /* RO, 2 bytes */
27 #define EXT_CSD_EXP_EVENTS_CTRL         56      /* R/W, 2 bytes */
28 #define EXT_CSD_CLASS_6_CTRL            59
29 #define EXT_CSD_INI_TIMEOUT_EMU         60
30 #define EXT_CSD_DATA_SECTOR_SIZE        61      /* R */
31 #define EXT_CSD_USE_NATIVE_SECTOR       62
32 #define EXT_CSD_NATIVE_SECTOR_SIZE      63
33 #define EXT_CSD_VENDOR_SPECIFIC_FIELD   64      /* 64 bytes */
34 #define EXT_CSD_PROGRAM_CID_CSD_DDR_SUPPORT 130
35 #define EXT_CSD_PERIODIC_WAKEUP         131
36 #define EXT_CSD_TCASE_SUPPORT           132
37 #define EXT_CSD_SEC_BAD_BLK_MGMNT       134
38 #define EXT_CSD_GP_SIZE_MULT            143     /* R/W */
39 #define EXT_CSD_PARTITION_SETTING_COMPLETED 155 /* R/W */
40 #define EXT_CSD_PARTITION_ATTRIBUTE     156     /* R/W */
41 #define EXT_CSD_MAX_ENH_SIZE_MULT       157     /* RO, 3 bytes */
42 #define EXT_CSD_PARTITION_SUPPORT       160     /* RO */
43 #define EXT_CSD_HPI_MGMT                161     /* R/W */
44 #define EXT_CSD_RST_N_FUNCTION          162     /* R/W */
45 #define EXT_CSD_BKOPS_EN                163     /* R/W */
46 #define EXT_CSD_BKOPS_START             164     /* W */
47 #define EXT_CSD_SANITIZE_START          165     /* W */
48 #define EXT_CSD_WR_REL_PARAM            166     /* RO */
49 #define EXT_CSD_WR_REL_SET              167
50 #define EXT_CSD_RPMB_MULT               168     /* RO */
51 #define EXT_CSD_FW_CONFIG               169     /* R/W */
52 #define EXT_CSD_USER_WP                 171
53 #define EXT_CSD_BOOT_WP                 173     /* R/W */
54 #define EXT_CSD_BOOT_WP_STATUS          174
55 #define EXT_CSD_ERASE_GROUP_DEF         175     /* R/W */
56 #define EXT_CSD_BOOT_BUS_CONDITIONS     177
57 #define EXT_CSD_BOOT_CONFIG_PROT        178
58 #define EXT_CSD_PART_CONFIG             179     /* R/W */
59 #define EXT_CSD_ERASED_MEM_CONT         181     /* RO */
60 #define EXT_CSD_BUS_WIDTH               183     /* R/W */
61 #define EXT_CSD_STROBE_SUPPORT          184     /* RO */
62 #define EXT_CSD_HS_TIMING               185     /* R/W */
63 #define EXT_CSD_POWER_CLASS             187     /* R/W */
64 #define EXT_CSD_CMD_SET_REV             189
65 #define EXT_CSD_CMD_SET                 191
66 /*
67  * EXT_CSD Properties segment
68  *
69  * Define the Device capabilities, cannot be modified by the host.
70  */
71 #define EXT_CSD_REV                     192
72 #define EXT_CSD_STRUCTURE               194
73 #define EXT_CSD_CARD_TYPE               196
74 #define EXT_CSD_DRIVER_STRENGTH         197
75 #define EXT_CSD_OUT_OF_INTERRUPT_TIME   198
76 #define EXT_CSD_PART_SWITCH_TIME        199
77 #define EXT_CSD_PWR_CL_52_195           200
78 #define EXT_CSD_PWR_CL_26_195           201
79 #define EXT_CSD_PWR_CL_52_360           202
80 #define EXT_CSD_PWR_CL_26_360           203
81 #define EXT_CSD_SEC_CNT                 212     /* 4 bytes */
82 #define EXT_CSD_S_A_TIMEOUT             217
83 #define EXT_CSD_S_C_VCCQ                219
84 #define EXT_CSD_S_C_VCC                 220
85 #define EXT_CSD_REL_WR_SEC_C            222
86 #define EXT_CSD_HC_WP_GRP_SIZE          221
87 #define EXT_CSD_ERASE_TIMEOUT_MULT      223
88 #define EXT_CSD_HC_ERASE_GRP_SIZE       224
89 #define EXT_CSD_ACC_SIZE                225
90 #define EXT_CSD_BOOT_MULT               226
91 #define EXT_CSD_BOOT_INFO               228
92 #define EXT_CSD_SEC_FEATURE_SUPPORT     231
93 #define EXT_CSD_TRIM_MULT               232
94 #define EXT_CSD_INI_TIMEOUT_PA          241
95 #define EXT_CSD_BKOPS_STATUS            246
96 #define EXT_CSD_POWER_OFF_LONG_TIME     247
97 #define EXT_CSD_GENERIC_CMD6_TIME       248
98 #define EXT_CSD_CACHE_SIZE              249     /* 4 bytes */
99 #define EXT_CSD_EXT_SUPPORT             494
100 #define EXT_CSD_LARGE_UNIT_SIZE_M1      495
101 #define EXT_CSD_CONTEXT_CAPABILITIES    496
102 #define EXT_CSD_TAG_RES_SIZE            497
103 #define EXT_CSD_TAG_UNIT_SIZE           498
104 #define EXT_CSD_DATA_TAG_SUPPORT        499
105 #define EXT_CSD_MAX_PACKED_WRITES       500
106 #define EXT_CSD_MAX_PACKED_READS        501
107 #define EXT_CSD_BKOPS_SUPPORT           502
108 #define EXT_CSD_HPI_FEATURES            503
109 #define EXT_CSD_S_CMD_SET               504
110 
111 #define EXT_CSD_WR_REL_PARAM_EN                 (1 << 2)
112 #define EXT_CSD_WR_REL_PARAM_EN_RPMB_REL_WR     (1 << 4)
113 
114 #define EXT_CSD_PART_CONFIG_ACC_MASK            (0x7)
115 #define EXT_CSD_PART_CONFIG_ACC_DEFAULT         (0x0)
116 #define EXT_CSD_PART_CONFIG_ACC_BOOT0           (0x1)
117 
118 #define EXT_CSD_PART_CONFIG_EN_MASK             (0x7 << 3)
119 #define EXT_CSD_PART_CONFIG_EN_BOOT0            (0x1 << 3)
120 #define EXT_CSD_PART_CONFIG_EN_USER             (0x7 << 3)
121 
122 #endif
123