aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc/card.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mmc/card.h')
-rw-r--r--include/linux/mmc/card.h58
1 files changed, 57 insertions, 1 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index b460fc2af8a1..415f2db414e1 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -50,8 +50,12 @@ struct mmc_ext_csd {
50 u8 rel_sectors; 50 u8 rel_sectors;
51 u8 rel_param; 51 u8 rel_param;
52 u8 part_config; 52 u8 part_config;
53 u8 cache_ctrl;
54 u8 rst_n_function;
53 unsigned int part_time; /* Units: ms */ 55 unsigned int part_time; /* Units: ms */
54 unsigned int sa_timeout; /* Units: 100ns */ 56 unsigned int sa_timeout; /* Units: 100ns */
57 unsigned int generic_cmd6_time; /* Units: 10ms */
58 unsigned int power_off_longtime; /* Units: ms */
55 unsigned int hs_max_dtr; 59 unsigned int hs_max_dtr;
56 unsigned int sectors; 60 unsigned int sectors;
57 unsigned int card_type; 61 unsigned int card_type;
@@ -63,11 +67,15 @@ struct mmc_ext_csd {
63 bool enhanced_area_en; /* enable bit */ 67 bool enhanced_area_en; /* enable bit */
64 unsigned long long enhanced_area_offset; /* Units: Byte */ 68 unsigned long long enhanced_area_offset; /* Units: Byte */
65 unsigned int enhanced_area_size; /* Units: KB */ 69 unsigned int enhanced_area_size; /* Units: KB */
66 unsigned int boot_size; /* in bytes */ 70 unsigned int cache_size; /* Units: KB */
71 bool hpi_en; /* HPI enablebit */
72 bool hpi; /* HPI support bit */
73 unsigned int hpi_cmd; /* cmd used as HPI */
67 u8 raw_partition_support; /* 160 */ 74 u8 raw_partition_support; /* 160 */
68 u8 raw_erased_mem_count; /* 181 */ 75 u8 raw_erased_mem_count; /* 181 */
69 u8 raw_ext_csd_structure; /* 194 */ 76 u8 raw_ext_csd_structure; /* 194 */
70 u8 raw_card_type; /* 196 */ 77 u8 raw_card_type; /* 196 */
78 u8 out_of_int_time; /* 198 */
71 u8 raw_s_a_timeout; /* 217 */ 79 u8 raw_s_a_timeout; /* 217 */
72 u8 raw_hc_erase_gap_size; /* 221 */ 80 u8 raw_hc_erase_gap_size; /* 221 */
73 u8 raw_erase_timeout_mult; /* 223 */ 81 u8 raw_erase_timeout_mult; /* 223 */
@@ -77,6 +85,9 @@ struct mmc_ext_csd {
77 u8 raw_sec_feature_support;/* 231 */ 85 u8 raw_sec_feature_support;/* 231 */
78 u8 raw_trim_mult; /* 232 */ 86 u8 raw_trim_mult; /* 232 */
79 u8 raw_sectors[4]; /* 212 - 4 bytes */ 87 u8 raw_sectors[4]; /* 212 - 4 bytes */
88
89 unsigned int feature_support;
90#define MMC_DISCARD_FEATURE BIT(0) /* CMD38 feature */
80}; 91};
81 92
82struct sd_scr { 93struct sd_scr {
@@ -157,6 +168,24 @@ struct sdio_func_tuple;
157 168
158#define SDIO_MAX_FUNCS 7 169#define SDIO_MAX_FUNCS 7
159 170
171/* The number of MMC physical partitions. These consist of:
172 * boot partitions (2), general purpose partitions (4) in MMC v4.4.
173 */
174#define MMC_NUM_BOOT_PARTITION 2
175#define MMC_NUM_GP_PARTITION 4
176#define MMC_NUM_PHY_PARTITION 6
177#define MAX_MMC_PART_NAME_LEN 20
178
179/*
180 * MMC Physical partitions
181 */
182struct mmc_part {
183 unsigned int size; /* partition size (in bytes) */
184 unsigned int part_cfg; /* partition type */
185 char name[MAX_MMC_PART_NAME_LEN];
186 bool force_ro; /* to make boot parts RO by default */
187};
188
160/* 189/*
161 * MMC device 190 * MMC device
162 */ 191 */
@@ -188,6 +217,13 @@ struct mmc_card {
188#define MMC_QUIRK_DISABLE_CD (1<<5) /* disconnect CD/DAT[3] resistor */ 217#define MMC_QUIRK_DISABLE_CD (1<<5) /* disconnect CD/DAT[3] resistor */
189#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ 218#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */
190#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ 219#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
220#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */
221 /* byte mode */
222 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
223#define MMC_NO_POWER_NOTIFICATION 0
224#define MMC_POWERED_ON 1
225#define MMC_POWEROFF_SHORT 2
226#define MMC_POWEROFF_LONG 3
191 227
192 unsigned int erase_size; /* erase size in sectors */ 228 unsigned int erase_size; /* erase size in sectors */
193 unsigned int erase_shift; /* if erase unit is power 2 */ 229 unsigned int erase_shift; /* if erase unit is power 2 */
@@ -216,9 +252,24 @@ struct mmc_card {
216 unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */ 252 unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */
217 253
218 struct dentry *debugfs_root; 254 struct dentry *debugfs_root;
255 struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */
256 unsigned int nr_parts;
219}; 257};
220 258
221/* 259/*
260 * This function fill contents in mmc_part.
261 */
262static inline void mmc_part_add(struct mmc_card *card, unsigned int size,
263 unsigned int part_cfg, char *name, int idx, bool ro)
264{
265 card->part[card->nr_parts].size = size;
266 card->part[card->nr_parts].part_cfg = part_cfg;
267 sprintf(card->part[card->nr_parts].name, name, idx);
268 card->part[card->nr_parts].force_ro = ro;
269 card->nr_parts++;
270}
271
272/*
222 * The world is not perfect and supplies us with broken mmc/sdio devices. 273 * The world is not perfect and supplies us with broken mmc/sdio devices.
223 * For at least some of these bugs we need a work-around. 274 * For at least some of these bugs we need a work-around.
224 */ 275 */
@@ -377,6 +428,11 @@ static inline int mmc_card_nonstd_func_interface(const struct mmc_card *c)
377 return c->quirks & MMC_QUIRK_NONSTD_FUNC_IF; 428 return c->quirks & MMC_QUIRK_NONSTD_FUNC_IF;
378} 429}
379 430
431static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c)
432{
433 return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512;
434}
435
380#define mmc_card_name(c) ((c)->cid.prod_name) 436#define mmc_card_name(c) ((c)->cid.prod_name)
381#define mmc_card_id(c) (dev_name(&(c)->dev)) 437#define mmc_card_id(c) (dev_name(&(c)->dev))
382 438