[PATCH 2/3] mci: treat unknown MMC version as greater than known versions
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Mar 2 08:37:41 PST 2026
Currently, unknown MMC revisions are assumed to be v4.0-compatible.
Instead let's assume newer eMMC revisions to be compatible with the
newest that's explicitly supported by assigning 0xFFF as versions, so
comparison for being greater than some version always evaluate true.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/mci/mci-core.c | 5 +++++
include/mci.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 54006b149c0a..517e4de1c6b0 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1155,6 +1155,8 @@ static void mci_correct_version_from_ext_csd(struct mci *mci)
{
if (!IS_SD(mci) && (mci->version >= MMC_VERSION_4) && mci->ext_csd) {
switch (mci->ext_csd[EXT_CSD_REV]) {
+ case 0:
+ mci->version = MMC_VERSION_4;
case 1:
mci->version = MMC_VERSION_4_1;
break;
@@ -1179,6 +1181,9 @@ static void mci_correct_version_from_ext_csd(struct mci *mci)
case 9:
mci->version = MMC_VERSION_5_1B;
break;
+ default:
+ mci->version = MMC_VERSION_MAX;
+ break;
}
}
}
diff --git a/include/mci.h b/include/mci.h
index b05571730ec2..fc418ec0a2ea 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -47,6 +47,7 @@
#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_VERSION_MAX (MMC_VERSION_MMC | 0xFFF)
#define MMC_CAP_SPI (1 << 0)
#define MMC_CAP_4_BIT_DATA (1 << 1)
--
2.47.3
More information about the barebox
mailing list