From: Karel Balej Date: Sun, 28 Jan 2024 18:24:03 +0000 (+0100) Subject: DONOTMERGE: mmc: core: force-disable cache X-Git-Url: https://git.dujemihanovic.xyz/?a=commitdiff_plain;h=3b6392da1ba980ab49e4d3031eb66542bf99fcf1;p=linux.git DONOTMERGE: mmc: core: force-disable cache This is a workaround for the card initialization error: mmc0: SDHCI controller on d4281000.mmc [d4281000.mmc] using ADMA mmc0: Card stuck being busy! __mmc_poll_for_busy mmc0: error -110 whilst initialising MMC card mmc0: Tuning failed, falling back to fixed sampling clock mmc0: Card stuck being busy! __mmc_poll_for_busy mmc0: error -110 whilst initialising MMC card mmc0: Card stuck being busy! __mmc_poll_for_busy mmc0: error -110 whilst initialising MMC card mmc0: Card stuck being busy! __mmc_poll_for_busy mmc0: error -110 whilst initialising MMC card mmc0: Failed to initialize a non-removable card This error does not occur when the card is forced to DDR_1_8V but if caching is not disabled, the following errors occur: [ 0.210673] mmc0: SDHCI controller on d4281000.mmc [d4281000.mmc] using ADMA [ 0.301489] mmc0: new DDR MMC card at address 0001 [ 0.302156] mmcblk0: mmc0:0001 QNW00A 7.28 GiB [ 0.308976] mmcblk0boot0: mmc0:0001 QNW00A 4.00 MiB [ 0.310318] mmcblk0boot1: mmc0:0001 QNW00A 4.00 MiB [ 0.311571] mmcblk0rpmb: mmc0:0001 QNW00A 512 KiB, chardev (248:0) [ 171.353426] mmc0: Card stuck being busy! __mmc_poll_for_busy [ 171.353443] mmc0: cache flush error -110 [ 201.399007] mmc0: Card stuck being busy! __mmc_poll_for_busy [ 201.399023] mmc0: cache flush error -110 [ 231.415093] mmc0: Card stuck being busy! __mmc_poll_for_busy [ 231.415109] mmc0: cache flush error -110 [ 261.464688] mmc0: Card stuck being busy! __mmc_poll_for_busy [ 261.464703] mmc0: cache flush error -110 A workaround was initially devised by blacksilver to counter the first error by forcing the card to DDR_1_8V and the second error by always returning false from _mmc_cache_enabled() (which the current workaround causes to happen too). The current workaround allows the card to be used in HS200 mode which however has the side effect of spamming dmesg with tuning failure messages. --- diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 6a23be214543..f930b8ab906a 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1865,6 +1865,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * sudden power failure tests. Let's extend the timeout to a minimum of * DEFAULT_CACHE_EN_TIMEOUT_MS and do it for all cards. */ + card->ext_csd.cache_size = 0; if (card->ext_csd.cache_size > 0) { unsigned int timeout_ms = MIN_CACHE_EN_TIMEOUT_MS;