diff options
author | Namjae Jeon <linkinjeon@gmail.com> | 2011-10-06 10:41:38 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-10-26 16:32:17 -0400 |
commit | e0c368d571d946ff40f068344b5c2df90c93dd2e (patch) | |
tree | 509fdad0059dac018128610723557b4ca12f29d2 /include/linux/mmc | |
parent | 5238acbe36dd5100fb6b035a995ae5fc89dd0708 (diff) |
mmc: core: general purpose MMC partition support.
It allows gerneral purpose partitions in MMC Device. And I try to simply
make mmc_blk_alloc_parts using mmc_part structure suggested by Andrei
Warkentin. After patching, we see general purpose partitions like this:
> cat /proc/partitions
179 0 847872 mmcblk0
179 192 4096 mmcblk0gp3
179 160 4096 mmcblk0gp2
179 128 4096 mmcblk0gp1
179 96 1052672 mmcblk0gp0
179 64 1024 mmcblk0boot1
179 32 1024 mmcblk0boot0
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Acked-by: Andrei Warkentin <awarkentin@vmware.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'include/linux/mmc')
-rw-r--r-- | include/linux/mmc/card.h | 34 | ||||
-rw-r--r-- | include/linux/mmc/mmc.h | 5 |
2 files changed, 37 insertions, 2 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 5294ddf382ae..92762865f7e0 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/mmc/core.h> | 13 | #include <linux/mmc/core.h> |
14 | #include <linux/mod_devicetable.h> | 14 | #include <linux/mod_devicetable.h> |
15 | #include <linux/genhd.h> | ||
15 | 16 | ||
16 | struct mmc_cid { | 17 | struct mmc_cid { |
17 | unsigned int manfid; | 18 | unsigned int manfid; |
@@ -64,7 +65,6 @@ struct mmc_ext_csd { | |||
64 | bool enhanced_area_en; /* enable bit */ | 65 | bool enhanced_area_en; /* enable bit */ |
65 | unsigned long long enhanced_area_offset; /* Units: Byte */ | 66 | unsigned long long enhanced_area_offset; /* Units: Byte */ |
66 | unsigned int enhanced_area_size; /* Units: KB */ | 67 | unsigned int enhanced_area_size; /* Units: KB */ |
67 | unsigned int boot_size; /* in bytes */ | ||
68 | u8 raw_partition_support; /* 160 */ | 68 | u8 raw_partition_support; /* 160 */ |
69 | u8 raw_erased_mem_count; /* 181 */ | 69 | u8 raw_erased_mem_count; /* 181 */ |
70 | u8 raw_ext_csd_structure; /* 194 */ | 70 | u8 raw_ext_csd_structure; /* 194 */ |
@@ -158,6 +158,23 @@ struct sdio_func_tuple; | |||
158 | 158 | ||
159 | #define SDIO_MAX_FUNCS 7 | 159 | #define SDIO_MAX_FUNCS 7 |
160 | 160 | ||
161 | /* The number of MMC physical partitions. These consist of: | ||
162 | * boot partitions (2), general purpose partitions (4) in MMC v4.4. | ||
163 | */ | ||
164 | #define MMC_NUM_BOOT_PARTITION 2 | ||
165 | #define MMC_NUM_GP_PARTITION 4 | ||
166 | #define MMC_NUM_PHY_PARTITION 6 | ||
167 | |||
168 | /* | ||
169 | * MMC Physical partitions | ||
170 | */ | ||
171 | struct mmc_part { | ||
172 | unsigned int size; /* partition size (in bytes) */ | ||
173 | unsigned int part_cfg; /* partition type */ | ||
174 | char name[DISK_NAME_LEN]; | ||
175 | bool force_ro; /* to make boot parts RO by default */ | ||
176 | }; | ||
177 | |||
161 | /* | 178 | /* |
162 | * MMC device | 179 | * MMC device |
163 | */ | 180 | */ |
@@ -219,9 +236,24 @@ struct mmc_card { | |||
219 | unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */ | 236 | unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */ |
220 | 237 | ||
221 | struct dentry *debugfs_root; | 238 | struct dentry *debugfs_root; |
239 | struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */ | ||
240 | unsigned int nr_parts; | ||
222 | }; | 241 | }; |
223 | 242 | ||
224 | /* | 243 | /* |
244 | * This function fill contents in mmc_part. | ||
245 | */ | ||
246 | static inline void mmc_part_add(struct mmc_card *card, unsigned int size, | ||
247 | unsigned int part_cfg, char *name, int idx, bool ro) | ||
248 | { | ||
249 | card->part[card->nr_parts].size = size; | ||
250 | card->part[card->nr_parts].part_cfg = part_cfg; | ||
251 | sprintf(card->part[card->nr_parts].name, name, idx); | ||
252 | card->part[card->nr_parts].force_ro = ro; | ||
253 | card->nr_parts++; | ||
254 | } | ||
255 | |||
256 | /* | ||
225 | * The world is not perfect and supplies us with broken mmc/sdio devices. | 257 | * The world is not perfect and supplies us with broken mmc/sdio devices. |
226 | * For at least some of these bugs we need a work-around. | 258 | * For at least some of these bugs we need a work-around. |
227 | */ | 259 | */ |
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 50af22730c74..ea558eb44c79 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
@@ -270,6 +270,7 @@ struct _mmc_csd { | |||
270 | * EXT_CSD fields | 270 | * EXT_CSD fields |
271 | */ | 271 | */ |
272 | 272 | ||
273 | #define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ | ||
273 | #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ | 274 | #define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ |
274 | #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ | 275 | #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ |
275 | #define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ | 276 | #define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ |
@@ -313,7 +314,9 @@ struct _mmc_csd { | |||
313 | 314 | ||
314 | #define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) | 315 | #define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) |
315 | #define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) | 316 | #define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) |
316 | #define EXT_CSD_PART_CONFIG_ACC_BOOT1 (0x2) | 317 | #define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) |
318 | |||
319 | #define EXT_CSD_PART_SUPPORT_PART_EN (0x1) | ||
317 | 320 | ||
318 | #define EXT_CSD_CMD_SET_NORMAL (1<<0) | 321 | #define EXT_CSD_CMD_SET_NORMAL (1<<0) |
319 | #define EXT_CSD_CMD_SET_SECURE (1<<1) | 322 | #define EXT_CSD_CMD_SET_SECURE (1<<1) |