]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: core: Add quirk for incorrect manufacturing date
authorAvri Altman <avri.altman@sandisk.com>
Tue, 5 May 2026 10:02:49 +0000 (06:02 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 May 2026 13:31:19 +0000 (15:31 +0200)
[ Upstream commit 263ff314cc5602599d481b0912a381555fcbad28 ]

Some eMMC vendors need to report manufacturing dates beyond 2025 but are
reluctant to update the EXT_CSD revision from 8 to 9. Changing the
Updating the EXT_CSD revision may involve additional testing or
qualification steps with customers. To ease this transition and avoid a
full re-qualification process, a workaround is needed. This
patch introduces a temporary quirk that re-purposes the year codes
corresponding to 2010, 2011, and 2012 to represent the years 2026, 2027,
and 2028, respectively. This solution is only valid for this three-year
period.

After 2028, vendors must update their firmware to set EXT_CSD_REV=9 to
continue reporting the correct manufacturing date in compliance with the
JEDEC standard.

The `MMC_QUIRK_BROKEN_MDT` is introduced and enabled for all Sandisk
devices to handle this behavior.

Signed-off-by: Avri Altman <avri.altman@sandisk.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Stable-dep-of: d6bf2e64dec8 ("mmc: core: Optimize time for secure erase/trim for some Kingston eMMCs")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/core/card.h
drivers/mmc/core/mmc.c
drivers/mmc/core/quirks.h
include/linux/mmc/card.h

index 1200951bab08c2e18ce96becf56693e696b9f30b..a9619dd45270840143533e710a0a8f555a8d67be 100644 (file)
@@ -89,6 +89,7 @@ struct mmc_fixup {
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
 #define CID_MANFID_APACER       0x27
+#define CID_MANFID_SANDISK_MMC  0x45
 #define CID_MANFID_SWISSBIT     0x5D
 #define CID_MANFID_KINGSTON     0x70
 #define CID_MANFID_HYNIX       0x90
@@ -305,4 +306,9 @@ static inline int mmc_card_no_uhs_ddr50_tuning(const struct mmc_card *c)
        return c->quirks & MMC_QUIRK_NO_UHS_DDR50_TUNING;
 }
 
+static inline int mmc_card_broken_mdt(const struct mmc_card *c)
+{
+       return c->quirks & MMC_QUIRK_BROKEN_MDT;
+}
+
 #endif
index f744dd501842821dba982b2ecf40f3d9a8c034ac..8846550a8892a55545c97458e3909173b44c2a01 100644 (file)
@@ -676,6 +676,11 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
                        /* Adjust production date as per JEDEC JESD84-B51B September 2025 */
                        if (card->cid.year < 2023)
                                card->cid.year += 16;
+               } else {
+                       /* Handle vendors with broken MDT reporting */
+                       if (mmc_card_broken_mdt(card) && card->cid.year >= 2010 &&
+                           card->cid.year <= 2012)
+                               card->cid.year += 16;
                }
        }
 
index c417ed34c05767dbb4818aa153683b04577a32dc..f5e8a0f6d11b936d465b51f22614f2c30c2752fb 100644 (file)
@@ -170,6 +170,9 @@ static const struct mmc_fixup __maybe_unused mmc_ext_csd_fixups[] = {
        MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX,
                              0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
 
+       MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_MMC, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_BROKEN_MDT),
+
        END_FIXUP
 };
 
index e9e964c20e5307fa91000c1af34dda36faac0ff5..4722dd7e46ce10d9fff65d3f819bae3d8ff91945 100644 (file)
@@ -329,6 +329,7 @@ struct mmc_card {
 #define MMC_QUIRK_BROKEN_CACHE_FLUSH   (1<<16) /* Don't flush cache until the write has occurred */
 #define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY    (1<<17) /* Disable broken SD poweroff notify support */
 #define MMC_QUIRK_NO_UHS_DDR50_TUNING  (1<<18) /* Disable DDR50 tuning */
+#define MMC_QUIRK_BROKEN_MDT    (1<<19) /* Wrong manufacturing year */
 
        bool                    written_flag;   /* Indicates eMMC has been written since power on */
        bool                    reenable_cmdq;  /* Re-enable Command Queue */