Skip to content

Commit ef48d87

Browse files
avri-altman-sndkgregkh
authored andcommitted
mmc: core: Add quirk for incorrect manufacturing date
[ Upstream commit 263ff31 ] 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: d6bf2e6 ("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>
1 parent 7c57c2d commit ef48d87

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/mmc/core/card.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ struct mmc_fixup {
8989
#define CID_MANFID_MICRON 0x13
9090
#define CID_MANFID_SAMSUNG 0x15
9191
#define CID_MANFID_APACER 0x27
92+
#define CID_MANFID_SANDISK_MMC 0x45
9293
#define CID_MANFID_SWISSBIT 0x5D
9394
#define CID_MANFID_KINGSTON 0x70
9495
#define CID_MANFID_HYNIX 0x90
@@ -305,4 +306,9 @@ static inline int mmc_card_no_uhs_ddr50_tuning(const struct mmc_card *c)
305306
return c->quirks & MMC_QUIRK_NO_UHS_DDR50_TUNING;
306307
}
307308

309+
static inline int mmc_card_broken_mdt(const struct mmc_card *c)
310+
{
311+
return c->quirks & MMC_QUIRK_BROKEN_MDT;
312+
}
313+
308314
#endif

drivers/mmc/core/mmc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,11 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
676676
/* Adjust production date as per JEDEC JESD84-B51B September 2025 */
677677
if (card->cid.year < 2023)
678678
card->cid.year += 16;
679+
} else {
680+
/* Handle vendors with broken MDT reporting */
681+
if (mmc_card_broken_mdt(card) && card->cid.year >= 2010 &&
682+
card->cid.year <= 2012)
683+
card->cid.year += 16;
679684
}
680685
}
681686

drivers/mmc/core/quirks.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ static const struct mmc_fixup __maybe_unused mmc_ext_csd_fixups[] = {
170170
MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX,
171171
0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
172172

173+
MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_MMC, CID_OEMID_ANY, add_quirk_mmc,
174+
MMC_QUIRK_BROKEN_MDT),
175+
173176
END_FIXUP
174177
};
175178

include/linux/mmc/card.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ struct mmc_card {
329329
#define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16) /* Don't flush cache until the write has occurred */
330330
#define MMC_QUIRK_BROKEN_SD_POWEROFF_NOTIFY (1<<17) /* Disable broken SD poweroff notify support */
331331
#define MMC_QUIRK_NO_UHS_DDR50_TUNING (1<<18) /* Disable DDR50 tuning */
332+
#define MMC_QUIRK_BROKEN_MDT (1<<19) /* Wrong manufacturing year */
332333

333334
bool written_flag; /* Indicates eMMC has been written since power on */
334335
bool reenable_cmdq; /* Re-enable Command Queue */

0 commit comments

Comments
 (0)