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 /drivers/mmc/core | |
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 'drivers/mmc/core')
-rw-r--r-- | drivers/mmc/core/mmc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index fc1059bb6a08..006e932a3ae3 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -348,7 +348,8 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) | |||
348 | part_size = ext_csd[EXT_CSD_BOOT_MULT] << 17; | 348 | part_size = ext_csd[EXT_CSD_BOOT_MULT] << 17; |
349 | mmc_part_add(card, part_size, | 349 | mmc_part_add(card, part_size, |
350 | EXT_CSD_PART_CONFIG_ACC_BOOT0 + idx, | 350 | EXT_CSD_PART_CONFIG_ACC_BOOT0 + idx, |
351 | "boot%d", idx, true); | 351 | "boot%d", idx, true, |
352 | MMC_BLK_DATA_AREA_BOOT); | ||
352 | } | 353 | } |
353 | } | 354 | } |
354 | } | 355 | } |
@@ -435,7 +436,8 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) | |||
435 | hc_wp_grp_sz); | 436 | hc_wp_grp_sz); |
436 | mmc_part_add(card, part_size << 19, | 437 | mmc_part_add(card, part_size << 19, |
437 | EXT_CSD_PART_CONFIG_ACC_GP0 + idx, | 438 | EXT_CSD_PART_CONFIG_ACC_GP0 + idx, |
438 | "gp%d", idx, false); | 439 | "gp%d", idx, false, |
440 | MMC_BLK_DATA_AREA_GP); | ||
439 | } | 441 | } |
440 | } | 442 | } |
441 | card->ext_csd.sec_trim_mult = | 443 | card->ext_csd.sec_trim_mult = |
@@ -446,6 +448,14 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) | |||
446 | ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT]; | 448 | ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT]; |
447 | card->ext_csd.trim_timeout = 300 * | 449 | card->ext_csd.trim_timeout = 300 * |
448 | ext_csd[EXT_CSD_TRIM_MULT]; | 450 | ext_csd[EXT_CSD_TRIM_MULT]; |
451 | |||
452 | /* | ||
453 | * Note that the call to mmc_part_add above defaults to read | ||
454 | * only. If this default assumption is changed, the call must | ||
455 | * take into account the value of boot_locked below. | ||
456 | */ | ||
457 | card->ext_csd.boot_ro_lock = ext_csd[EXT_CSD_BOOT_WP]; | ||
458 | card->ext_csd.boot_ro_lockable = true; | ||
449 | } | 459 | } |
450 | 460 | ||
451 | if (card->ext_csd.rev >= 5) { | 461 | if (card->ext_csd.rev >= 5) { |