[PATCH 6/8] mci: export mci_get_ext_csd as helper
Marco Felsch
m.felsch at pengutronix.de
Tue Nov 14 05:30:05 PST 2023
Make the mci_get_ext_csd() function a helper to make it usable for
others.
Signed-off-by: Marco Felsch <m.felsch at 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
More information about the barebox
mailing list