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 V8 09/20] mmc: mmc: Add Command Queue definitions
Date: Tue, 29 Nov 2016 12:09:16 +0200 [thread overview]
Message-ID: <1480414167-15577-10-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1480414167-15577-1-git-send-email-adrian.hunter@intel.com>
Add definitions relating to Command Queuing.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/mmc/core/mmc.c | 18 ++++++++++++++++++
include/linux/mmc/card.h | 2 ++
include/linux/mmc/mmc.h | 17 +++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 3268fcd3378d..16cf6ea6e1ba 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -618,6 +618,24 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
(ext_csd[EXT_CSD_SUPPORTED_MODE] & 0x1) &&
!(ext_csd[EXT_CSD_FW_CONFIG] & 0x1);
}
+
+ /* eMMC v5.1 or later */
+ if (card->ext_csd.rev >= 8) {
+ card->ext_csd.cmdq_support = ext_csd[EXT_CSD_CMDQ_SUPPORT] &
+ EXT_CSD_CMDQ_SUPPORTED;
+ card->ext_csd.cmdq_depth = (ext_csd[EXT_CSD_CMDQ_DEPTH] &
+ EXT_CSD_CMDQ_DEPTH_MASK) + 1;
+ /* Exclude inefficiently small queue depths */
+ if (card->ext_csd.cmdq_depth <= 2) {
+ card->ext_csd.cmdq_support = false;
+ card->ext_csd.cmdq_depth = 0;
+ }
+ if (card->ext_csd.cmdq_support) {
+ pr_debug("%s: Command Queue supported depth %u\n",
+ mmc_hostname(card->host),
+ card->ext_csd.cmdq_depth);
+ }
+ }
out:
return err;
}
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index e49a3ff9d0e0..95d69d498296 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -89,6 +89,8 @@ struct mmc_ext_csd {
unsigned int boot_ro_lock; /* ro lock support */
bool boot_ro_lockable;
bool ffu_capable; /* Firmware upgrade support */
+ bool cmdq_support; /* Command Queue supported */
+ unsigned int cmdq_depth; /* Command Queue depth */
#define MMC_FIRMWARE_LEN 8
u8 fwrev[MMC_FIRMWARE_LEN]; /* FW version */
u8 raw_exception_status; /* 54 */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index c376209c70ef..672730acc705 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -84,6 +84,13 @@
#define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */
#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */
+ /* class 11 */
+#define MMC_QUE_TASK_PARAMS 44 /* ac [20:16] task id R1 */
+#define MMC_QUE_TASK_ADDR 45 /* ac [31:0] data addr R1 */
+#define MMC_EXECUTE_READ_TASK 46 /* adtc [20:16] task id R1 */
+#define MMC_EXECUTE_WRITE_TASK 47 /* adtc [20:16] task id R1 */
+#define MMC_CMDQ_TASK_MGMT 48 /* ac [20:16] task id R1b */
+
static inline bool mmc_op_multi(u32 opcode)
{
return opcode == MMC_WRITE_MULTIPLE_BLOCK ||
@@ -272,6 +279,7 @@ struct _mmc_csd {
* EXT_CSD fields
*/
+#define EXT_CSD_CMDQ_MODE_EN 15 /* R/W */
#define EXT_CSD_FLUSH_CACHE 32 /* W */
#define EXT_CSD_CACHE_CTRL 33 /* R/W */
#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
@@ -331,6 +339,8 @@ struct _mmc_csd {
#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
#define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */
#define EXT_CSD_FIRMWARE_VERSION 254 /* RO, 8 bytes */
+#define EXT_CSD_CMDQ_DEPTH 307 /* RO */
+#define EXT_CSD_CMDQ_SUPPORT 308 /* RO */
#define EXT_CSD_SUPPORTED_MODE 493 /* RO */
#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
@@ -438,6 +448,13 @@ struct _mmc_csd {
#define EXT_CSD_MANUAL_BKOPS_MASK 0x01
/*
+ * Command Queue
+ */
+#define EXT_CSD_CMDQ_MODE_ENABLED BIT(0)
+#define EXT_CSD_CMDQ_DEPTH_MASK GENMASK(4, 0)
+#define EXT_CSD_CMDQ_SUPPORTED BIT(0)
+
+/*
* MMC_SWITCH access modes
*/
--
1.9.1
next prev parent reply other threads:[~2016-11-29 10:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 10:09 [PATCH V8 00/20] mmc: mmc: Add Software Command Queuing Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 01/20] mmc: block: Restore line inadvertently removed with packed commands Adrian Hunter
2016-11-30 21:25 ` Linus Walleij
2016-11-29 10:09 ` [PATCH V8 02/20] mmc: block: Fix 4K native sector check Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 03/20] mmc: queue: Fix queue thread wake-up Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 04/20] mmc: queue: Factor out mmc_queue_alloc_bounce_bufs() Adrian Hunter
2016-11-30 8:16 ` Ulf Hansson
2016-11-29 10:09 ` [PATCH V8 05/20] mmc: queue: Factor out mmc_queue_alloc_bounce_sgs() Adrian Hunter
2016-11-30 8:17 ` Ulf Hansson
2016-11-30 8:46 ` Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 06/20] mmc: queue: Factor out mmc_queue_alloc_sgs() Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 07/20] mmc: queue: Factor out mmc_queue_reqs_free_bufs() Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 08/20] mmc: queue: Introduce queue depth and use it to allocate and free Adrian Hunter
2016-11-29 10:09 ` Adrian Hunter [this message]
2016-11-29 10:09 ` [PATCH V8 10/20] mmc: mmc: Add functions to enable / disable the Command Queue Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 11/20] mmc: mmc_test: Disable Command Queue while mmc_test is used Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 12/20] mmc: block: Disable Command Queue while RPMB " Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 13/20] mmc: core: Do not prepare a new request twice Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 14/20] mmc: core: Export mmc_retune_hold() and mmc_retune_release() Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 15/20] mmc: block: Use local var for mqrq_cur Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 16/20] mmc: block: Introduce queue semantics Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 17/20] mmc: queue: Share mmc request array between partitions Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 18/20] mmc: queue: Add a function to control wake-up on new requests Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 19/20] mmc: block: Add Software Command Queuing Adrian Hunter
2016-11-29 10:09 ` [PATCH V8 20/20] mmc: mmc: Enable " Adrian Hunter
2016-11-29 11:41 ` [PATCH V8 00/20] mmc: mmc: Add " Ulf Hansson
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=1480414167-15577-10-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