diff options
author | Johan Rudholm <johan.rudholm@stericsson.com> | 2011-12-02 02:51:06 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-01-11 23:58:43 -0500 |
commit | add710eaa88606de8ba98a014d37178579e6dbaf (patch) | |
tree | 2d719508cabd213d5923cef95fdd3d6c9c40d977 /include/linux/mmc | |
parent | 92df954df3422a7dcf99eea34cf4cb68bb06ea08 (diff) |
mmc: boot partition ro lock support
Enable boot partitions to be read-only locked until next power on via
a sysfs entry. There will be one sysfs entry for each boot partition:
/sys/block/mmcblkXbootY/ro_lock_until_next_power_on
Each boot partition is locked by writing 1 to its file.
Signed-off-by: Johan Rudholm <johan.rudholm@stericsson.com>
Signed-off-by: John Beckett <john.beckett@stericsson.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'include/linux/mmc')
-rw-r--r-- | include/linux/mmc/card.h | 10 | ||||
-rw-r--r-- | include/linux/mmc/mmc.h | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 6402d9224d6a..9478a6bf1bb1 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -71,6 +71,8 @@ struct mmc_ext_csd { | |||
71 | bool hpi_en; /* HPI enablebit */ | 71 | bool hpi_en; /* HPI enablebit */ |
72 | bool hpi; /* HPI support bit */ | 72 | bool hpi; /* HPI support bit */ |
73 | unsigned int hpi_cmd; /* cmd used as HPI */ | 73 | unsigned int hpi_cmd; /* cmd used as HPI */ |
74 | unsigned int boot_ro_lock; /* ro lock support */ | ||
75 | bool boot_ro_lockable; | ||
74 | u8 raw_partition_support; /* 160 */ | 76 | u8 raw_partition_support; /* 160 */ |
75 | u8 raw_erased_mem_count; /* 181 */ | 77 | u8 raw_erased_mem_count; /* 181 */ |
76 | u8 raw_ext_csd_structure; /* 194 */ | 78 | u8 raw_ext_csd_structure; /* 194 */ |
@@ -187,6 +189,10 @@ struct mmc_part { | |||
187 | unsigned int part_cfg; /* partition type */ | 189 | unsigned int part_cfg; /* partition type */ |
188 | char name[MAX_MMC_PART_NAME_LEN]; | 190 | char name[MAX_MMC_PART_NAME_LEN]; |
189 | bool force_ro; /* to make boot parts RO by default */ | 191 | bool force_ro; /* to make boot parts RO by default */ |
192 | unsigned int area_type; | ||
193 | #define MMC_BLK_DATA_AREA_MAIN (1<<0) | ||
194 | #define MMC_BLK_DATA_AREA_BOOT (1<<1) | ||
195 | #define MMC_BLK_DATA_AREA_GP (1<<2) | ||
190 | }; | 196 | }; |
191 | 197 | ||
192 | /* | 198 | /* |
@@ -265,12 +271,14 @@ struct mmc_card { | |||
265 | * This function fill contents in mmc_part. | 271 | * This function fill contents in mmc_part. |
266 | */ | 272 | */ |
267 | static inline void mmc_part_add(struct mmc_card *card, unsigned int size, | 273 | static inline void mmc_part_add(struct mmc_card *card, unsigned int size, |
268 | unsigned int part_cfg, char *name, int idx, bool ro) | 274 | unsigned int part_cfg, char *name, int idx, bool ro, |
275 | int area_type) | ||
269 | { | 276 | { |
270 | card->part[card->nr_parts].size = size; | 277 | card->part[card->nr_parts].size = size; |
271 | card->part[card->nr_parts].part_cfg = part_cfg; | 278 | card->part[card->nr_parts].part_cfg = part_cfg; |
272 | sprintf(card->part[card->nr_parts].name, name, idx); | 279 | sprintf(card->part[card->nr_parts].name, name, idx); |
273 | card->part[card->nr_parts].force_ro = ro; | 280 | card->part[card->nr_parts].force_ro = ro; |
281 | card->part[card->nr_parts].area_type = area_type; | ||
274 | card->nr_parts++; | 282 | card->nr_parts++; |
275 | } | 283 | } |
276 | 284 | ||
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 0e7135697d11..665548e639e8 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
@@ -280,6 +280,7 @@ struct _mmc_csd { | |||
280 | #define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ | 280 | #define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ |
281 | #define EXT_CSD_SANITIZE_START 165 /* W */ | 281 | #define EXT_CSD_SANITIZE_START 165 /* W */ |
282 | #define EXT_CSD_WR_REL_PARAM 166 /* RO */ | 282 | #define EXT_CSD_WR_REL_PARAM 166 /* RO */ |
283 | #define EXT_CSD_BOOT_WP 173 /* R/W */ | ||
283 | #define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ | 284 | #define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ |
284 | #define EXT_CSD_PART_CONFIG 179 /* R/W */ | 285 | #define EXT_CSD_PART_CONFIG 179 /* R/W */ |
285 | #define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ | 286 | #define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ |
@@ -321,6 +322,11 @@ struct _mmc_csd { | |||
321 | 322 | ||
322 | #define EXT_CSD_WR_REL_PARAM_EN (1<<2) | 323 | #define EXT_CSD_WR_REL_PARAM_EN (1<<2) |
323 | 324 | ||
325 | #define EXT_CSD_BOOT_WP_B_PWR_WP_DIS (0x40) | ||
326 | #define EXT_CSD_BOOT_WP_B_PERM_WP_DIS (0x10) | ||
327 | #define EXT_CSD_BOOT_WP_B_PERM_WP_EN (0x04) | ||
328 | #define EXT_CSD_BOOT_WP_B_PWR_WP_EN (0x01) | ||
329 | |||
324 | #define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) | 330 | #define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) |
325 | #define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) | 331 | #define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) |
326 | #define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) | 332 | #define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) |