diff options
author | Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> | 2022-04-25 21:59:02 +0800 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2022-07-27 15:19:09 +0900 |
commit | 19a29ff362d4cc9e7f420021de57e3193812d4c6 (patch) | |
tree | d88db226f2c9f2169f4a4ec2e40d7cdad9c308b0 /drivers/mmc/mmc.c | |
parent | 3363a73ddfcda752256b8c06ffde75f6b8d5b819 (diff) |
drivers: mmc: write protect single boot area
Add features to write protect single boot area rather than all boot
areas.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r-- | drivers/mmc/mmc.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 12d29da528..8efee9977e 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -863,6 +863,33 @@ int mmc_boot_wp(struct mmc *mmc) return mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_WP, 1); } +int mmc_boot_wp_single_partition(struct mmc *mmc, int partition) +{ + u8 value; + int ret; + + value = EXT_CSD_BOOT_WP_B_PWR_WP_EN; + + if (partition == 0) { + value |= EXT_CSD_BOOT_WP_B_SEC_WP_SEL; + ret = mmc_switch(mmc, + EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_BOOT_WP, + value); + } else if (partition == 1) { + value |= EXT_CSD_BOOT_WP_B_SEC_WP_SEL; + value |= EXT_CSD_BOOT_WP_B_PWR_WP_SEC_SEL; + ret = mmc_switch(mmc, + EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_BOOT_WP, + value); + } else { + ret = mmc_boot_wp(mmc); + } + + return ret; +} + #if !CONFIG_IS_ENABLED(MMC_TINY) static int mmc_set_card_speed(struct mmc *mmc, enum bus_mode mode, bool hsdowngrade) |