mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/8] commands: mmc: add partition_complete subcommand
Date: Tue, 14 Nov 2023 14:30:03 +0100	[thread overview]
Message-ID: <20231114133007.3662931-4-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20231114133007.3662931-1-m.felsch@pengutronix.de>

From: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>

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@leica-geosystems.com.cn>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 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




  parent reply	other threads:[~2023-11-14 13:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 13:30 [PATCH 1/8] mci: correct ENH_ATTRIBUTE_EN_MASK bit mask Marco Felsch
2023-11-14 13:30 ` [PATCH 2/8] mci: core: check switch error for switch command Marco Felsch
2023-11-14 13:30 ` [PATCH 3/8] commands: mmc: add write_reliability subcommand Marco Felsch
2023-11-14 13:30 ` Marco Felsch [this message]
2023-11-14 13:30 ` [PATCH 5/8] commands: mmc: deprecate -c option Marco Felsch
2023-11-14 13:30 ` [PATCH 6/8] mci: export mci_get_ext_csd as helper Marco Felsch
2023-11-14 13:30 ` [PATCH 7/8] mci: core: cosmetic cleanup mci_register Marco Felsch
2023-11-14 13:30 ` [PATCH 8/8] mci: core: add partitioning_completed device parameter Marco Felsch
2023-11-15 13:05 ` [PATCH 1/8] mci: correct ENH_ATTRIBUTE_EN_MASK bit mask Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231114133007.3662931-4-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox