summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTomas Melin <tomas.melin@vaisala.com>2016-11-25 09:01:03 (GMT)
committerJaehoon Chung <jh80.chung@samsung.com>2016-12-01 02:09:44 (GMT)
commitcd3d48807dfb64f521fcbc30034d4e921d842a5b (patch)
treec0b1d7778cefb47b0af8cd5c5e8a42f882102529 /cmd
parentf0ecfc5e7e412c2098627cab2133fb2e284edfea (diff)
downloadu-boot-cd3d48807dfb64f521fcbc30034d4e921d842a5b.tar.xz
mmc: add bkops-enable command
Add new command that provides possibility to enable the background operations handshake functionality (BKOPS_EN, EXT_CSD byte [163]) on eMMC devices. This is an optional feature of eMMCs, the setting is write-once. The command must be explicitly taken into use with CONFIG_CMD_BKOPS_ENABLE. Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig9
-rw-r--r--cmd/mmc.c32
2 files changed, 41 insertions, 0 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index b16c603..7653c60 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -572,6 +572,15 @@ config SYS_AMBAPP_PRINT_ON_STARTUP
help
Show AMBA Plug-n-Play information on startup.
+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 b2761e9..b8dcc26 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -729,6 +729,31 @@ static int do_mmc_setdsr(cmd_tbl_t *cmdtp, int flag,
return ret;
}
+#ifdef CONFIG_CMD_BKOPS_ENABLE
+static int do_mmc_bkops_enable(cmd_tbl_t *cmdtp, int flag,
+ int argc, char * const argv[])
+{
+ int dev;
+ struct mmc *mmc;
+
+ if (argc != 2)
+ return CMD_RET_USAGE;
+
+ dev = simple_strtoul(argv[1], NULL, 10);
+
+ mmc = init_mmc_device(dev, false);
+ if (!mmc)
+ return CMD_RET_FAILURE;
+
+ if (IS_SD(mmc)) {
+ puts("BKOPS_EN only exists on eMMC\n");
+ return CMD_RET_FAILURE;
+ }
+
+ return mmc_set_bkops_enable(mmc);
+}
+#endif
+
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, "", ""),
@@ -749,6 +774,9 @@ static cmd_tbl_t cmd_mmc[] = {
U_BOOT_CMD_MKENT(rpmb, CONFIG_SYS_MAXARGS, 1, do_mmcrpmb, "", ""),
#endif
U_BOOT_CMD_MKENT(setdsr, 2, 0, do_mmc_setdsr, "", ""),
+#ifdef CONFIG_CMD_BKOPS_ENABLE
+ U_BOOT_CMD_MKENT(bkops-enable, 2, 0, do_mmc_bkops_enable, "", ""),
+#endif
};
static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -813,6 +841,10 @@ U_BOOT_CMD(
"mmc rpmb counter - read the value of the write counter\n"
#endif
"mmc setdsr <value> - set DSR register value\n"
+#ifdef CONFIG_CMD_BKOPS_ENABLE
+ "mmc bkops-enable <dev> - enable background operations handshake on device\n"
+ " WARNING: This is a write-once setting.\n"
+#endif
);
/* Old command kept for compatibility. Same as 'mmc info' */