diff mbox

[RFCv2,01/10] mmc: core: Add support to read command queue parameters

Message ID 1467033757-32498-2-git-send-email-riteshh@codeaurora.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ritesh Harjani June 27, 2016, 1:22 p.m. UTC
From: Asutosh Das <asutoshd@codeaurora.org>

eMMC cards with EXT_CSD version >= 8, optionally support command
queuing feature as defined by JEDEC eMMC5.1. Add support for probing
command queue feature for such type of cards.

Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
[subhashj@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
---
 drivers/mmc/core/mmc.c   | 15 +++++++++++++++
 include/linux/mmc/card.h |  2 ++
 include/linux/mmc/mmc.h  |  2 ++
 3 files changed, 19 insertions(+)

Comments

Linus Walleij Nov. 21, 2016, 3:34 p.m. UTC | #1
On Mon, Jun 27, 2016 at 3:22 PM, Ritesh Harjani <riteshh@codeaurora.org> wrote:

> From: Asutosh Das <asutoshd@codeaurora.org>
>
> eMMC cards with EXT_CSD version >= 8, optionally support command
> queuing feature as defined by JEDEC eMMC5.1. Add support for probing
> command queue feature for such type of cards.
>
> Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
> [subhashj@codeaurora.org: fixed trivial merge conflicts]
> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Even if we don't merge the specific mechanism provided by the
rest of the patches, this patch just make us know more about
the capabilities of the hardware we're running on, which is good.

WIll it be reported properly by the lsmmc command too?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Adrian Hunter Nov. 22, 2016, 7:58 a.m. UTC | #2
On 21/11/16 17:34, Linus Walleij wrote:
> On Mon, Jun 27, 2016 at 3:22 PM, Ritesh Harjani <riteshh@codeaurora.org> wrote:
> 
>> From: Asutosh Das <asutoshd@codeaurora.org>
>>
>> eMMC cards with EXT_CSD version >= 8, optionally support command
>> queuing feature as defined by JEDEC eMMC5.1. Add support for probing
>> command queue feature for such type of cards.
>>
>> Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
>> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
>> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
>> [subhashj@codeaurora.org: fixed trivial merge conflicts]
>> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
>> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Even if we don't merge the specific mechanism provided by the
> rest of the patches, this patch just make us know more about
> the capabilities of the hardware we're running on, which is good.

I think SW CMDQ is a better starting point:

	https://marc.info/?l=linux-mmc&m=147729857722285

It cleans up the queue thread a bit:

	https://marc.info/?l=linux-mmc&m=147729857222281&w=2

And introduces queue semantics:

	https://marc.info/?l=linux-mmc&m=147729863322314&w=2

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Nov. 22, 2016, 10:20 a.m. UTC | #3
On Tue, Nov 22, 2016 at 8:58 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 21/11/16 17:34, Linus Walleij wrote:
>> On Mon, Jun 27, 2016 at 3:22 PM, Ritesh Harjani <riteshh@codeaurora.org> wrote:
>>
>>> From: Asutosh Das <asutoshd@codeaurora.org>
>>>
>>> eMMC cards with EXT_CSD version >= 8, optionally support command
>>> queuing feature as defined by JEDEC eMMC5.1. Add support for probing
>>> command queue feature for such type of cards.
>>>
>>> Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
>>> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
>>> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
>>> [subhashj@codeaurora.org: fixed trivial merge conflicts]
>>> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
>>> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
>>
>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>>
>> Even if we don't merge the specific mechanism provided by the
>> rest of the patches, this patch just make us know more about
>> the capabilities of the hardware we're running on, which is good.
>
> I think SW CMDQ is a better starting point:

When I supplied the Reviewe-by, as stated below it I am not talking
about the patch set as a whole. I am talking about *this* patch.

As you can see in my reply to 00/10 I have serious concerns about
this patchset overall.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Adrian Hunter Nov. 22, 2016, 10:31 a.m. UTC | #4
On 22/11/16 12:20, Linus Walleij wrote:
> On Tue, Nov 22, 2016 at 8:58 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 21/11/16 17:34, Linus Walleij wrote:
>>> On Mon, Jun 27, 2016 at 3:22 PM, Ritesh Harjani <riteshh@codeaurora.org> wrote:
>>>
>>>> From: Asutosh Das <asutoshd@codeaurora.org>
>>>>
>>>> eMMC cards with EXT_CSD version >= 8, optionally support command
>>>> queuing feature as defined by JEDEC eMMC5.1. Add support for probing
>>>> command queue feature for such type of cards.
>>>>
>>>> Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
>>>> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
>>>> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
>>>> [subhashj@codeaurora.org: fixed trivial merge conflicts]
>>>> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
>>>> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
>>>
>>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>>>
>>> Even if we don't merge the specific mechanism provided by the
>>> rest of the patches, this patch just make us know more about
>>> the capabilities of the hardware we're running on, which is good.
>>
>> I think SW CMDQ is a better starting point:
> 
> When I supplied the Reviewe-by, as stated below it I am not talking
> about the patch set as a whole. I am talking about *this* patch.

I should have been more explicit.  SW CMDQ covers some of the same ground
and has basically the same patch:

	https://marc.info/?l=linux-mmc&m=147729859922297&w=2

> 
> As you can see in my reply to 00/10 I have serious concerns about
> this patchset overall.

I didn't mean to imply otherwise.

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Nov. 22, 2016, 12:30 p.m. UTC | #5
On Tue, Nov 22, 2016 at 11:31 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 22/11/16 12:20, Linus Walleij wrote:
>> On Tue, Nov 22, 2016 at 8:58 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>> On 21/11/16 17:34, Linus Walleij wrote:
>>>> On Mon, Jun 27, 2016 at 3:22 PM, Ritesh Harjani <riteshh@codeaurora.org> wrote:
>>>>
>>>>> From: Asutosh Das <asutoshd@codeaurora.org>
>>>>>
>>>>> eMMC cards with EXT_CSD version >= 8, optionally support command
>>>>> queuing feature as defined by JEDEC eMMC5.1. Add support for probing
>>>>> command queue feature for such type of cards.
>>>>>
>>>>> Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
>>>>> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
>>>>> Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
>>>>> [subhashj@codeaurora.org: fixed trivial merge conflicts]
>>>>> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
>>>>> Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
>>>>
>>>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>>>>
>>>> Even if we don't merge the specific mechanism provided by the
>>>> rest of the patches, this patch just make us know more about
>>>> the capabilities of the hardware we're running on, which is good.
>>>
>>> I think SW CMDQ is a better starting point:
>>
>> When I supplied the Reviewe-by, as stated below it I am not talking
>> about the patch set as a whole. I am talking about *this* patch.
>
> I should have been more explicit.  SW CMDQ covers some of the same ground
> and has basically the same patch:
>
>         https://marc.info/?l=linux-mmc&m=147729859922297&w=2

OK it seems to define more of the constants, I'll go and review it.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Nov. 22, 2016, 12:37 p.m. UTC | #6
On Tue, Nov 22, 2016 at 1:30 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Nov 22, 2016 at 11:31 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:

>> I should have been more explicit.  SW CMDQ covers some of the same ground
>> and has basically the same patch:
>>
>>         https://marc.info/?l=linux-mmc&m=147729859922297&w=2
>
> OK it seems to define more of the constants, I'll go and review it.

Bah it's not in my INBOX for some reason, maybe I fell off the linux-mmc list
at some point :( I review it here:

Leave out this:

+ cmdq_en Command Queue enabled: 1 => enabled, 0 => not enabled
(...)
+MMC_DEV_ATTR(cmdq_en, "%d\n", card->ext_csd.cmdq_en);
(...)
+ &dev_attr_cmdq_en.attr,
(...)
+ bool cmdq_en; /* Command Queue enabled */

Because that is about enabling the *use* of this mechnism rather than
detecting its presence.

With the above removed it is superior to $SUBJECT so you
can add:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 5d438ad..77734c8 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -585,6 +585,21 @@  static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
 		card->ext_csd.data_sector_size = 512;
 	}
 
+	if (card->ext_csd.rev >= 8) {
+		card->ext_csd.cmdq_support = ext_csd[EXT_CSD_CMDQ_SUPPORT];
+		if (card->ext_csd.cmdq_support) {
+			/*
+			 * Queue Depth = N + 1,
+			 * see JEDEC JESD84-B51 section 7.4.19
+			 */
+			card->ext_csd.cmdq_depth =
+				ext_csd[EXT_CSD_CMDQ_DEPTH] + 1;
+			pr_debug("%s: CMDQ supported: depth: %d\n",
+				mmc_hostname(card->host),
+				card->ext_csd.cmdq_depth);
+		}
+	}
+
 	/* eMMC v5 or later */
 	if (card->ext_csd.rev >= 7) {
 		memcpy(card->ext_csd.fwrev, &ext_csd[EXT_CSD_FIRMWARE_VERSION],
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index eb0151b..f74db84 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -118,6 +118,8 @@  struct mmc_ext_csd {
 	u8			raw_pwr_cl_ddr_200_360;	/* 253 */
 	u8			raw_bkops_status;	/* 246 */
 	u8			raw_sectors[4];		/* 212 - 4 bytes */
+	u8			cmdq_depth;		/* 307 */
+	u8			cmdq_support;		/* 308 */
 
 	unsigned int            feature_support;
 #define MMC_DISCARD_FEATURE	BIT(0)                  /* CMD38 feature */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 15f2c4a..694c189 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -330,6 +330,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 */