aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-04-22 08:58:41 -0400
committerTom Rini <trini@konsulko.com>2020-04-22 08:58:41 -0400
commit2b63959e30f23ef3088dbed6626341c6d8371a66 (patch)
tree1ea89ae7672fbb34886d05c0f6eabfea4d0e00d3 /cmd
parent2f2031e647564be8121c05507fbec8e6c5bc0e63 (diff)
parent2448c34f9fc26d3c459e6e7b28c6357656bfa287 (diff)
downloadu-boot-2b63959e30f23ef3088dbed6626341c6d8371a66.zip
u-boot-2b63959e30f23ef3088dbed6626341c6d8371a66.tar.gz
u-boot-2b63959e30f23ef3088dbed6626341c6d8371a66.tar.bz2
Merge tag 'mmc-2020-4-22' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
- iproc_sdhci memory leak fix and enable R1B resp quirk - more mmc cmds and several mmc updates from Heinirich - Use bounce buffer for tmio sdhci - Alignment check for tmio sdhci
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig26
-rw-r--r--cmd/mmc.c46
2 files changed, 61 insertions, 11 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 95a67e9..6ce9e55 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1060,21 +1060,34 @@ config CMD_MMC
help
MMC memory mapped support.
+if CMD_MMC
+
+config CMD_BKOPS_ENABLE
+ bool "mmc bkops enable"
+ depends on CMD_MMC
+ default n
+ help
+ Enable command for setting manual background operations handshake
+ on a eMMC device. The feature is optionally available on eMMC devices
+ conforming to standard >= 4.41.
+
config CMD_MMC_RPMB
bool "Enable support for RPMB in the mmc command"
- depends on CMD_MMC
+ depends on SUPPORT_EMMC_RPMB
help
Enable the commands for reading, writing and programming the
key for the Replay Protection Memory Block partition in eMMC.
config CMD_MMC_SWRITE
bool "mmc swrite"
- depends on CMD_MMC && MMC_WRITE
+ depends on MMC_WRITE
select IMAGE_SPARSE
help
Enable support for the "mmc swrite" command to write Android sparse
images to eMMC.
+endif
+
config CMD_MTD
bool "mtd"
depends on MTD
@@ -1607,15 +1620,6 @@ config CMD_BSP
option provides a way to control this. The commands that are enabled
vary depending on the board.
-config CMD_BKOPS_ENABLE
- bool "mmc bkops enable"
- depends on CMD_MMC
- default n
- help
- Enable command for setting manual background operations handshake
- on a eMMC device. The feature is optionally available on eMMC devices
- conforming to standard >= 4.41.
-
config CMD_BLOCK_CACHE
bool "blkcache - control and stats for block cache"
depends on BLOCK_CACHE
diff --git a/cmd/mmc.c b/cmd/mmc.c
index 1860a3f..6142ec8 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)
@@ -872,9 +896,30 @@ static int do_mmc_bkops_enable(cmd_tbl_t *cmdtp, int flag,
}
#endif
+static int do_mmc_boot_wp(cmd_tbl_t *cmdtp, int flag,
+ int argc, char * const argv[])
+{
+ int err;
+ struct mmc *mmc;
+
+ mmc = init_mmc_device(curr_device, false);
+ if (!mmc)
+ return CMD_RET_FAILURE;
+ if (IS_SD(mmc)) {
+ printf("It is not an eMMC device\n");
+ return CMD_RET_FAILURE;
+ }
+ err = mmc_boot_wp(mmc);
+ if (err)
+ return CMD_RET_FAILURE;
+ printf("boot areas protected\n");
+ return CMD_RET_SUCCESS;
+}
+
static cmd_tbl_t cmd_mmc[] = {
U_BOOT_CMD_MKENT(info, 1, 0, do_mmcinfo, "", ""),
U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
+ U_BOOT_CMD_MKENT(wp, 1, 0, do_mmc_boot_wp, "", ""),
#if CONFIG_IS_ENABLED(MMC_WRITE)
U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
@@ -944,6 +989,7 @@ U_BOOT_CMD(
"mmc part - lists available partition on current mmc device\n"
"mmc dev [dev] [part] - show or set current mmc device [partition]\n"
"mmc list - lists available devices\n"
+ "mmc wp - power on write protect booot partitions\n"
#if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
"mmc hwpartition [args...] - does hardware partitioning\n"
" arguments (sizes in 512-byte blocks):\n"