Commit 54e26415 authored by Jari Hämäläinen's avatar Jari Hämäläinen Committed by Kamil Trzciński
Browse files

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.
parent 1147dbe9
......@@ -2660,6 +2660,14 @@
log everything. Information is printed at KERN_DEBUG
so loglevel=8 may also need to be specified.
mmc_cmdqueue= [MMC]
Enable or disable MMC command queue (CMDQ) support. When
enabled MMC driver will try to enable CMDQ for cards that
support it. When disabled CMDQ will not be enabled for any
card.
Format: <bool> (1/y/on=enable, 0/n/off=disable)
default: enabled
module.sig_enforce
[KNL] When CONFIG_MODULE_SIG is set, this means that
modules without (valid) signatures will fail to load.
......
......@@ -6,7 +6,7 @@
* Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
* MMCv4 support Copyright (C) 2006 Philip Langdale, All Rights Reserved.
*/
#include <linux/moduleparam.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/slab.h>
......@@ -62,6 +62,10 @@ static const unsigned int taac_mant[] = {
__res & __mask; \
})
/* Enable / disable command queue support */
static bool mmc_cmdqueue_support = true;
core_param(mmc_cmdqueue, mmc_cmdqueue_support, bool, S_IRUGO);
/*
* Given the decoded CSD structure, decode the raw CID to our CID structure.
*/
......@@ -1834,15 +1838,20 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
*/
card->ext_csd.cmdq_en = false;
if (card->ext_csd.cmdq_support && host->caps2 & MMC_CAP2_CQE) {
err = mmc_cmdq_enable(card);
if (err && err != -EBADMSG)
goto free_card;
if (err) {
pr_warn("%s: Enabling CMDQ failed\n",
mmc_hostname(card->host));
card->ext_csd.cmdq_support = false;
card->ext_csd.cmdq_depth = 0;
err = 0;
if (mmc_cmdqueue_support) {
err = mmc_cmdq_enable(card);
if (err && err != -EBADMSG)
goto free_card;
if (err) {
pr_warn("%s: Enabling CMDQ failed\n",
mmc_hostname(card->host));
card->ext_csd.cmdq_support = false;
card->ext_csd.cmdq_depth = 0;
err = 0;
}
} else {
pr_info("%s: CMDQ support disabled in kernel\n",
mmc_hostname(host));
}
}
/*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment