summaryrefslogtreecommitdiff
path: root/common/cmd_mmc.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-02-07 14:15:20 -0500
committerPantelis Antoniou <panto@antoniou-consulting.com>2014-04-02 13:02:58 +0300
commit33ace362fdf80e2e2ea4cdf2829a5179c52de3f4 (patch)
treef7aaebbd0705f03361cfbb13d0e4441b44384b82 /common/cmd_mmc.c
parent74c32ef58dbcc204af03f5d7188b5cea3959974c (diff)
downloadu-boot-imx-33ace362fdf80e2e2ea4cdf2829a5179c52de3f4.zip
u-boot-imx-33ace362fdf80e2e2ea4cdf2829a5179c52de3f4.tar.gz
u-boot-imx-33ace362fdf80e2e2ea4cdf2829a5179c52de3f4.tar.bz2
mmc: Add 'mmc rst-function' sub-command
Some eMMC chips may need the RST_n_FUNCTION bit set to a non-zero value in order for warm reset of the system to work. Details on this being required will be part of the eMMC datasheet. Also add using this command to the dra7xx README. * Whitespace fix by panto Signed-off-by: Tom Rini <trini@ti.com> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Diffstat (limited to 'common/cmd_mmc.c')
-rw-r--r--common/cmd_mmc.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index bd1edc8..c1916c9 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -330,6 +330,40 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("EMMC boot partition Size change Failed.\n");
return 1;
}
+ } else if (strcmp(argv[1], "rst-function") == 0) {
+ /*
+ * Set the RST_n_ENABLE bit of RST_n_FUNCTION
+ * The only valid values are 0x0, 0x1 and 0x2 and writing
+ * a value of 0x1 or 0x2 sets the value permanently.
+ */
+ int dev;
+ struct mmc *mmc;
+ u8 enable;
+
+ if (argc == 4) {
+ dev = simple_strtoul(argv[2], NULL, 10);
+ enable = simple_strtoul(argv[3], NULL, 10);
+ } else {
+ return CMD_RET_USAGE;
+ }
+
+ if (enable > 2 || enable < 0) {
+ puts("Invalid RST_n_ENABLE value\n");
+ return CMD_RET_USAGE;
+ }
+
+ mmc = find_mmc_device(dev);
+ if (!mmc) {
+ printf("no mmc device at slot %x\n", dev);
+ return 1;
+ }
+
+ if (IS_SD(mmc)) {
+ puts("RST_n_FUNCTION only exists on eMMC\n");
+ return 1;
+ }
+
+ return mmc_set_rst_n_function(mmc, enable);
#endif /* CONFIG_SUPPORT_EMMC_BOOT */
}
@@ -436,6 +470,9 @@ U_BOOT_CMD(
" - Change sizes of boot and RPMB partitions of specified device\n"
"mmc partconf dev boot_ack boot_partition partition_access\n"
" - Change the bits of the PARTITION_CONFIG field of the specified device\n"
+ "mmc rst-function dev value\n"
+ " - Change the RST_n_FUNCTION field of the specified device\n"
+ " WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.\n"
#endif
"mmc setdsr - set DSR register value\n"
);