Skip to content
Snippets Groups Projects
Commit 4c9d2aaa authored by Jean-Jacques Hiblot's avatar Jean-Jacques Hiblot Committed by Jaehoon Chung
Browse files

mmc: Add a function to dump the mmc capabilities


This adds a simple helper function to display information (bus width and
mode) based on a capability mask. Useful for debug.

Signed-off-by: default avatarJean-Jacques Hiblot <jjhiblot@ti.com>
parent 35f9e196
No related branches found
No related tags found
No related merge requests found
...@@ -1136,6 +1136,30 @@ static void mmc_set_bus_width(struct mmc *mmc, uint width) ...@@ -1136,6 +1136,30 @@ static void mmc_set_bus_width(struct mmc *mmc, uint width)
mmc_set_ios(mmc); mmc_set_ios(mmc);
} }
#if CONFIG_IS_ENABLED(MMC_VERBOSE) || defined(DEBUG)
/*
* helper function to display the capabilities in a human
* friendly manner. The capabilities include bus width and
* supported modes.
*/
void mmc_dump_capabilities(const char *text, uint caps)
{
enum bus_mode mode;
printf("%s: widths [", text);
if (caps & MMC_MODE_8BIT)
printf("8, ");
if (caps & MMC_MODE_4BIT)
printf("4, ");
printf("1] modes [");
for (mode = MMC_LEGACY; mode < MMC_MODES_END; mode++)
if (MMC_CAP(mode) & caps)
printf("%s, ", mmc_mode_name(mode));
printf("\b\b]\n");
}
#endif
static int sd_select_bus_freq_width(struct mmc *mmc) static int sd_select_bus_freq_width(struct mmc *mmc)
{ {
int err; int err;
......
...@@ -426,6 +426,7 @@ enum bus_mode { ...@@ -426,6 +426,7 @@ enum bus_mode {
}; };
const char *mmc_mode_name(enum bus_mode mode); const char *mmc_mode_name(enum bus_mode mode);
void mmc_dump_capabilities(const char *text, uint caps);
/* /*
* With CONFIG_DM_MMC enabled, struct mmc can be accessed from the MMC device * With CONFIG_DM_MMC enabled, struct mmc can be accessed from the MMC device
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment