]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mmc: core: apply SD quirks earlier during probe
authorJonathan Bell <jonathan@raspberrypi.com>
Tue, 20 Aug 2024 23:06:31 +0000 (08:06 +0900)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 26 Aug 2024 11:07:26 +0000 (13:07 +0200)
Applying MMC_QUIRK_BROKEN_SD_CACHE is broken, as the card's SD quirks are
referenced in sd_parse_ext_reg_perf() prior to the quirks being initialized
in mmc_blk_probe().

To fix this problem, let's split out an SD-specific list of quirks and
apply in mmc_sd_init_card() instead. In this way, sd_read_ext_regs() to has
the available information for not assigning the SD_EXT_PERF_CACHE as one of
the (un)supported features, which in turn allows mmc_sd_init_card() to
properly skip execution of sd_enable_cache().

Fixes: c467c8f08185 ("mmc: Add MMC_QUIRK_BROKEN_SD_CACHE for Kingston Canvas Go Plus from 11/2019")
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Co-developed-by: Keita Aihara <keita.aihara@sony.com>
Signed-off-by: Keita Aihara <keita.aihara@sony.com>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240820230631.GA436523@sony.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/quirks.h
drivers/mmc/core/sd.c

index cca71867bc4ad6075d24ed617aa83fbe9752f6dd..92905fc46436dd107563d7ec2985780539e385a0 100644 (file)
 
 #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
+};
+
 static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
 #define INAND_CMD38_ARG_EXT_CSD  113
 #define INAND_CMD38_ARG_ERASE    0x00
@@ -53,15 +66,6 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
        MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_BLK_NO_CMD23),
 
-       /*
-        * 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),
-
        /*
         * Some SD cards lockup while using CMD23 multiblock transfers.
         */
index 1c8148cdda505dfff57103a694c6a92462927fd0..ee37ad14e79eeadd797160c03ee551afe015ec3f 100644 (file)
@@ -26,6 +26,7 @@
 #include "host.h"
 #include "bus.h"
 #include "mmc_ops.h"
+#include "quirks.h"
 #include "sd.h"
 #include "sd_ops.h"
 
@@ -1475,6 +1476,9 @@ retry:
                        goto free_card;
        }
 
+       /* Apply quirks prior to card setup */
+       mmc_fixup_device(card, mmc_sd_fixups);
+
        err = mmc_sd_setup_card(host, card, oldcard != NULL);
        if (err)
                goto free_card;