Skip to content

Commit 686e1f1

Browse files
Jari Hämäläinenayufan
authored andcommitted
mmc: core: Add MMC Command Queue Support kernel parameter
This parameter offers a workaround for cards that report command queue (CMDQ) support but don't work correctly when CMDQ is enabled. At least some ROCKPro64 + Foresee (32GB) eMMC card combinations have trouble working correctly. Setting mmc_cmdqueue=off in kernel command line disables CMDQ support and may help with troublesome hardware.
1 parent 010db25 commit 686e1f1

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,6 +2506,14 @@
25062506
log everything. Information is printed at KERN_DEBUG
25072507
so loglevel=8 may also need to be specified.
25082508

2509+
mmc_cmdqueue= [MMC]
2510+
Enable or disable MMC command queue (CMDQ) support. When
2511+
enabled MMC driver will try to enable CMDQ for cards that
2512+
support it. When disabled CMDQ will not be enabled for any
2513+
card.
2514+
Format: <bool> (1/y/on=enable, 0/n/off=disable)
2515+
default: enabled
2516+
25092517
module.sig_enforce
25102518
[KNL] When CONFIG_MODULE_SIG is set, this means that
25112519
modules without (valid) signatures will fail to load.

drivers/mmc/core/mmc.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* it under the terms of the GNU General Public License version 2 as
1010
* published by the Free Software Foundation.
1111
*/
12-
12+
#include <linux/moduleparam.h>
1313
#include <linux/err.h>
1414
#include <linux/of.h>
1515
#include <linux/slab.h>
@@ -65,6 +65,10 @@ static const unsigned int taac_mant[] = {
6565
__res & __mask; \
6666
})
6767

68+
/* Enable / disable command queue support */
69+
static bool mmc_cmdqueue_support = true;
70+
core_param(mmc_cmdqueue, mmc_cmdqueue_support, bool, S_IRUGO);
71+
6872
/*
6973
* Given the decoded CSD structure, decode the raw CID to our CID structure.
7074
*/
@@ -1824,15 +1828,20 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
18241828
*/
18251829
card->ext_csd.cmdq_en = false;
18261830
if (card->ext_csd.cmdq_support && host->caps2 & MMC_CAP2_CQE) {
1827-
err = mmc_cmdq_enable(card);
1828-
if (err && err != -EBADMSG)
1829-
goto free_card;
1830-
if (err) {
1831-
pr_warn("%s: Enabling CMDQ failed\n",
1832-
mmc_hostname(card->host));
1833-
card->ext_csd.cmdq_support = false;
1834-
card->ext_csd.cmdq_depth = 0;
1835-
err = 0;
1831+
if (mmc_cmdqueue_support) {
1832+
err = mmc_cmdq_enable(card);
1833+
if (err && err != -EBADMSG)
1834+
goto free_card;
1835+
if (err) {
1836+
pr_warn("%s: Enabling CMDQ failed\n",
1837+
mmc_hostname(card->host));
1838+
card->ext_csd.cmdq_support = false;
1839+
card->ext_csd.cmdq_depth = 0;
1840+
err = 0;
1841+
}
1842+
} else {
1843+
pr_info("%s: CMDQ support disabled in kernel\n",
1844+
mmc_hostname(host));
18361845
}
18371846
}
18381847
/*

0 commit comments

Comments
 (0)