All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mmc: Resolve BKOPS compatability issue
@ 2015-01-29  8:49 Alexey Skidanov
  2015-01-29 10:26 ` Ulf Hansson
  2015-01-30  7:26 ` Jaehoon Chung
  0 siblings, 2 replies; 5+ messages in thread
From: Alexey Skidanov @ 2015-01-29  8:49 UTC (permalink / raw)
  To: chris, ulf.hansson, linux-mmc; +Cc: alex.lemberg, Alexey Skidanov

This patch is coming to fix compatibility issue of BKOPS_EN  field of EXT_CSD.
In eMMC-5.1, BKOPS_EN was changed, and now it has two operational bits:
Bit 0 - MANUAL_EN
Bit 1 - AUTO_EN
In previous eMMC revisions, only Bit 0 was supported.

Signed-off-by: Alexey Skidanov <alexey.skidanov@sandisk.com>
---
 drivers/mmc/core/core.c  |    2 +-
 drivers/mmc/core/mmc.c   |    8 +++++---
 include/linux/mmc/card.h |    3 ++-
 include/linux/mmc/mmc.h  |    5 +++++
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 1be7055..0dc64e6 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -275,7 +275,7 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception)
 
 	BUG_ON(!card);
 
-	if (!card->ext_csd.bkops_en || mmc_card_doing_bkops(card))
+	if (!card->ext_csd.man_bkops_en || mmc_card_doing_bkops(card))
 		return;
 
 	err = mmc_read_bkops_status(card);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 1fc48a2..1d41e85 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -483,11 +483,13 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
 		/* check whether the eMMC card supports BKOPS */
 		if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) {
 			card->ext_csd.bkops = 1;
-			card->ext_csd.bkops_en = ext_csd[EXT_CSD_BKOPS_EN];
+			card->ext_csd.man_bkops_en =
+					(ext_csd[EXT_CSD_BKOPS_EN] &
+						EXT_CSD_MANUAL_BKOPS_MASK);
 			card->ext_csd.raw_bkops_status =
 				ext_csd[EXT_CSD_BKOPS_STATUS];
-			if (!card->ext_csd.bkops_en)
-				pr_info("%s: BKOPS_EN bit is not set\n",
+			if (!card->ext_csd.man_bkops_en)
+				pr_info("%s: MAN_BKOPS_EN bit is not set\n",
 					mmc_hostname(card->host));
 		}
 
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 4d69c00..17378cb 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -83,7 +83,8 @@ struct mmc_ext_csd {
 	bool			hpi;			/* HPI support bit */
 	unsigned int		hpi_cmd;		/* cmd used as HPI */
 	bool			bkops;		/* background support bit */
-	bool			bkops_en;	/* background enable bit */
+	bool			man_bkops_en;	/* manual background
+						enable bit */
 	unsigned int            data_sector_size;       /* 512 bytes or 4KB */
 	unsigned int            data_tag_unit_size;     /* DATA TAG UNIT size */
 	unsigned int		boot_ro_lock;		/* ro lock support */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index fb97b5c..124f562 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -428,6 +428,11 @@ struct _mmc_csd {
 #define EXT_CSD_BKOPS_LEVEL_2		0x2
 
 /*
+ * BKOPS modes
+ */
+#define EXT_CSD_MANUAL_BKOPS_MASK	0x01
+
+/*
  * MMC_SWITCH access modes
  */
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mmc: Resolve BKOPS compatability issue
  2015-01-29  8:49 [PATCH v2] mmc: Resolve BKOPS compatability issue Alexey Skidanov
@ 2015-01-29 10:26 ` Ulf Hansson
  2015-01-30  7:26 ` Jaehoon Chung
  1 sibling, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2015-01-29 10:26 UTC (permalink / raw)
  To: Alexey Skidanov; +Cc: Chris Ball, linux-mmc, Alex Lemberg

On 29 January 2015 at 09:49, Alexey Skidanov
<alexey.skidanov@sandisk.com> wrote:
> This patch is coming to fix compatibility issue of BKOPS_EN  field of EXT_CSD.
> In eMMC-5.1, BKOPS_EN was changed, and now it has two operational bits:
> Bit 0 - MANUAL_EN
> Bit 1 - AUTO_EN
> In previous eMMC revisions, only Bit 0 was supported.
>
> Signed-off-by: Alexey Skidanov <alexey.skidanov@sandisk.com>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/core/core.c  |    2 +-
>  drivers/mmc/core/mmc.c   |    8 +++++---
>  include/linux/mmc/card.h |    3 ++-
>  include/linux/mmc/mmc.h  |    5 +++++
>  4 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 1be7055..0dc64e6 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -275,7 +275,7 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception)
>
>         BUG_ON(!card);
>
> -       if (!card->ext_csd.bkops_en || mmc_card_doing_bkops(card))
> +       if (!card->ext_csd.man_bkops_en || mmc_card_doing_bkops(card))
>                 return;
>
>         err = mmc_read_bkops_status(card);
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 1fc48a2..1d41e85 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -483,11 +483,13 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
>                 /* check whether the eMMC card supports BKOPS */
>                 if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) {
>                         card->ext_csd.bkops = 1;
> -                       card->ext_csd.bkops_en = ext_csd[EXT_CSD_BKOPS_EN];
> +                       card->ext_csd.man_bkops_en =
> +                                       (ext_csd[EXT_CSD_BKOPS_EN] &
> +                                               EXT_CSD_MANUAL_BKOPS_MASK);
>                         card->ext_csd.raw_bkops_status =
>                                 ext_csd[EXT_CSD_BKOPS_STATUS];
> -                       if (!card->ext_csd.bkops_en)
> -                               pr_info("%s: BKOPS_EN bit is not set\n",
> +                       if (!card->ext_csd.man_bkops_en)
> +                               pr_info("%s: MAN_BKOPS_EN bit is not set\n",
>                                         mmc_hostname(card->host));
>                 }
>
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index 4d69c00..17378cb 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -83,7 +83,8 @@ struct mmc_ext_csd {
>         bool                    hpi;                    /* HPI support bit */
>         unsigned int            hpi_cmd;                /* cmd used as HPI */
>         bool                    bkops;          /* background support bit */
> -       bool                    bkops_en;       /* background enable bit */
> +       bool                    man_bkops_en;   /* manual background
> +                                               enable bit */

I took the liberty to change the comment to fit one line.

>         unsigned int            data_sector_size;       /* 512 bytes or 4KB */
>         unsigned int            data_tag_unit_size;     /* DATA TAG UNIT size */
>         unsigned int            boot_ro_lock;           /* ro lock support */
> diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
> index fb97b5c..124f562 100644
> --- a/include/linux/mmc/mmc.h
> +++ b/include/linux/mmc/mmc.h
> @@ -428,6 +428,11 @@ struct _mmc_csd {
>  #define EXT_CSD_BKOPS_LEVEL_2          0x2
>
>  /*
> + * BKOPS modes
> + */
> +#define EXT_CSD_MANUAL_BKOPS_MASK      0x01
> +
> +/*
>   * MMC_SWITCH access modes
>   */
>
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mmc: Resolve BKOPS compatability issue
  2015-01-29  8:49 [PATCH v2] mmc: Resolve BKOPS compatability issue Alexey Skidanov
  2015-01-29 10:26 ` Ulf Hansson
@ 2015-01-30  7:26 ` Jaehoon Chung
  2015-01-30 10:25   ` Ulf Hansson
  1 sibling, 1 reply; 5+ messages in thread
From: Jaehoon Chung @ 2015-01-30  7:26 UTC (permalink / raw)
  To: Alexey Skidanov, chris, ulf.hansson, linux-mmc; +Cc: alex.lemberg

Hi, Alexey.

On 01/29/2015 05:49 PM, Alexey Skidanov wrote:
> This patch is coming to fix compatibility issue of BKOPS_EN  field of EXT_CSD.
> In eMMC-5.1, BKOPS_EN was changed, and now it has two operational bits:
> Bit 0 - MANUAL_EN
> Bit 1 - AUTO_EN
> In previous eMMC revisions, only Bit 0 was supported.

If "manual enable" is the same functionality with previous enable,
I think it doesn't need to change the name..
Just checking whether enable or not with Mask bit?

If need to add the auto enable, only add the bkops_auto_en in future.
This is just my preference..and i don't read the spec since i don't have eMMC5.1 spec.

If manual-enable is difference with previous enable, how about using bkops-manual-en?

Best Regards,
Jaehoon Chung
> 
> Signed-off-by: Alexey Skidanov <alexey.skidanov@sandisk.com>
> ---
>  drivers/mmc/core/core.c  |    2 +-
>  drivers/mmc/core/mmc.c   |    8 +++++---
>  include/linux/mmc/card.h |    3 ++-
>  include/linux/mmc/mmc.h  |    5 +++++
>  4 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 1be7055..0dc64e6 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -275,7 +275,7 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception)
>  
>  	BUG_ON(!card);
>  
> -	if (!card->ext_csd.bkops_en || mmc_card_doing_bkops(card))
> +	if (!card->ext_csd.man_bkops_en || mmc_card_doing_bkops(card))
>  		return;
>  
>  	err = mmc_read_bkops_status(card);
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 1fc48a2..1d41e85 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -483,11 +483,13 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
>  		/* check whether the eMMC card supports BKOPS */
>  		if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) {
>  			card->ext_csd.bkops = 1;
> -			card->ext_csd.bkops_en = ext_csd[EXT_CSD_BKOPS_EN];
> +			card->ext_csd.man_bkops_en =
> +					(ext_csd[EXT_CSD_BKOPS_EN] &
> +						EXT_CSD_MANUAL_BKOPS_MASK);
>  			card->ext_csd.raw_bkops_status =
>  				ext_csd[EXT_CSD_BKOPS_STATUS];
> -			if (!card->ext_csd.bkops_en)
> -				pr_info("%s: BKOPS_EN bit is not set\n",
> +			if (!card->ext_csd.man_bkops_en)
> +				pr_info("%s: MAN_BKOPS_EN bit is not set\n",
>  					mmc_hostname(card->host));
>  		}
>  
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index 4d69c00..17378cb 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -83,7 +83,8 @@ struct mmc_ext_csd {
>  	bool			hpi;			/* HPI support bit */
>  	unsigned int		hpi_cmd;		/* cmd used as HPI */
>  	bool			bkops;		/* background support bit */
> -	bool			bkops_en;	/* background enable bit */
> +	bool			man_bkops_en;	/* manual background
> +						enable bit */
>  	unsigned int            data_sector_size;       /* 512 bytes or 4KB */
>  	unsigned int            data_tag_unit_size;     /* DATA TAG UNIT size */
>  	unsigned int		boot_ro_lock;		/* ro lock support */
> diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
> index fb97b5c..124f562 100644
> --- a/include/linux/mmc/mmc.h
> +++ b/include/linux/mmc/mmc.h
> @@ -428,6 +428,11 @@ struct _mmc_csd {
>  #define EXT_CSD_BKOPS_LEVEL_2		0x2
>  
>  /*
> + * BKOPS modes
> + */
> +#define EXT_CSD_MANUAL_BKOPS_MASK	0x01
> +
> +/*
>   * MMC_SWITCH access modes
>   */
>  
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mmc: Resolve BKOPS compatability issue
  2015-01-30  7:26 ` Jaehoon Chung
@ 2015-01-30 10:25   ` Ulf Hansson
  2015-02-02  2:00     ` Jaehoon Chung
  0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2015-01-30 10:25 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: Alexey Skidanov, Chris Ball, linux-mmc, Alex Lemberg

On 30 January 2015 at 08:26, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi, Alexey.
>
> On 01/29/2015 05:49 PM, Alexey Skidanov wrote:
>> This patch is coming to fix compatibility issue of BKOPS_EN  field of EXT_CSD.
>> In eMMC-5.1, BKOPS_EN was changed, and now it has two operational bits:
>> Bit 0 - MANUAL_EN
>> Bit 1 - AUTO_EN
>> In previous eMMC revisions, only Bit 0 was supported.
>
> If "manual enable" is the same functionality with previous enable,
> I think it doesn't need to change the name..
> Just checking whether enable or not with Mask bit?
>
> If need to add the auto enable, only add the bkops_auto_en in future.
> This is just my preference..and i don't read the spec since i don't have eMMC5.1 spec.
>
> If manual-enable is difference with previous enable, how about using bkops-manual-en?

According to information I have got around the eMMC 5.1 spec, the old
value of MAN_EN will remain. That also means that bit will remain as
one time programmable.

The new AUTO_EN bit, will be multiple writeable with value kept after
power failure. But more importantly, the card seems to expect the host
to disable AUTO_EN before power failure. In other words we need to
disable AUTO_EN (if set) before entering system PM state an cutting
power to the card.

So, yes, we will have to deal with AUTO_EN sooner or later, thus I am
kind of happy Alexey's patch, as is.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mmc: Resolve BKOPS compatability issue
  2015-01-30 10:25   ` Ulf Hansson
@ 2015-02-02  2:00     ` Jaehoon Chung
  0 siblings, 0 replies; 5+ messages in thread
From: Jaehoon Chung @ 2015-02-02  2:00 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Alexey Skidanov, Chris Ball, linux-mmc, Alex Lemberg

Hi,

On 01/30/2015 07:25 PM, Ulf Hansson wrote:
> On 30 January 2015 at 08:26, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> Hi, Alexey.
>>
>> On 01/29/2015 05:49 PM, Alexey Skidanov wrote:
>>> This patch is coming to fix compatibility issue of BKOPS_EN  field of EXT_CSD.
>>> In eMMC-5.1, BKOPS_EN was changed, and now it has two operational bits:
>>> Bit 0 - MANUAL_EN
>>> Bit 1 - AUTO_EN
>>> In previous eMMC revisions, only Bit 0 was supported.
>>
>> If "manual enable" is the same functionality with previous enable,
>> I think it doesn't need to change the name..
>> Just checking whether enable or not with Mask bit?
>>
>> If need to add the auto enable, only add the bkops_auto_en in future.
>> This is just my preference..and i don't read the spec since i don't have eMMC5.1 spec.
>>
>> If manual-enable is difference with previous enable, how about using bkops-manual-en?
> 
> According to information I have got around the eMMC 5.1 spec, the old
> value of MAN_EN will remain. That also means that bit will remain as
> one time programmable.
> 
> The new AUTO_EN bit, will be multiple writeable with value kept after
> power failure. But more importantly, the card seems to expect the host
> to disable AUTO_EN before power failure. In other words we need to
> disable AUTO_EN (if set) before entering system PM state an cutting
> power to the card.

Thanks for information.. I want to get this information,
I think auto_en bit can be used usefully.

Best Regards,
Jaehoon Chung

> 
> So, yes, we will have to deal with AUTO_EN sooner or later, thus I am
> kind of happy Alexey's patch, as is.
> 
> Kind regards
> Uffe
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-02  2:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29  8:49 [PATCH v2] mmc: Resolve BKOPS compatability issue Alexey Skidanov
2015-01-29 10:26 ` Ulf Hansson
2015-01-30  7:26 ` Jaehoon Chung
2015-01-30 10:25   ` Ulf Hansson
2015-02-02  2:00     ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.