From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 6/8] mci: export mci_get_ext_csd as helper
Date: Tue, 14 Nov 2023 14:30:05 +0100 [thread overview]
Message-ID: <20231114133007.3662931-6-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20231114133007.3662931-1-m.felsch@pengutronix.de>
Make the mci_get_ext_csd() function a helper to make it usable for
others.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
commands/mmc.c | 17 -----------------
drivers/mci/mci-core.c | 17 +++++++++++++++++
include/mci.h | 1 +
3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/commands/mmc.c b/commands/mmc.c
index 4259dbb763d1..fa01b89cdf42 100644
--- a/commands/mmc.c
+++ b/commands/mmc.c
@@ -65,23 +65,6 @@ static int mmc_partitioning_complete(struct mci *mci)
return ret;
}
-static u8 *mci_get_ext_csd(struct mci *mci)
-{
- u8 *ext_csd;
- int ret;
-
- ext_csd = xmalloc(512);
-
- ret = mci_send_ext_csd(mci, ext_csd);
- if (ret) {
- printf("Failure to read EXT_CSD register\n");
- free(ext_csd);
- return ERR_PTR(-EIO);
- }
-
- return ext_csd;
-}
-
/* enh_area [-c] /dev/mmcX */
static int do_mmc_enh_area(int argc, char *argv[])
{
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 1276920e1604..8ce97b5d5cdd 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -518,6 +518,23 @@ int mci_switch(struct mci *mci, unsigned index, unsigned value)
return 0;
}
+u8 *mci_get_ext_csd(struct mci *mci)
+{
+ u8 *ext_csd;
+ int ret;
+
+ ext_csd = xmalloc(512);
+
+ ret = mci_send_ext_csd(mci, ext_csd);
+ if (ret) {
+ printf("Failure to read EXT_CSD register\n");
+ free(ext_csd);
+ return ERR_PTR(-EIO);
+ }
+
+ return ext_csd;
+}
+
static blkcnt_t mci_calc_blk_cnt(blkcnt_t cap, unsigned shift)
{
blkcnt_t ret = cap >> shift;
diff --git a/include/mci.h b/include/mci.h
index 4fed8d739284..1ef44a3a76b0 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -545,6 +545,7 @@ void mci_of_parse_node(struct mci_host *host, struct device_node *np);
int mci_detect_card(struct mci_host *);
int mci_send_ext_csd(struct mci *mci, char *ext_csd);
int mci_switch(struct mci *mci, unsigned index, unsigned value);
+u8 *mci_get_ext_csd(struct mci *mci);
static inline int mmc_host_is_spi(struct mci_host *host)
{
--
2.39.2
next prev 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 ` Marco Felsch [this message]
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-6-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