Enable the Command Queue if the host controller supports Software Command Queuing. It is not compatible with Packed Commands, so do not enable that at the same time. Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> --- drivers/mmc/core/mmc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 720759a81296..7b1a92d79148 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1755,6 +1755,20 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, } } + /* Enable Command Queue if supported */ + card->ext_csd.cmdq_en = false; + if (card->ext_csd.cmdq_support && host->caps & MMC_CAP_CMD_DURING_TFR) { + 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; + } + } /* * In some cases (e.g. RPMB or mmc_test), the Command Queue must be * disabled for a time, so a flag is needed to indicate to re-enable the @@ -1768,7 +1782,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, */ if (card->ext_csd.max_packed_writes >= 3 && card->ext_csd.max_packed_reads >= 5 && - host->caps2 & MMC_CAP2_PACKED_CMD) { + host->caps2 & MMC_CAP2_PACKED_CMD && + !card->ext_csd.cmdq_en) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_EXP_EVENTS_CTRL, EXT_CSD_PACKED_EVENT_EN, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html