[PATCH 1/3] mci: add support for eMMC v5.1b
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Mar 2 08:37:40 PST 2026
Newer eMMC versions than what barebox knows about appear to be
interpreted as v4.0, which would affect at least erase group
size determination and manufacturer date calculation.
Fix this by adding proper v5.1b support.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/mci/mci-core.c | 11 ++++++++++-
include/mci.h | 1 +
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 37d864b3d02f..54006b149c0a 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1176,6 +1176,9 @@ static void mci_correct_version_from_ext_csd(struct mci *mci)
case 8:
mci->version = MMC_VERSION_5_1;
break;
+ case 9:
+ mci->version = MMC_VERSION_5_1B;
+ break;
}
}
}
@@ -1436,7 +1439,7 @@ static char *mci_version_string(struct mci *mci)
n = sprintf(version, "%u.%u", major, minor);
/* Omit zero micro versions */
if (micro)
- sprintf(version + n, "%u", micro);
+ sprintf(version + n, "%X", micro);
return version;
}
@@ -2541,6 +2544,12 @@ static int mci_mmc_decode_cid(struct mci *card)
card->cid.year += 16;
}
+ if (card->version >= MMC_VERSION_5_1B) {
+ /* eMMC 5.1b: y field rolls over again after 2025 */
+ if (card->cid.year < 2023)
+ card->cid.year += 16;
+ }
+
return 0;
}
diff --git a/include/mci.h b/include/mci.h
index 50214aaae7bb..b05571730ec2 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -46,6 +46,7 @@
#define MMC_VERSION_4_5 (MMC_VERSION_MMC | 0x450)
#define MMC_VERSION_5_0 (MMC_VERSION_MMC | 0x500)
#define MMC_VERSION_5_1 (MMC_VERSION_MMC | 0x510)
+#define MMC_VERSION_5_1B (MMC_VERSION_MMC | 0x51B)
#define MMC_CAP_SPI (1 << 0)
#define MMC_CAP_4_BIT_DATA (1 << 1)
--
2.47.3
More information about the barebox
mailing list