[PATCH] mmc: core: apply SD quirks earlier during probe

From: Olexa Bilaniuk
Date: Wed Sep 18 2024 - 10:52:34 EST


> diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
> index cca71867bc4a..92905fc46436 100644
> --- a/drivers/mmc/core/quirks.h
> +++ b/drivers/mmc/core/quirks.h
> @@ -15,6 +15,19 @@
>
> #include "card.h"
>
> +static const struct mmc_fixup __maybe_unused mmc_sd_fixups[] = {
> + /*
> + * Kingston Canvas Go! Plus microSD cards never finish SD cache flush.
> + * This has so far only been observed on cards from 11/2019, while new
> + * cards from 2023/05 do not exhibit this behavior.
> + */
> + _FIXUP_EXT("SD64G", CID_MANFID_KINGSTON_SD, 0x5449, 2019, 11,
> + 0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd,
> + MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY),
> +
> + END_FIXUP
> +};
> +

By happenstance I have just such a Kingston Canvas Go! Plus card, but
in standard SD form-factor and not microSD, and dating from *08/2021*.
I had heretofore-inexplicable filesystem corruption problems with this
card that may well be attributable to a failure to flush the cache.
Despite diligence in issuing an explicit "sync" before ejecting, the
filesystem would reliably appear corrupt after reconnecting it, and
would require a "fsck", but no bad blocks could be identified.

The vitals of my card are:

type: SD
name: SD64G
date: 08/2021
manfid: 0x00009f (Kingston)
oemid: 0x5449
fwrev: 0x1
hwrev: 0x6
csd: 400e00325b590001cf9f7f800a400001
ocr: 0x00300000

I think the quirk here can be safely broadened to all variants of
this card and to the date range 11/2019 - 08/2021 inclusive.


Sincerely,
Olexa Bilaniuk