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 8/8] mci: core: add partitioning_completed device parameter
Date: Tue, 14 Nov 2023 14:30:07 +0100	[thread overview]
Message-ID: <20231114133007.3662931-8-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20231114133007.3662931-1-m.felsch@pengutronix.de>

Add mmcX.partitioning_completed parameter so it can be queried by
scripts and board code.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/mci/mci-core.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 70e367997763..d20db925876e 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1968,6 +1968,22 @@ static int of_broken_cd_fixup(struct device_node *root, void *ctx)
 	return 0;
 }
 
+static int mci_get_partition_setting_completed(struct mci *mci)
+{
+	u8 *ext_csd;
+	int ret;
+
+	ext_csd = mci_get_ext_csd(mci);
+	if (IS_ERR(ext_csd))
+		return PTR_ERR(ext_csd);
+
+	ret = ext_csd[EXT_CSD_PARTITION_SETTING_COMPLETED];
+
+	free(ext_csd);
+
+	return ret;
+}
+
 /**
  * Probe an MCI card at the given host interface
  * @param mci MCI device instance
@@ -2079,6 +2095,13 @@ static int mci_card_probe(struct mci *mci)
 			dev_add_param_bool(&mci->dev, "boot_ack",
 					   mci_set_boot_ack, NULL,
 					   &mci->boot_ack_enable, mci);
+
+		ret = mci_get_partition_setting_completed(mci);
+		if (ret < 0)
+			dev_dbg(&mci->dev,
+				"Failed to determine EXT_CSD_PARTITION_SETTING_COMPLETED\n");
+		else
+			dev_add_param_bool_fixed(&mci->dev, "partitioning_completed", ret);
 	}
 
 	dev_dbg(&mci->dev, "SD Card successfully added\n");
-- 
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 ` [PATCH 4/8] commands: mmc: add partition_complete subcommand Marco Felsch
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 ` Marco Felsch [this message]
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-8-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