aboutsummaryrefslogtreecommitdiff
path: root/cmd/mmc.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-03-30 07:24:18 +0200
committerPeng Fan <peng.fan@nxp.com>2020-04-22 20:41:55 +0800
commitd5210e4589294b4c356e7c2ac598cda8d738aec8 (patch)
treeee13f4649420dc81bb3a90a4943bf5bbe2f44d5f /cmd/mmc.c
parent1601ea212623c9bdb479636bec9e7299b0cb14dd (diff)
downloadu-boot-d5210e4589294b4c356e7c2ac598cda8d738aec8.zip
u-boot-d5210e4589294b4c356e7c2ac598cda8d738aec8.tar.gz
u-boot-d5210e4589294b4c356e7c2ac598cda8d738aec8.tar.bz2
cmd: mmc: display write protect state of boot partition
Boot partitions of eMMC devices can be power on or permanently write protected. Let the 'mmc info' command display the protection state. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'cmd/mmc.c')
-rw-r--r--cmd/mmc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmd/mmc.c b/cmd/mmc.c
index 1860a3f..6d71208 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -54,6 +54,8 @@ static void print_mmcinfo(struct mmc *mmc)
if (!IS_SD(mmc) && mmc->version >= MMC_VERSION_4_41) {
bool has_enh = (mmc->part_support & ENHNCD_SUPPORT) != 0;
bool usr_enh = has_enh && (mmc->part_attr & EXT_CSD_ENH_USR);
+ u8 wp, ext_csd[MMC_MAX_BLOCK_LEN];
+ int ret;
#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
puts("HC WP Group Size: ");
@@ -90,6 +92,28 @@ static void print_mmcinfo(struct mmc *mmc)
putc('\n');
}
}
+ ret = mmc_send_ext_csd(mmc, ext_csd);
+ if (ret)
+ return;
+ wp = ext_csd[EXT_CSD_BOOT_WP_STATUS];
+ for (i = 0; i < 2; ++i) {
+ printf("Boot area %d is ", i);
+ switch (wp & 3) {
+ case 0:
+ printf("not write protected\n");
+ break;
+ case 1:
+ printf("power on protected\n");
+ break;
+ case 2:
+ printf("permanently protected\n");
+ break;
+ default:
+ printf("in reserved protection state\n");
+ break;
+ }
+ wp >>= 2;
+ }
}
}
static struct mmc *init_mmc_device(int dev, bool force_init)