From: Jonathan Bell jonathan@raspberrypi.com
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: 1728e17762b9 ("mmc: core: sd: Apply BROKEN_SD_DISCARD quirk earlier") 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 Signed-off-by: Emanuele Ghidoli emanuele.ghidoli@toradex.com --- drivers/mmc/core/sd.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 592166e53dce..7b375cebc671 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -23,6 +23,7 @@ #include "host.h" #include "bus.h" #include "mmc_ops.h" +#include "quirks.h" #include "sd.h" #include "sd_ops.h"
@@ -1468,6 +1469,9 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, 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;