From: Adrian Hunter <adrian.hunter@intel.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
Alex Lemberg <alex.lemberg@sandisk.com>,
Mateusz Nowak <mateusz.nowak@intel.com>,
Yuliy Izrailov <Yuliy.Izrailov@sandisk.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Dong Aisheng <dongas86@gmail.com>,
Das Asutosh <asutoshd@codeaurora.org>,
Zhangfei Gao <zhangfei.gao@gmail.com>,
Dorfman Konstantin <kdorfman@codeaurora.org>,
David Griego <david.griego@linaro.org>,
Sahitya Tummala <stummala@codeaurora.org>,
Harjani Ritesh <riteshh@codeaurora.org>,
Venu Byravarasu <vbyravarasu@nvidia.com>,
Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH RFC 06/39] mmc: mmc_test: Disable Command Queue while mmc_test is used
Date: Fri, 10 Feb 2017 14:55:19 +0200 [thread overview]
Message-ID: <1486731352-8018-7-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1486731352-8018-1-git-send-email-adrian.hunter@intel.com>
Normal read and write commands may not be used while the command queue is
enabled. Disable the Command Queue when mmc_test is probed and re-enable it
when it is removed.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Harjani Ritesh <riteshh@codeaurora.org>
---
drivers/mmc/core/mmc.c | 7 +++++++
drivers/mmc/core/mmc_test.c | 14 ++++++++++++++
include/linux/mmc/card.h | 2 ++
3 files changed, 23 insertions(+)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index df154b951a10..8c290264cf2d 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1800,6 +1800,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
}
/*
+ * 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
+ * Command Queue.
+ */
+ card->reenable_cmdq = card->ext_csd.cmdq_en;
+
+ /*
* The mandatory minimum values are defined for packed command.
* read: 5, write: 3
*/
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 45e623cc1624..e6f1c3fae849 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -26,6 +26,7 @@
#include "card.h"
#include "host.h"
#include "bus.h"
+#include "mmc_ops.h"
#define RESULT_OK 0
#define RESULT_FAIL 1
@@ -3264,6 +3265,14 @@ static int mmc_test_probe(struct mmc_card *card)
if (ret)
return ret;
+ if (card->ext_csd.cmdq_en) {
+ mmc_claim_host(card->host);
+ ret = mmc_cmdq_disable(card);
+ mmc_release_host(card->host);
+ if (ret)
+ return ret;
+ }
+
dev_info(&card->dev, "Card claimed for testing.\n");
return 0;
@@ -3271,6 +3280,11 @@ static int mmc_test_probe(struct mmc_card *card)
static void mmc_test_remove(struct mmc_card *card)
{
+ if (card->reenable_cmdq) {
+ mmc_claim_host(card->host);
+ mmc_cmdq_enable(card);
+ mmc_release_host(card->host);
+ }
mmc_test_free_result(card);
mmc_test_free_dbgfs_file(card);
}
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 94637796b99c..85b5f2bc8bb9 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -269,6 +269,8 @@ struct mmc_card {
#define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */
#define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */
+ bool reenable_cmdq; /* Re-enable Command Queue */
+
unsigned int erase_size; /* erase size in sectors */
unsigned int erase_shift; /* if erase unit is power 2 */
unsigned int pref_erase; /* in sectors */
--
1.9.1
next prev parent reply other threads:[~2017-02-10 13:28 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 12:55 [PATCH RFC 00/39] mmc: Add Command Queue support Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 01/39] mmc: block: Use local var for mqrq_cur Adrian Hunter
2017-02-15 12:29 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 02/39] mmc: queue: Share mmc request array between partitions Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 03/39] mmc: block: Introduce queue semantics Adrian Hunter
2017-02-15 12:29 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 04/39] mmc: core: Do not prepare a new request twice Adrian Hunter
2017-02-15 12:49 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 05/39] mmc: mmc: Add functions to enable / disable the Command Queue Adrian Hunter
2017-02-15 12:52 ` Linus Walleij
2017-02-17 12:21 ` Ulf Hansson
2017-02-23 14:54 ` Linus Walleij
2017-02-10 12:55 ` Adrian Hunter [this message]
2017-02-10 12:55 ` [PATCH RFC 07/39] mmc: block: Disable Command Queue while RPMB is used Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 08/39] mmc: core: Export mmc_retune_hold() and mmc_retune_release() Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 09/39] mmc: queue: Add a function to control wake-up on new requests Adrian Hunter
2017-02-15 13:07 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 10/39] mmc: block: Change mmc_apply_rel_rw() to get block address from the request Adrian Hunter
2017-02-15 13:09 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 11/39] mmc: block: Factor out data preparation Adrian Hunter
2017-02-15 13:11 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 12/39] mmc: block: Add Software Command Queuing Adrian Hunter
2017-02-15 13:34 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 13/39] mmc: mmc: Enable " Adrian Hunter
2017-02-15 13:35 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 14/39] mmc: core: Factor out debug prints from mmc_start_request() Adrian Hunter
2017-02-15 13:38 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 15/39] mmc: core: Factor out mrq preparation " Adrian Hunter
2017-02-15 13:39 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 16/39] mmc: core: Add mmc_retune_hold_now() Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 17/39] mmc: core: Add members to mmc_request and mmc_data for CQE's Adrian Hunter
2017-02-15 13:42 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 18/39] mmc: host: Add CQE interface Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 19/39] mmc: core: Turn off CQE before sending commands Adrian Hunter
2017-02-15 13:42 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 20/39] mmc: core: Add support for handling CQE requests Adrian Hunter
2017-02-15 13:44 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 21/39] mmc: mmc: Enable CQE's Adrian Hunter
2017-02-15 13:45 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 22/39] mmc: block: Prepare CQE data Adrian Hunter
2017-02-15 13:49 ` Linus Walleij
2017-03-03 12:22 ` Adrian Hunter
2017-03-09 22:39 ` Linus Walleij
2017-03-10 8:29 ` Adrian Hunter
2017-03-28 7:57 ` Linus Walleij
2017-02-10 12:55 ` [PATCH RFC 23/39] mmc: block: Add CQE support Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 24/39] mmc: cqhci: support for command queue enabled host Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 25/39] mmc: sdhci: Improve debug print format Adrian Hunter
2017-02-17 12:30 ` Ulf Hansson
2017-02-10 12:55 ` [PATCH RFC 26/39] mmc: sdhci: Add response register to register dump Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 27/39] mmc: sdhci: Improve register dump print format Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 28/39] mmc: sdhci: Export sdhci_dumpregs Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 29/39] mmc: sdhci: Get rid of 'extern' in header file Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 30/39] mmc: sdhci: Add sdhci_cleanup_host Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 31/39] mmc: sdhci: Factor out sdhci_set_default_irqs Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 32/39] mmc: sdhci: Add CQE support Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 33/39] mmc: sdhci-pci: Let devices define how to add the host Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 34/39] mmc: sdhci-pci: Do not use suspend/resume callbacks with runtime pm Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 35/39] mmc: sdhci-pci: Conditionally compile pm sleep functions Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 36/39] mmc: sdhci-pci: Let suspend/resume callbacks replace default callbacks Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 37/39] mmc: sdhci-pci: Add runtime suspend/resume callbacks Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 38/39] mmc: sdhci-pci: Move a function to avoid later forward declaration Adrian Hunter
2017-02-10 12:55 ` [PATCH RFC 39/39] mmc: sdhci-pci: Add CQHCI support for Intel GLK Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486731352-8018-7-git-send-email-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=Yuliy.Izrailov@sandisk.com \
--cc=alex.lemberg@sandisk.com \
--cc=asutoshd@codeaurora.org \
--cc=david.griego@linaro.org \
--cc=dongas86@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=kdorfman@codeaurora.org \
--cc=linus.walleij@linaro.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mateusz.nowak@intel.com \
--cc=riteshh@codeaurora.org \
--cc=stummala@codeaurora.org \
--cc=ulf.hansson@linaro.org \
--cc=vbyravarasu@nvidia.com \
--cc=zhangfei.gao@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox