summaryrefslogtreecommitdiff
path: root/common/cmd_mmc.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-02-05 10:24:21 -0500
committerPantelis Antoniou <panto@antoniou-consulting.com>2014-02-07 18:17:49 +0200
commit792970b0a344d905848fb98564ed469786af11b7 (patch)
tree89f7479dc39b8e4cbab50f293626b148bd5e0ae7 /common/cmd_mmc.c
parentf1fd957e12d9952702228c509cba1fa24858c98d (diff)
downloadu-boot-imx-792970b0a344d905848fb98564ed469786af11b7.zip
u-boot-imx-792970b0a344d905848fb98564ed469786af11b7.tar.gz
u-boot-imx-792970b0a344d905848fb98564ed469786af11b7.tar.bz2
cmd_mmc.c: Add 'partconf' command to mmc
Add a partconf sub-command to the mmc command to allow for setting the boot_ack, boot_partition and partition_access fields of PARTITION_CONFIG (formerly BOOT_CONFIG, EXT_CSD[179]). Part of this requires changing the check for 'part' from an strncmp to a strcmp, like the rest of the sub-commands. Cc: Andy Fleming <afleming@gmail.com> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Tom Rini <trini@ti.com> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Diffstat (limited to 'common/cmd_mmc.c')
-rw-r--r--common/cmd_mmc.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index a322063..5842e85 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -195,7 +195,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
else
return 0;
- } else if (strncmp(argv[1], "part", 4) == 0) {
+ } else if (strcmp(argv[1], "part") == 0) {
block_dev_desc_t *mmc_dev;
struct mmc *mmc;
@@ -311,7 +311,33 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* acknowledge to be sent during boot operation */
return boot_part_access(mmc, 1, part_num, access);
+ } else if (strcmp(argv[1], "partconf") == 0) {
+ int dev;
+ struct mmc *mmc;
+ u8 ack, part_num, access;
+
+ if (argc == 6) {
+ dev = simple_strtoul(argv[2], NULL, 10);
+ ack = simple_strtoul(argv[3], NULL, 10);
+ part_num = simple_strtoul(argv[4], NULL, 10);
+ access = simple_strtoul(argv[5], NULL, 10);
+ } else {
+ 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("PARTITION_CONFIG only exists on eMMC\n");
+ return 1;
+ }
+
+ /* acknowledge to be sent during boot operation */
+ return mmc_set_part_conf(mmc, ack, part_num, access);
} else if (strcmp(argv[1], "bootpart-resize") == 0) {
int dev;
struct mmc *mmc;
@@ -451,6 +477,8 @@ U_BOOT_CMD(
" - Enable boot_part for booting and disable access to boot_part\n"
"mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>\n"
" - 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"
#endif
"mmc setdsr - set DSR register value\n"
);