From: LI Qingwu <Qing-wu.Li@xxxxxxxxxxxxxxxxxxxxxxx> A separate command is less error prone in case both the "write reliability" and the "enhanced area" feature should be set. Signed-off-by: LI Qingwu <Qing-wu.Li@xxxxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> --- commands/mmc.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/commands/mmc.c b/commands/mmc.c index 1009b16bfdf7..4e7d03231023 100644 --- a/commands/mmc.c +++ b/commands/mmc.c @@ -208,6 +208,34 @@ static int do_mmc_write_reliability(int argc, char *argv[]) return COMMAND_ERROR; } +static int do_mmc_partition_complete(int argc, char *argv[]) +{ + const char *devpath; + struct mci *mci; + int ret; + + if (argc - optind != 1) { + printf("Usage: mmc partition_complete /dev/mmcX\n"); + return COMMAND_ERROR_USAGE; + } + + devpath = argv[optind]; + + mci = mci_get_device_by_devpath(devpath); + if (!mci) { + printf("Failure to open %s as mci device\n", devpath); + return COMMAND_ERROR_USAGE; + } + + ret = mmc_partitioning_complete(mci); + if (ret) + return COMMAND_ERROR; + + printf("Now power cycle the device to let it reconfigure itself.\n"); + + return COMMAND_SUCCESS; +} + static struct { const char *cmd; int (*func)(int argc, char *argv[]); @@ -218,6 +246,9 @@ static struct { }, { .cmd = "write_reliability", .func = do_mmc_write_reliability, + }, { + .cmd = "partition_complete", + .func = do_mmc_partition_complete, } }; @@ -255,11 +286,13 @@ BAREBOX_CMD_HELP_TEXT("Note, with -c this is an irreversible action.") BAREBOX_CMD_HELP_OPT("-c", "complete partitioning") BAREBOX_CMD_HELP_TEXT("") BAREBOX_CMD_HELP_TEXT("The subcommand write_reliability enable write reliability") +BAREBOX_CMD_HELP_TEXT("") +BAREBOX_CMD_HELP_TEXT("The subcommand partition_complete set PARTITION_SETTING_COMPLETED (irreversible action)") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(mmc) .cmd = do_mmc, - BAREBOX_CMD_OPTS("write_reliability|enh_area [-c] /dev/mmcX") + BAREBOX_CMD_OPTS("partition_complete|write_reliability|enh_area [-c] /dev/mmcX") BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP) BAREBOX_CMD_HELP(cmd_mmc_help) BAREBOX_CMD_END -- 2.39.2