diff mbox

mmc: enable BKOPS for supported eMMC(4.41)

Message ID loom.20130830T140917-496@post.gmane.org (mailing list archive)
State New, archived
Headers show

Commit Message

Prasanna NAVARATNA Aug. 30, 2013, 12:09 p.m. UTC
From d596be94f87b86ccb372a4ae55ee478951524895 Mon Sep 17 00:00:00 2001
From: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
Date: Fri, 30 Aug 2013 17:18:32 +0530
Subject: [PATCH] mmc: enable BKOPS for supported eMMC(4.41)

BKOPS feature is optional for eMMC 4.41. If an eMMC supports BKOPS
and is of version 4.41 then BKOPS feature is ignored and not enabled.

Enable BKOPS for such eMMC. Also a capability is added to control
the enabling of feature (only for eMMC 4.41, not valid for 4.5)

Signed-off-by: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
---
 drivers/mmc/core/mmc.c   |   18 ++++++++++++++++++
 include/linux/mmc/host.h |    1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

Comments

Jaehoon Chung Sept. 2, 2013, 6:24 a.m. UTC | #1
Hi, Prasanna. 

Why do you use MMC_CAP2_BKOPS_EN?
Maybe we had discussed about this point. i know that we can enable the BKOPS with the mmc-util.
(Actually, This code had included into my first patch. but it's removed.)

Best Regards,
Jaehoon Chung

On 08/30/2013 09:09 PM, Prasanna NAVARATNA wrote:
>>From d596be94f87b86ccb372a4ae55ee478951524895 Mon Sep 17 00:00:00 2001
> From: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
> Date: Fri, 30 Aug 2013 17:18:32 +0530
> Subject: [PATCH] mmc: enable BKOPS for supported eMMC(4.41)
> 
> BKOPS feature is optional for eMMC 4.41. If an eMMC supports BKOPS
> and is of version 4.41 then BKOPS feature is ignored and not enabled.
> 
> Enable BKOPS for such eMMC. Also a capability is added to control
> the enabling of feature (only for eMMC 4.41, not valid for 4.5)
> 
> Signed-off-by: Prasanna NAVARATNA <prasanna.navaratna@broadcom.com>
> ---
>  drivers/mmc/core/mmc.c   |   18 ++++++++++++++++++
>  include/linux/mmc/host.h |    1 +
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 6d02012..fc44fd7 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1269,6 +1269,24 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>  	}
>  
>  	/*
> +	 * Enable BKOPS feature (if supported and not enabled)
> +	 */
> +	if (!card->ext_csd.bkops_en && (host->caps2 & MMC_CAP2_BKOPS_EN) &&
> +			(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) {
> +		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> +				EXT_CSD_BKOPS_EN, 1,
> +				card->ext_csd.generic_cmd6_time);
> +		if (err && err != -EBADMSG)
> +			goto free_card;
> +		if (err) {
> +			pr_warning("%s: Enabling BKOPS failed\n",
> +				   mmc_hostname(card->host));
> +			err = 0;
> +		} else
> +			card->ext_csd.bkops_en = 1;
> +	}
> +
> +	/*
>  	 * Enable HPI feature (if supported)
>  	 */
>  	if (card->ext_csd.hpi) {
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 3b0c33a..2c79487 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -281,6 +281,7 @@ struct mmc_host {
>  				 MMC_CAP2_PACKED_WR)
>  #define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14)	/* Don't power up before scan */
>  #define MMC_CAP2_SANITIZE	(1 << 15)		/* Support Sanitize */
> +#define MMC_CAP2_BKOPS_EN	(1 << 16)		/* Enable BKOPS */
>  
>  	mmc_pm_flag_t		pm_caps;	/* supported pm features */
>  
> 

--
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
Prasanna NAVARATNA Sept. 3, 2013, 8:58 a.m. UTC | #2
Hello Jaehoon,

> Why do you use MMC_CAP2_BKOPS_EN?
Because BKOPS on eMMC4.41 is optional. So the capability is provided for the
platform to either enable/disable this feature (its not mandatory to always
enable BKOPS on 4.41)

> Maybe we had discussed about this point. i know that we can enable the
BKOPS with the mmc-util.
> (Actually, This code had included into my first patch. but it's removed.)
I'm not aware of this discussion and currently I'm running on eMMC4.41 and
bkops is supported but not enabled. So i suggested this patch.
Do you mean to say, right now, i can enable it using mmc-utils?
Will you please elaborate?

Thanks,
Prasanna

--
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
Nitin Singla Sept. 3, 2013, 9:34 a.m. UTC | #3
Hi Prasanna,

MMC-Utils open source utility for enabling and disabling features.
It use ioctl defined in block/card to send commands to host.
git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

Thanks,
Nitin

On Tue, Sep 3, 2013 at 2:28 PM, Prasanna NAVARATNA
<prasanna.navaratna@gmail.com> wrote:
> Hello Jaehoon,
>
>> Why do you use MMC_CAP2_BKOPS_EN?
> Because BKOPS on eMMC4.41 is optional. So the capability is provided for the
> platform to either enable/disable this feature (its not mandatory to always
> enable BKOPS on 4.41)
>
>> Maybe we had discussed about this point. i know that we can enable the
> BKOPS with the mmc-util.
>> (Actually, This code had included into my first patch. but it's removed.)
> I'm not aware of this discussion and currently I'm running on eMMC4.41 and
> bkops is supported but not enabled. So i suggested this patch.
> Do you mean to say, right now, i can enable it using mmc-utils?
> Will you please elaborate?
>
> Thanks,
> Prasanna
>
> --
> 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
--
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
Jaehoon Chung Sept. 4, 2013, 2:34 a.m. UTC | #4
Hi Prasanna,

You can refer to

http://permalink.gmane.org/gmane.linux.kernel.mmc/15430

Best Regards,
Jaehoon Chung

On 09/03/2013 06:34 PM, Nitin Singla wrote:
> Hi Prasanna,
> 
> MMC-Utils open source utility for enabling and disabling features.
> It use ioctl defined in block/card to send commands to host.
> git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git
> 
> Thanks,
> Nitin
> 
> On Tue, Sep 3, 2013 at 2:28 PM, Prasanna NAVARATNA
> <prasanna.navaratna@gmail.com> wrote:
>> Hello Jaehoon,
>>
>>> Why do you use MMC_CAP2_BKOPS_EN?
>> Because BKOPS on eMMC4.41 is optional. So the capability is provided for the
>> platform to either enable/disable this feature (its not mandatory to always
>> enable BKOPS on 4.41)
>>
>>> Maybe we had discussed about this point. i know that we can enable the
>> BKOPS with the mmc-util.
>>> (Actually, This code had included into my first patch. but it's removed.)
>> I'm not aware of this discussion and currently I'm running on eMMC4.41 and
>> bkops is supported but not enabled. So i suggested this patch.
>> Do you mean to say, right now, i can enable it using mmc-utils?
>> Will you please elaborate?
>>
>> Thanks,
>> Prasanna
>>
>> --
>> 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
> --
> 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
> 

--
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
Prasanna NAVARATNA Sept. 5, 2013, 9:12 a.m. UTC | #5
Hello,
 
> http://permalink.gmane.org/gmane.linux.kernel.mmc/15430
This link mentions that BKOPS_EN 163bit in EXT_CSD is one-time programmable
flag but from JEDEC Standard No. 84-A441 spec, it is R/W bit. Please
re-confirm about the statement.


> > MMC-Utils open source utility for enabling and disabling features.
> > It use ioctl defined in block/card to send commands to host.
> > git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git

I am not able to find this git in my platform repo. 
Is this mmc-utils git mandatory to have? 
What if, somebody don't have it and need to enabled BKOPS for eMMMC4.41?
Is mmc-utils the only way to enable BKOPS?

Regards,
Prasanna NAVARATNA

--
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
Jaehoon Chung Sept. 5, 2013, 1:03 p.m. UTC | #6
On 09/05/2013 06:12 PM, Prasanna NAVARATNA wrote:
> Hello,
>  
>> http://permalink.gmane.org/gmane.linux.kernel.mmc/15430
> This link mentions that BKOPS_EN 163bit in EXT_CSD is one-time programmable
> flag but from JEDEC Standard No. 84-A441 spec, it is R/W bit. Please
> re-confirm about the statement.
R/W bit is one-time programmable and readable. what do you mean?
> 
> 
>>> MMC-Utils open source utility for enabling and disabling features.
>>> It use ioctl defined in block/card to send commands to host.
>>> git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git
> 
> I am not able to find this git in my platform repo. 
> Is this mmc-utils git mandatory to have? 
> What if, somebody don't have it and need to enabled BKOPS for eMMMC4.41?
> Is mmc-utils the only way to enable BKOPS?
If you want to enable the bkops, then you can use your patch at your local repo, not mainline.

Best Regards,
Jaehoon Chung
> 
> Regards,
> Prasanna NAVARATNA
> 
> --
> 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
> 

--
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
Prasanna NAVARATNA Sept. 5, 2013, 2:12 p.m. UTC | #7
Hello Jaehoon,

> R/W bit is one-time programmable and readable. what do you mean?
Yes, right. Sorry, I was confused with word one-time programmable as W bit.

> If you want to enable the bkops, then you can use your patch at your local
repo, not mainline.
OK. Thanks for the information.

Regards,
Prasanna NAVARATNA

--
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 6d02012..fc44fd7 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1269,6 +1269,24 @@  static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	}
 
 	/*
+	 * Enable BKOPS feature (if supported and not enabled)
+	 */
+	if (!card->ext_csd.bkops_en && (host->caps2 & MMC_CAP2_BKOPS_EN) &&
+			(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) {
+		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
+				EXT_CSD_BKOPS_EN, 1,
+				card->ext_csd.generic_cmd6_time);
+		if (err && err != -EBADMSG)
+			goto free_card;
+		if (err) {
+			pr_warning("%s: Enabling BKOPS failed\n",
+				   mmc_hostname(card->host));
+			err = 0;
+		} else
+			card->ext_csd.bkops_en = 1;
+	}
+
+	/*
 	 * Enable HPI feature (if supported)
 	 */
 	if (card->ext_csd.hpi) {
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3b0c33a..2c79487 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -281,6 +281,7 @@  struct mmc_host {
 				 MMC_CAP2_PACKED_WR)
 #define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14)	/* Don't power up before scan */
 #define MMC_CAP2_SANITIZE	(1 << 15)		/* Support Sanitize */
+#define MMC_CAP2_BKOPS_EN	(1 << 16)		/* Enable BKOPS */
 
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */