Skip to content

Commit 469e5e4

Browse files
P33Mstorulf
authored andcommitted
mmc: core: apply SD quirks earlier during probe
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: c467c8f ("mmc: Add MMC_QUIRK_BROKEN_SD_CACHE for Kingston Canvas Go Plus from 11/2019") Signed-off-by: Jonathan Bell <[email protected]> Co-developed-by: Keita Aihara <[email protected]> Signed-off-by: Keita Aihara <[email protected]> Reviewed-by: Dragan Simic <[email protected]> Reviewed-by: Avri Altman <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 5be63fc commit 469e5e4

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

drivers/mmc/core/quirks.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515

1616
#include "card.h"
1717

18+
static const struct mmc_fixup __maybe_unused mmc_sd_fixups[] = {
19+
/*
20+
* Kingston Canvas Go! Plus microSD cards never finish SD cache flush.
21+
* This has so far only been observed on cards from 11/2019, while new
22+
* cards from 2023/05 do not exhibit this behavior.
23+
*/
24+
_FIXUP_EXT("SD64G", CID_MANFID_KINGSTON_SD, 0x5449, 2019, 11,
25+
0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd,
26+
MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY),
27+
28+
END_FIXUP
29+
};
30+
1831
static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
1932
#define INAND_CMD38_ARG_EXT_CSD 113
2033
#define INAND_CMD38_ARG_ERASE 0x00
@@ -53,15 +66,6 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
5366
MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
5467
MMC_QUIRK_BLK_NO_CMD23),
5568

56-
/*
57-
* Kingston Canvas Go! Plus microSD cards never finish SD cache flush.
58-
* This has so far only been observed on cards from 11/2019, while new
59-
* cards from 2023/05 do not exhibit this behavior.
60-
*/
61-
_FIXUP_EXT("SD64G", CID_MANFID_KINGSTON_SD, 0x5449, 2019, 11,
62-
0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd,
63-
MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY),
64-
6569
/*
6670
* Some SD cards lockup while using CMD23 multiblock transfers.
6771
*/

drivers/mmc/core/sd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "host.h"
2727
#include "bus.h"
2828
#include "mmc_ops.h"
29+
#include "quirks.h"
2930
#include "sd.h"
3031
#include "sd_ops.h"
3132

@@ -1475,6 +1476,9 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
14751476
goto free_card;
14761477
}
14771478

1479+
/* Apply quirks prior to card setup */
1480+
mmc_fixup_device(card, mmc_sd_fixups);
1481+
14781482
err = mmc_sd_setup_card(host, card, oldcard != NULL);
14791483
if (err)
14801484
goto free_card;

0 commit comments

Comments
 (0)