diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index cf38a88a9..a18b555f2 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -939,6 +939,21 @@ out: return err; } +static char *mci_version_string(struct mci *mci) +{ + static char version[sizeof("x.xx")]; + unsigned major, minor, micro; + + major = (mci->version >> 8) & 0xf; + minor = (mci->version >> 4) & 0xf; + micro = mci->version & 0xf; + + sprintf(version, "%u.%u", major, + micro ? (minor << 4) | micro : minor); + + return version; +} + static int mci_startup_sd(struct mci *mci) { struct mci_cmd cmd; @@ -1140,8 +1155,8 @@ static int mci_startup(struct mci *mci) return err; mci_correct_version_from_ext_csd(mci); - printf("detected %s card version %d.%d\n", IS_SD(mci) ? "SD" : "MMC", - (mci->version >> 8) & 0xf, mci->version & 0xff); + dev_info(&mci->dev, "detected %s card version %s\n", IS_SD(mci) ? "SD" : "MMC", + mci_version_string(mci)); mci_extract_card_capacity_from_csd(mci); if (IS_SD(mci)) @@ -1477,13 +1492,8 @@ static void mci_info(struct device_d *dev) mci_print_caps(host->host_caps); printf("Card information:\n"); - if (mci->version < SD_VERSION_SD) { - printf(" Attached is a MultiMediaCard (Version: %u.%u)\n", - (mci->version >> 4) & 0xf, mci->version & 0xf); - } else { - printf(" Attached is an SD Card (Version: %u.%u)\n", - (mci->version >> 8) & 0xf, mci->version & 0xff); - } + printf(" Attached is a %s card\n", IS_SD(mci) ? "SD" : "MMC"); + printf(" Version: %s\n", mci_version_string(mci)); printf(" Capacity: %u MiB\n", (unsigned)(mci->capacity >> 20)); if (mci->high_capacity) diff --git a/include/mci.h b/include/mci.h index 40a712b4d..cd3e2c287 100644 --- a/include/mci.h +++ b/include/mci.h @@ -33,21 +33,21 @@ #define SD_VERSION_SD 0x20000 #define SD_VERSION_2 (SD_VERSION_SD | 0x200) #define SD_VERSION_1_0 (SD_VERSION_SD | 0x100) -#define SD_VERSION_1_10 (SD_VERSION_SD | 0x10a) +#define SD_VERSION_1_10 (SD_VERSION_SD | 0x1a0) /* Firmware revisions for MMC cards */ #define MMC_VERSION_MMC 0x10000 #define MMC_VERSION_UNKNOWN (MMC_VERSION_MMC) -#define MMC_VERSION_1_2 (MMC_VERSION_MMC | 0x102) -#define MMC_VERSION_1_4 (MMC_VERSION_MMC | 0x104) -#define MMC_VERSION_2_2 (MMC_VERSION_MMC | 0x202) +#define MMC_VERSION_1_2 (MMC_VERSION_MMC | 0x120) +#define MMC_VERSION_1_4 (MMC_VERSION_MMC | 0x140) +#define MMC_VERSION_2_2 (MMC_VERSION_MMC | 0x220) #define MMC_VERSION_3 (MMC_VERSION_MMC | 0x300) #define MMC_VERSION_4 (MMC_VERSION_MMC | 0x400) -#define MMC_VERSION_4_1 (MMC_VERSION_MMC | 0x401) -#define MMC_VERSION_4_2 (MMC_VERSION_MMC | 0x402) -#define MMC_VERSION_4_3 (MMC_VERSION_MMC | 0x403) -#define MMC_VERSION_4_41 (MMC_VERSION_MMC | 0x429) -#define MMC_VERSION_4_5 (MMC_VERSION_MMC | 0x405) +#define MMC_VERSION_4_1 (MMC_VERSION_MMC | 0x410) +#define MMC_VERSION_4_2 (MMC_VERSION_MMC | 0x420) +#define MMC_VERSION_4_3 (MMC_VERSION_MMC | 0x430) +#define MMC_VERSION_4_41 (MMC_VERSION_MMC | 0x441) +#define MMC_VERSION_4_5 (MMC_VERSION_MMC | 0x450) #define MMC_CAP_SPI (1 << 0) #define MMC_CAP_4_BIT_DATA (1 << 1)