This reverts commit 08ebf903af57cda6d773f3dd1671b64f73b432b8. On STM32MP153C DHCOR DRC Compact with microSD card Kingston Canvas Go! Plus MicroSDXC I 64 GiB U3/V30/A2 SDCG3/64GB it is no longer possible to mount ext4 filesystem. Git bisect points to this commit which is being reverted here. A bit of investigation shows that for non-working microSD cards cache_enabled=TRUE fua_enabled=false For working microSD card (Kingston Canvas React Plus, MicroSDXC II 64 GiB U3/V90/A1 SDCR2/64GB) cache_enabled=FALSE fua_enabled=false It seems enabling the cache for SD cards causes the issue. Before the reverted commit, the cache was not reported enabled for SD cards. I am not sure whether such blunt revert is the correct solution however, any ideas ? Signed-off-by: Marek Vasut <marex@xxxxxxx> --- Cc: "Christian Löhle" <CLoehle@xxxxxxxxxxxxxx> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx> Cc: Avri Altman <avri.altman@xxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Marek Vasut <marex@xxxxxxx> Cc: Michael Wu <michael@xxxxxxxxxxxxxxxxx> Cc: Ming Lei <ming.lei@xxxxxxxxxx> Cc: Seunghui Lee <sh043.lee@xxxxxxxxxxx> Cc: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Cc: linux-mmc@xxxxxxxxxxxxxxx --- drivers/mmc/core/block.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index db6d8a0999100..72aa47af11d37 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2413,8 +2413,6 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, struct mmc_blk_data *md; int devidx, ret; char cap_str[10]; - bool cache_enabled = false; - bool fua_enabled = false; devidx = ida_simple_get(&mmc_blk_ida, 0, max_devices, GFP_KERNEL); if (devidx < 0) { @@ -2494,17 +2492,13 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, md->flags |= MMC_BLK_CMD23; } - if (md->flags & MMC_BLK_CMD23 && + if (mmc_card_mmc(card) && + md->flags & MMC_BLK_CMD23 && ((card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN) || card->ext_csd.rel_sectors)) { md->flags |= MMC_BLK_REL_WR; - fua_enabled = true; - cache_enabled = true; + blk_queue_write_cache(md->queue.queue, true, true); } - if (mmc_cache_enabled(card->host)) - cache_enabled = true; - - blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled); string_get_size((u64)size, 512, STRING_UNITS_2, cap_str, sizeof(cap_str)); -- 2.39.2