* [Patch v1]mmc:core: correct mmc_erase_timeout calculation
@ 2012-03-28 8:29 Chuanxiao Dong
2012-03-28 9:17 ` Namjae Jeon
0 siblings, 1 reply; 9+ messages in thread
From: Chuanxiao Dong @ 2012-03-28 8:29 UTC (permalink / raw)
To: linux-mmc; +Cc: cjb, adrian.hunter
According to JEDEC 7.8.2, mmc_erase_timeout calculation should be follow:
1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT * SEC_ERASE_MULT
2. Secure trim timeout = 300ms * ERASE_TIMEOUT_MULT * SEC_TRIM_MULT
3. Trim timeout = 300ms * TRIM_MULT
4. Erase timeout:
a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms * ERASE_TIMEOUT_MULT
b. if ERASE_GROUP_DEF is false: Erase timeout = write block delay
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
---
drivers/mmc/core/core.c | 42 +++++++++++++++++++++++++++++-------------
1 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 14f262e..d9d6d1c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1405,12 +1405,36 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
{
unsigned int erase_timeout;
- if (card->ext_csd.erase_group_def & 1) {
- /* High Capacity Erase Group Size uses HC timeouts */
- if (arg == MMC_TRIM_ARG)
- erase_timeout = card->ext_csd.trim_timeout;
+ /*
+ * JEDEC 7.8.2
+ *
+ * 1. Secure erase/trim timeout is calculated absed on Erase Timeout
+ * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
+ * So secure erase/trim timeout = ERASE Timeout * SEC_ERASE_MULT/
+ * SEC_TRIM_MULT.
+ * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
+ *
+ * 2. trim timeout is calculated based on the TRIM_MULT factor.
+ * So trim timeout = 300ms * TRIM_MULT
+ *
+ * 3. erase timeout calculation:
+ * a. if ERASE_GROUP_DEF is enabled, ERASE_TIMEOUT_MULT should be
+ * used to calculate erase timeout, so:
+ * erase timeout = 300 * ERASE_TIMEOUT_MULT
+ * b. if ERASE_GROUP_DEF is diabled, the duration of an erase
+ * command will be the number of Erase blocks to be erased
+ * multiplied by the block write delay.
+ */
+ if (arg & MMC_SECURE_ARGS) {
+ erase_timeout = card->ext_csd.hc_erase_timeout;
+ if (arg == MMC_SECURE_ERASE_ARG)
+ erase_timeout *= card->ext_csd.sec_erase_mult;
else
- erase_timeout = card->ext_csd.hc_erase_timeout;
+ erase_timeout *= card->ext_csd.sec_trim_mult;
+ } else if (arg & MMC_TRIM_ARGS) {
+ erase_timeout = card->ext_csd.trim_timeout;
+ } else if (card->ext_csd.erase_group_def & 1) {
+ erase_timeout = card->ext_csd.hc_erase_timeout;
} else {
/* CSD Erase Group Size uses write timeout */
unsigned int mult = (10 << card->csd.r2w_factor);
@@ -1441,14 +1465,6 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
erase_timeout = 1;
}
- /* Multiplier for secure operations */
- if (arg & MMC_SECURE_ARGS) {
- if (arg == MMC_SECURE_ERASE_ARG)
- erase_timeout *= card->ext_csd.sec_erase_mult;
- else
- erase_timeout *= card->ext_csd.sec_trim_mult;
- }
-
erase_timeout *= qty;
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
2012-03-28 8:29 [Patch v1]mmc:core: correct mmc_erase_timeout calculation Chuanxiao Dong
@ 2012-03-28 9:17 ` Namjae Jeon
2012-03-28 9:22 ` Dong, Chuanxiao
0 siblings, 1 reply; 9+ messages in thread
From: Namjae Jeon @ 2012-03-28 9:17 UTC (permalink / raw)
To: Chuanxiao Dong; +Cc: linux-mmc, cjb, adrian.hunter
Hi. Chuanxiao.
Would you share your specification with me ?
When I check the latest emmc 4.5 spec, I can not find it.
Thanks.
2012/3/28 Chuanxiao Dong <chuanxiao.dong@intel.com>:
> According to JEDEC 7.8.2, mmc_erase_timeout calculation should be follow:
> 1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT * SEC_ERASE_MULT
> 2. Secure trim timeout = 300ms * ERASE_TIMEOUT_MULT * SEC_TRIM_MULT
> 3. Trim timeout = 300ms * TRIM_MULT
> 4. Erase timeout:
> a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms * ERASE_TIMEOUT_MULT
> b. if ERASE_GROUP_DEF is false: Erase timeout = write block delay
>
> Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
> ---
> drivers/mmc/core/core.c | 42 +++++++++++++++++++++++++++++-------------
> 1 files changed, 29 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 14f262e..d9d6d1c 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1405,12 +1405,36 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
> {
> unsigned int erase_timeout;
>
> - if (card->ext_csd.erase_group_def & 1) {
> - /* High Capacity Erase Group Size uses HC timeouts */
> - if (arg == MMC_TRIM_ARG)
> - erase_timeout = card->ext_csd.trim_timeout;
> + /*
> + * JEDEC 7.8.2
> + *
> + * 1. Secure erase/trim timeout is calculated absed on Erase Timeout
> + * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
> + * So secure erase/trim timeout = ERASE Timeout * SEC_ERASE_MULT/
> + * SEC_TRIM_MULT.
> + * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
> + *
> + * 2. trim timeout is calculated based on the TRIM_MULT factor.
> + * So trim timeout = 300ms * TRIM_MULT
> + *
> + * 3. erase timeout calculation:
> + * a. if ERASE_GROUP_DEF is enabled, ERASE_TIMEOUT_MULT should be
> + * used to calculate erase timeout, so:
> + * erase timeout = 300 * ERASE_TIMEOUT_MULT
> + * b. if ERASE_GROUP_DEF is diabled, the duration of an erase
> + * command will be the number of Erase blocks to be erased
> + * multiplied by the block write delay.
> + */
> + if (arg & MMC_SECURE_ARGS) {
> + erase_timeout = card->ext_csd.hc_erase_timeout;
> + if (arg == MMC_SECURE_ERASE_ARG)
> + erase_timeout *= card->ext_csd.sec_erase_mult;
> else
> - erase_timeout = card->ext_csd.hc_erase_timeout;
> + erase_timeout *= card->ext_csd.sec_trim_mult;
> + } else if (arg & MMC_TRIM_ARGS) {
> + erase_timeout = card->ext_csd.trim_timeout;
> + } else if (card->ext_csd.erase_group_def & 1) {
> + erase_timeout = card->ext_csd.hc_erase_timeout;
> } else {
> /* CSD Erase Group Size uses write timeout */
> unsigned int mult = (10 << card->csd.r2w_factor);
> @@ -1441,14 +1465,6 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
> erase_timeout = 1;
> }
>
> - /* Multiplier for secure operations */
> - if (arg & MMC_SECURE_ARGS) {
> - if (arg == MMC_SECURE_ERASE_ARG)
> - erase_timeout *= card->ext_csd.sec_erase_mult;
> - else
> - erase_timeout *= card->ext_csd.sec_trim_mult;
> - }
> -
> erase_timeout *= qty;
>
> /*
> --
> 1.7.1
>
> --
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
2012-03-28 9:17 ` Namjae Jeon
@ 2012-03-28 9:22 ` Dong, Chuanxiao
2012-03-28 12:35 ` Namjae Jeon
0 siblings, 1 reply; 9+ messages in thread
From: Dong, Chuanxiao @ 2012-03-28 9:22 UTC (permalink / raw)
To: Namjae Jeon; +Cc: linux-mmc, cjb, Hunter, Adrian
What I am checking with is eMMC4.41 spec, not eMMC4.5 spec.
Forward you the link: www.jedec.org/sites/default/files/docs/JESD84-A441.pdf
Thanks
Chuanxiao
> -----Original Message-----
> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
> Sent: Wednesday, March 28, 2012 5:17 PM
> To: Dong, Chuanxiao
> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
>
> Hi. Chuanxiao.
> Would you share your specification with me ?
> When I check the latest emmc 4.5 spec, I can not find it.
> Thanks.
>
> 2012/3/28 Chuanxiao Dong <chuanxiao.dong@intel.com>:
> > According to JEDEC 7.8.2, mmc_erase_timeout calculation should be follow:
> > 1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT * SEC_ERASE_MULT
> > 2. Secure trim timeout = 300ms * ERASE_TIMEOUT_MULT * SEC_TRIM_MULT 3.
> > Trim timeout = 300ms * TRIM_MULT 4. Erase timeout:
> > a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms *
> > ERASE_TIMEOUT_MULT
> > b. if ERASE_GROUP_DEF is false: Erase timeout = write block delay
> >
> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
> > ---
> > drivers/mmc/core/core.c | 42
> > +++++++++++++++++++++++++++++-------------
> > 1 files changed, 29 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index
> > 14f262e..d9d6d1c 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -1405,12 +1405,36 @@ static unsigned int
> > mmc_mmc_erase_timeout(struct mmc_card *card,
> > {
> > unsigned int erase_timeout;
> >
> > - if (card->ext_csd.erase_group_def & 1) {
> > - /* High Capacity Erase Group Size uses HC timeouts */
> > - if (arg == MMC_TRIM_ARG)
> > - erase_timeout = card->ext_csd.trim_timeout;
> > + /*
> > + * JEDEC 7.8.2
> > + *
> > + * 1. Secure erase/trim timeout is calculated absed on Erase
> > + Timeout
> > + * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
> > + * So secure erase/trim timeout = ERASE Timeout *
> > + SEC_ERASE_MULT/
> > + * SEC_TRIM_MULT.
> > + * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
> > + *
> > + * 2. trim timeout is calculated based on the TRIM_MULT factor.
> > + * So trim timeout = 300ms * TRIM_MULT
> > + *
> > + * 3. erase timeout calculation:
> > + * a. if ERASE_GROUP_DEF is enabled, ERASE_TIMEOUT_MULT
> > + should be
> > + * used to calculate erase timeout, so:
> > + * erase timeout = 300 * ERASE_TIMEOUT_MULT
> > + * b. if ERASE_GROUP_DEF is diabled, the duration of an
> > + erase
> > + * command will be the number of Erase blocks to be
> > + erased
> > + * multiplied by the block write delay.
> > + */
> > + if (arg & MMC_SECURE_ARGS) {
> > + erase_timeout = card->ext_csd.hc_erase_timeout;
> > + if (arg == MMC_SECURE_ERASE_ARG)
> > + erase_timeout *= card->ext_csd.sec_erase_mult;
> > else
> > - erase_timeout =
> > card->ext_csd.hc_erase_timeout;
> > + erase_timeout *= card->ext_csd.sec_trim_mult;
> > + } else if (arg & MMC_TRIM_ARGS) {
> > + erase_timeout = card->ext_csd.trim_timeout;
> > + } else if (card->ext_csd.erase_group_def & 1) {
> > + erase_timeout = card->ext_csd.hc_erase_timeout;
> > } else {
> > /* CSD Erase Group Size uses write timeout */
> > unsigned int mult = (10 << card->csd.r2w_factor); @@
> > -1441,14 +1465,6 @@ static unsigned int mmc_mmc_erase_timeout(struct
> > mmc_card *card,
> > erase_timeout = 1;
> > }
> >
> > - /* Multiplier for secure operations */
> > - if (arg & MMC_SECURE_ARGS) {
> > - if (arg == MMC_SECURE_ERASE_ARG)
> > - erase_timeout *= card->ext_csd.sec_erase_mult;
> > - else
> > - erase_timeout *= card->ext_csd.sec_trim_mult;
> > - }
> > -
> > erase_timeout *= qty;
> >
> > /*
> > --
> > 1.7.1
> >
> > --
> > 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
2012-03-28 9:22 ` Dong, Chuanxiao
@ 2012-03-28 12:35 ` Namjae Jeon
2012-03-29 2:50 ` Dong, Chuanxiao
0 siblings, 1 reply; 9+ messages in thread
From: Namjae Jeon @ 2012-03-28 12:35 UTC (permalink / raw)
To: Dong, Chuanxiao; +Cc: linux-mmc, cjb, Hunter, Adrian
If ERASE_GROUP_DEF is disable with secure erase, erase timeout is
calculated with 300ms * ERASE_TIMEOUT_MULT. Is it right ?
Thanks.
2012/3/28 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
> What I am checking with is eMMC4.41 spec, not eMMC4.5 spec.
> Forward you the link: www.jedec.org/sites/default/files/docs/JESD84-A441.pdf
>
> Thanks
> Chuanxiao
>
>> -----Original Message-----
>> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
>> Sent: Wednesday, March 28, 2012 5:17 PM
>> To: Dong, Chuanxiao
>> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
>> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
>>
>> Hi. Chuanxiao.
>> Would you share your specification with me ?
>> When I check the latest emmc 4.5 spec, I can not find it.
>> Thanks.
>>
>> 2012/3/28 Chuanxiao Dong <chuanxiao.dong@intel.com>:
>> > According to JEDEC 7.8.2, mmc_erase_timeout calculation should be follow:
>> > 1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT * SEC_ERASE_MULT
>> > 2. Secure trim timeout = 300ms * ERASE_TIMEOUT_MULT * SEC_TRIM_MULT 3.
>> > Trim timeout = 300ms * TRIM_MULT 4. Erase timeout:
>> > a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms *
>> > ERASE_TIMEOUT_MULT
>> > b. if ERASE_GROUP_DEF is false: Erase timeout = write block delay
>> >
>> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
>> > ---
>> > drivers/mmc/core/core.c | 42
>> > +++++++++++++++++++++++++++++-------------
>> > 1 files changed, 29 insertions(+), 13 deletions(-)
>> >
>> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index
>> > 14f262e..d9d6d1c 100644
>> > --- a/drivers/mmc/core/core.c
>> > +++ b/drivers/mmc/core/core.c
>> > @@ -1405,12 +1405,36 @@ static unsigned int
>> > mmc_mmc_erase_timeout(struct mmc_card *card,
>> > {
>> > unsigned int erase_timeout;
>> >
>> > - if (card->ext_csd.erase_group_def & 1) {
>> > - /* High Capacity Erase Group Size uses HC timeouts */
>> > - if (arg == MMC_TRIM_ARG)
>> > - erase_timeout = card->ext_csd.trim_timeout;
>> > + /*
>> > + * JEDEC 7.8.2
>> > + *
>> > + * 1. Secure erase/trim timeout is calculated absed on Erase
>> > + Timeout
>> > + * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
>> > + * So secure erase/trim timeout = ERASE Timeout *
>> > + SEC_ERASE_MULT/
>> > + * SEC_TRIM_MULT.
>> > + * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
>> > + *
>> > + * 2. trim timeout is calculated based on the TRIM_MULT factor.
>> > + * So trim timeout = 300ms * TRIM_MULT
>> > + *
>> > + * 3. erase timeout calculation:
>> > + * a. if ERASE_GROUP_DEF is enabled, ERASE_TIMEOUT_MULT
>> > + should be
>> > + * used to calculate erase timeout, so:
>> > + * erase timeout = 300 * ERASE_TIMEOUT_MULT
>> > + * b. if ERASE_GROUP_DEF is diabled, the duration of an
>> > + erase
>> > + * command will be the number of Erase blocks to be
>> > + erased
>> > + * multiplied by the block write delay.
>> > + */
>> > + if (arg & MMC_SECURE_ARGS) {
>> > + erase_timeout = card->ext_csd.hc_erase_timeout;
>> > + if (arg == MMC_SECURE_ERASE_ARG)
>> > + erase_timeout *= card->ext_csd.sec_erase_mult;
>> > else
>> > - erase_timeout =
>> > card->ext_csd.hc_erase_timeout;
>> > + erase_timeout *= card->ext_csd.sec_trim_mult;
>> > + } else if (arg & MMC_TRIM_ARGS) {
>> > + erase_timeout = card->ext_csd.trim_timeout;
>> > + } else if (card->ext_csd.erase_group_def & 1) {
>> > + erase_timeout = card->ext_csd.hc_erase_timeout;
>> > } else {
>> > /* CSD Erase Group Size uses write timeout */
>> > unsigned int mult = (10 << card->csd.r2w_factor); @@
>> > -1441,14 +1465,6 @@ static unsigned int mmc_mmc_erase_timeout(struct
>> > mmc_card *card,
>> > erase_timeout = 1;
>> > }
>> >
>> > - /* Multiplier for secure operations */
>> > - if (arg & MMC_SECURE_ARGS) {
>> > - if (arg == MMC_SECURE_ERASE_ARG)
>> > - erase_timeout *= card->ext_csd.sec_erase_mult;
>> > - else
>> > - erase_timeout *= card->ext_csd.sec_trim_mult;
>> > - }
>> > -
>> > erase_timeout *= qty;
>> >
>> > /*
>> > --
>> > 1.7.1
>> >
>> > --
>> > 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
2012-03-28 12:35 ` Namjae Jeon
@ 2012-03-29 2:50 ` Dong, Chuanxiao
2012-03-29 3:29 ` Namjae Jeon
2012-03-29 4:46 ` Philip Rakity
0 siblings, 2 replies; 9+ messages in thread
From: Dong, Chuanxiao @ 2012-03-29 2:50 UTC (permalink / raw)
To: Namjae Jeon; +Cc: linux-mmc, cjb, Hunter, Adrian
> -----Original Message-----
> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
> Sent: Wednesday, March 28, 2012 8:36 PM
> To: Dong, Chuanxiao
> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
>
> If ERASE_GROUP_DEF is disable with secure erase, erase timeout is calculated with
> 300ms * ERASE_TIMEOUT_MULT. Is it right ?
My understanding about the JESD84-A441 is different with current mmc_mmc_erase_timeout implemented. From the EXT_CSD[230], seems no matter ERASE_GROUP_DEF is enabled or not, secure erase timeout is calculated as 300ms * ERASE_TIMEOUT_MULT * SECURE_ERASE_MULT. That is why I submitted this patch.
Does someone else can correct me if my understanding about the erase timeout calculation is wrong?
Thanks
Chuanxiao
>
> Thanks.
>
> 2012/3/28 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
> > What I am checking with is eMMC4.41 spec, not eMMC4.5 spec.
> > Forward you the link:
> > www.jedec.org/sites/default/files/docs/JESD84-A441.pdf
> >
> > Thanks
> > Chuanxiao
> >
> >> -----Original Message-----
> >> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
> >> Sent: Wednesday, March 28, 2012 5:17 PM
> >> To: Dong, Chuanxiao
> >> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
> >> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout
> >> calculation
> >>
> >> Hi. Chuanxiao.
> >> Would you share your specification with me ?
> >> When I check the latest emmc 4.5 spec, I can not find it.
> >> Thanks.
> >>
> >> 2012/3/28 Chuanxiao Dong <chuanxiao.dong@intel.com>:
> >> > According to JEDEC 7.8.2, mmc_erase_timeout calculation should be follow:
> >> > 1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT *
> >> > SEC_ERASE_MULT 2. Secure trim timeout = 300ms * ERASE_TIMEOUT_MULT *
> SEC_TRIM_MULT 3.
> >> > Trim timeout = 300ms * TRIM_MULT 4. Erase timeout:
> >> > a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms *
> >> > ERASE_TIMEOUT_MULT
> >> > b. if ERASE_GROUP_DEF is false: Erase timeout = write block delay
> >> >
> >> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
> >> > ---
> >> > drivers/mmc/core/core.c | 42
> >> > +++++++++++++++++++++++++++++-------------
> >> > 1 files changed, 29 insertions(+), 13 deletions(-)
> >> >
> >> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> >> > index 14f262e..d9d6d1c 100644
> >> > --- a/drivers/mmc/core/core.c
> >> > +++ b/drivers/mmc/core/core.c
> >> > @@ -1405,12 +1405,36 @@ static unsigned int
> >> > mmc_mmc_erase_timeout(struct mmc_card *card,
> >> > {
> >> > unsigned int erase_timeout;
> >> >
> >> > - if (card->ext_csd.erase_group_def & 1) {
> >> > - /* High Capacity Erase Group Size uses HC timeouts
> >> > */
> >> > - if (arg == MMC_TRIM_ARG)
> >> > - erase_timeout = card->ext_csd.trim_timeout;
> >> > + /*
> >> > + * JEDEC 7.8.2
> >> > + *
> >> > + * 1. Secure erase/trim timeout is calculated absed on
> >> > + Erase Timeout
> >> > + * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
> >> > + * So secure erase/trim timeout = ERASE Timeout *
> >> > + SEC_ERASE_MULT/
> >> > + * SEC_TRIM_MULT.
> >> > + * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
> >> > + *
> >> > + * 2. trim timeout is calculated based on the TRIM_MULT factor.
> >> > + * So trim timeout = 300ms * TRIM_MULT
> >> > + *
> >> > + * 3. erase timeout calculation:
> >> > + * a. if ERASE_GROUP_DEF is enabled,
> >> > + ERASE_TIMEOUT_MULT should be
> >> > + * used to calculate erase timeout, so:
> >> > + * erase timeout = 300 * ERASE_TIMEOUT_MULT
> >> > + * b. if ERASE_GROUP_DEF is diabled, the duration of
> >> > + an erase
> >> > + * command will be the number of Erase blocks to be
> >> > + erased
> >> > + * multiplied by the block write delay.
> >> > + */
> >> > + if (arg & MMC_SECURE_ARGS) {
> >> > + erase_timeout = card->ext_csd.hc_erase_timeout;
> >> > + if (arg == MMC_SECURE_ERASE_ARG)
> >> > + erase_timeout *=
> >> > + card->ext_csd.sec_erase_mult;
> >> > else
> >> > - erase_timeout =
> >> > card->ext_csd.hc_erase_timeout;
> >> > + erase_timeout *=
> >> > + card->ext_csd.sec_trim_mult;
> >> > + } else if (arg & MMC_TRIM_ARGS) {
> >> > + erase_timeout = card->ext_csd.trim_timeout;
> >> > + } else if (card->ext_csd.erase_group_def & 1) {
> >> > + erase_timeout = card->ext_csd.hc_erase_timeout;
> >> > } else {
> >> > /* CSD Erase Group Size uses write timeout */
> >> > unsigned int mult = (10 << card->csd.r2w_factor); @@
> >> > -1441,14 +1465,6 @@ static unsigned int
> >> > mmc_mmc_erase_timeout(struct mmc_card *card,
> >> > erase_timeout = 1;
> >> > }
> >> >
> >> > - /* Multiplier for secure operations */
> >> > - if (arg & MMC_SECURE_ARGS) {
> >> > - if (arg == MMC_SECURE_ERASE_ARG)
> >> > - erase_timeout *=
> >> > card->ext_csd.sec_erase_mult;
> >> > - else
> >> > - erase_timeout *=
> >> > card->ext_csd.sec_trim_mult;
> >> > - }
> >> > -
> >> > erase_timeout *= qty;
> >> >
> >> > /*
> >> > --
> >> > 1.7.1
> >> >
> >> > --
> >> > 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
2012-03-29 2:50 ` Dong, Chuanxiao
@ 2012-03-29 3:29 ` Namjae Jeon
2012-03-29 3:36 ` Dong, Chuanxiao
2012-03-29 4:46 ` Philip Rakity
1 sibling, 1 reply; 9+ messages in thread
From: Namjae Jeon @ 2012-03-29 3:29 UTC (permalink / raw)
To: Dong, Chuanxiao; +Cc: linux-mmc, cjb, Hunter, Adrian
I think that write block delay * SECURE_ERASE_MULT is right in case of
secure erase + ERASE_GROUP_DEF disable.
See the specification contents on 4.4.1.
Erase / Secure Erase
The duration of an erase command will be (order of magnitude) the
number of Erase blocks to be erased
multiplied by the block write delay. If ERASE_GROUP_DEF (EXT_CSD byte
[175]) is enabled,
ERASE_TIMEOUT_MULT should be used to calculate the duration.
Secure Erase timeout is calculated based on the Erase Timeout and
additional SEC_ERASE_MULT factor
(EXT_CSD byte [230]).
Thanks.
2012/3/29 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
>> -----Original Message-----
>> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
>> Sent: Wednesday, March 28, 2012 8:36 PM
>> To: Dong, Chuanxiao
>> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
>> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
>>
>> If ERASE_GROUP_DEF is disable with secure erase, erase timeout is calculated with
>> 300ms * ERASE_TIMEOUT_MULT. Is it right ?
>
> My understanding about the JESD84-A441 is different with current mmc_mmc_erase_timeout implemented. From the EXT_CSD[230], seems no matter ERASE_GROUP_DEF is enabled or not, secure erase timeout is calculated as 300ms * ERASE_TIMEOUT_MULT * SECURE_ERASE_MULT. That is why I submitted this patch.
>
> Does someone else can correct me if my understanding about the erase timeout calculation is wrong?
>
> Thanks
> Chuanxiao
>
>>
>> Thanks.
>>
>> 2012/3/28 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
>> > What I am checking with is eMMC4.41 spec, not eMMC4.5 spec.
>> > Forward you the link:
>> > www.jedec.org/sites/default/files/docs/JESD84-A441.pdf
>> >
>> > Thanks
>> > Chuanxiao
>> >
>> >> -----Original Message-----
>> >> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
>> >> Sent: Wednesday, March 28, 2012 5:17 PM
>> >> To: Dong, Chuanxiao
>> >> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
>> >> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout
>> >> calculation
>> >>
>> >> Hi. Chuanxiao.
>> >> Would you share your specification with me ?
>> >> When I check the latest emmc 4.5 spec, I can not find it.
>> >> Thanks.
>> >>
>> >> 2012/3/28 Chuanxiao Dong <chuanxiao.dong@intel.com>:
>> >> > According to JEDEC 7.8.2, mmc_erase_timeout calculation should be follow:
>> >> > 1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT *
>> >> > SEC_ERASE_MULT 2. Secure trim timeout = 300ms * ERASE_TIMEOUT_MULT *
>> SEC_TRIM_MULT 3.
>> >> > Trim timeout = 300ms * TRIM_MULT 4. Erase timeout:
>> >> > a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms *
>> >> > ERASE_TIMEOUT_MULT
>> >> > b. if ERASE_GROUP_DEF is false: Erase timeout = write block delay
>> >> >
>> >> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
>> >> > ---
>> >> > drivers/mmc/core/core.c | 42
>> >> > +++++++++++++++++++++++++++++-------------
>> >> > 1 files changed, 29 insertions(+), 13 deletions(-)
>> >> >
>> >> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>> >> > index 14f262e..d9d6d1c 100644
>> >> > --- a/drivers/mmc/core/core.c
>> >> > +++ b/drivers/mmc/core/core.c
>> >> > @@ -1405,12 +1405,36 @@ static unsigned int
>> >> > mmc_mmc_erase_timeout(struct mmc_card *card,
>> >> > {
>> >> > unsigned int erase_timeout;
>> >> >
>> >> > - if (card->ext_csd.erase_group_def & 1) {
>> >> > - /* High Capacity Erase Group Size uses HC timeouts
>> >> > */
>> >> > - if (arg == MMC_TRIM_ARG)
>> >> > - erase_timeout = card->ext_csd.trim_timeout;
>> >> > + /*
>> >> > + * JEDEC 7.8.2
>> >> > + *
>> >> > + * 1. Secure erase/trim timeout is calculated absed on
>> >> > + Erase Timeout
>> >> > + * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
>> >> > + * So secure erase/trim timeout = ERASE Timeout *
>> >> > + SEC_ERASE_MULT/
>> >> > + * SEC_TRIM_MULT.
>> >> > + * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
>> >> > + *
>> >> > + * 2. trim timeout is calculated based on the TRIM_MULT factor.
>> >> > + * So trim timeout = 300ms * TRIM_MULT
>> >> > + *
>> >> > + * 3. erase timeout calculation:
>> >> > + * a. if ERASE_GROUP_DEF is enabled,
>> >> > + ERASE_TIMEOUT_MULT should be
>> >> > + * used to calculate erase timeout, so:
>> >> > + * erase timeout = 300 * ERASE_TIMEOUT_MULT
>> >> > + * b. if ERASE_GROUP_DEF is diabled, the duration of
>> >> > + an erase
>> >> > + * command will be the number of Erase blocks to be
>> >> > + erased
>> >> > + * multiplied by the block write delay.
>> >> > + */
>> >> > + if (arg & MMC_SECURE_ARGS) {
>> >> > + erase_timeout = card->ext_csd.hc_erase_timeout;
>> >> > + if (arg == MMC_SECURE_ERASE_ARG)
>> >> > + erase_timeout *=
>> >> > + card->ext_csd.sec_erase_mult;
>> >> > else
>> >> > - erase_timeout =
>> >> > card->ext_csd.hc_erase_timeout;
>> >> > + erase_timeout *=
>> >> > + card->ext_csd.sec_trim_mult;
>> >> > + } else if (arg & MMC_TRIM_ARGS) {
>> >> > + erase_timeout = card->ext_csd.trim_timeout;
>> >> > + } else if (card->ext_csd.erase_group_def & 1) {
>> >> > + erase_timeout = card->ext_csd.hc_erase_timeout;
>> >> > } else {
>> >> > /* CSD Erase Group Size uses write timeout */
>> >> > unsigned int mult = (10 << card->csd.r2w_factor); @@
>> >> > -1441,14 +1465,6 @@ static unsigned int
>> >> > mmc_mmc_erase_timeout(struct mmc_card *card,
>> >> > erase_timeout = 1;
>> >> > }
>> >> >
>> >> > - /* Multiplier for secure operations */
>> >> > - if (arg & MMC_SECURE_ARGS) {
>> >> > - if (arg == MMC_SECURE_ERASE_ARG)
>> >> > - erase_timeout *=
>> >> > card->ext_csd.sec_erase_mult;
>> >> > - else
>> >> > - erase_timeout *=
>> >> > card->ext_csd.sec_trim_mult;
>> >> > - }
>> >> > -
>> >> > erase_timeout *= qty;
>> >> >
>> >> > /*
>> >> > --
>> >> > 1.7.1
>> >> >
>> >> > --
>> >> > 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
2012-03-29 3:29 ` Namjae Jeon
@ 2012-03-29 3:36 ` Dong, Chuanxiao
2012-03-29 3:51 ` Namjae Jeon
0 siblings, 1 reply; 9+ messages in thread
From: Dong, Chuanxiao @ 2012-03-29 3:36 UTC (permalink / raw)
To: Namjae Jeon; +Cc: linux-mmc, cjb, Hunter, Adrian
> -----Original Message-----
> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
> Sent: Thursday, March 29, 2012 11:30 AM
> To: Dong, Chuanxiao
> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
>
> I think that write block delay * SECURE_ERASE_MULT is right in case of secure
> erase + ERASE_GROUP_DEF disable.
Thanks Namjae, seems I misunderstand the meaning of "Erase Timeout". It just means a timeout value for erase operation.
>
> See the specification contents on 4.4.1.
> Erase / Secure Erase
> The duration of an erase command will be (order of magnitude) the number of
> Erase blocks to be erased multiplied by the block write delay. If ERASE_GROUP_DEF
> (EXT_CSD byte
> [175]) is enabled,
> ERASE_TIMEOUT_MULT should be used to calculate the duration.
> Secure Erase timeout is calculated based on the Erase Timeout and additional
> SEC_ERASE_MULT factor (EXT_CSD byte [230]).
>
> Thanks.
>
> 2012/3/29 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
> >> -----Original Message-----
> >> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
> >> Sent: Wednesday, March 28, 2012 8:36 PM
> >> To: Dong, Chuanxiao
> >> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
> >> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout
> >> calculation
> >>
> >> If ERASE_GROUP_DEF is disable with secure erase, erase timeout is
> >> calculated with 300ms * ERASE_TIMEOUT_MULT. Is it right ?
> >
> > My understanding about the JESD84-A441 is different with current
> mmc_mmc_erase_timeout implemented. From the EXT_CSD[230], seems no
> matter ERASE_GROUP_DEF is enabled or not, secure erase timeout is calculated as
> 300ms * ERASE_TIMEOUT_MULT * SECURE_ERASE_MULT. That is why I submitted
> this patch.
> >
> > Does someone else can correct me if my understanding about the erase timeout
> calculation is wrong?
> >
> > Thanks
> > Chuanxiao
> >
> >>
> >> Thanks.
> >>
> >> 2012/3/28 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
> >> > What I am checking with is eMMC4.41 spec, not eMMC4.5 spec.
> >> > Forward you the link:
> >> > www.jedec.org/sites/default/files/docs/JESD84-A441.pdf
> >> >
> >> > Thanks
> >> > Chuanxiao
> >> >
> >> >> -----Original Message-----
> >> >> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
> >> >> Sent: Wednesday, March 28, 2012 5:17 PM
> >> >> To: Dong, Chuanxiao
> >> >> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
> >> >> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout
> >> >> calculation
> >> >>
> >> >> Hi. Chuanxiao.
> >> >> Would you share your specification with me ?
> >> >> When I check the latest emmc 4.5 spec, I can not find it.
> >> >> Thanks.
> >> >>
> >> >> 2012/3/28 Chuanxiao Dong <chuanxiao.dong@intel.com>:
> >> >> > According to JEDEC 7.8.2, mmc_erase_timeout calculation should be
> follow:
> >> >> > 1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT *
> >> >> > SEC_ERASE_MULT 2. Secure trim timeout = 300ms *
> >> >> > ERASE_TIMEOUT_MULT *
> >> SEC_TRIM_MULT 3.
> >> >> > Trim timeout = 300ms * TRIM_MULT 4. Erase timeout:
> >> >> > a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms *
> >> >> > ERASE_TIMEOUT_MULT
> >> >> > b. if ERASE_GROUP_DEF is false: Erase timeout = write block
> >> >> > delay
> >> >> >
> >> >> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
> >> >> > ---
> >> >> > drivers/mmc/core/core.c | 42
> >> >> > +++++++++++++++++++++++++++++-------------
> >> >> > 1 files changed, 29 insertions(+), 13 deletions(-)
> >> >> >
> >> >> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> >> >> > index 14f262e..d9d6d1c 100644
> >> >> > --- a/drivers/mmc/core/core.c
> >> >> > +++ b/drivers/mmc/core/core.c
> >> >> > @@ -1405,12 +1405,36 @@ static unsigned int
> >> >> > mmc_mmc_erase_timeout(struct mmc_card *card,
> >> >> > {
> >> >> > unsigned int erase_timeout;
> >> >> >
> >> >> > - if (card->ext_csd.erase_group_def & 1) {
> >> >> > - /* High Capacity Erase Group Size uses HC
> >> >> > timeouts */
> >> >> > - if (arg == MMC_TRIM_ARG)
> >> >> > - erase_timeout =
> >> >> > card->ext_csd.trim_timeout;
> >> >> > + /*
> >> >> > + * JEDEC 7.8.2
> >> >> > + *
> >> >> > + * 1. Secure erase/trim timeout is calculated absed on
> >> >> > + Erase Timeout
> >> >> > + * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
> >> >> > + * So secure erase/trim timeout = ERASE Timeout *
> >> >> > + SEC_ERASE_MULT/
> >> >> > + * SEC_TRIM_MULT.
> >> >> > + * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
> >> >> > + *
> >> >> > + * 2. trim timeout is calculated based on the TRIM_MULT factor.
> >> >> > + * So trim timeout = 300ms * TRIM_MULT
> >> >> > + *
> >> >> > + * 3. erase timeout calculation:
> >> >> > + * a. if ERASE_GROUP_DEF is enabled,
> >> >> > + ERASE_TIMEOUT_MULT should be
> >> >> > + * used to calculate erase timeout, so:
> >> >> > + * erase timeout = 300 * ERASE_TIMEOUT_MULT
> >> >> > + * b. if ERASE_GROUP_DEF is diabled, the duration
> >> >> > + of an erase
> >> >> > + * command will be the number of Erase blocks to be
> >> >> > + erased
> >> >> > + * multiplied by the block write delay.
> >> >> > + */
> >> >> > + if (arg & MMC_SECURE_ARGS) {
> >> >> > + erase_timeout = card->ext_csd.hc_erase_timeout;
> >> >> > + if (arg == MMC_SECURE_ERASE_ARG)
> >> >> > + erase_timeout *=
> >> >> > + card->ext_csd.sec_erase_mult;
> >> >> > else
> >> >> > - erase_timeout =
> >> >> > card->ext_csd.hc_erase_timeout;
> >> >> > + erase_timeout *=
> >> >> > + card->ext_csd.sec_trim_mult;
> >> >> > + } else if (arg & MMC_TRIM_ARGS) {
> >> >> > + erase_timeout = card->ext_csd.trim_timeout;
> >> >> > + } else if (card->ext_csd.erase_group_def & 1) {
> >> >> > + erase_timeout = card->ext_csd.hc_erase_timeout;
> >> >> > } else {
> >> >> > /* CSD Erase Group Size uses write timeout */
> >> >> > unsigned int mult = (10 << card->csd.r2w_factor);
> >> >> > @@
> >> >> > -1441,14 +1465,6 @@ static unsigned int
> >> >> > mmc_mmc_erase_timeout(struct mmc_card *card,
> >> >> > erase_timeout = 1;
> >> >> > }
> >> >> >
> >> >> > - /* Multiplier for secure operations */
> >> >> > - if (arg & MMC_SECURE_ARGS) {
> >> >> > - if (arg == MMC_SECURE_ERASE_ARG)
> >> >> > - erase_timeout *=
> >> >> > card->ext_csd.sec_erase_mult;
> >> >> > - else
> >> >> > - erase_timeout *=
> >> >> > card->ext_csd.sec_trim_mult;
> >> >> > - }
> >> >> > -
> >> >> > erase_timeout *= qty;
> >> >> >
> >> >> > /*
> >> >> > --
> >> >> > 1.7.1
> >> >> >
> >> >> > --
> >> >> > 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
2012-03-29 3:36 ` Dong, Chuanxiao
@ 2012-03-29 3:51 ` Namjae Jeon
0 siblings, 0 replies; 9+ messages in thread
From: Namjae Jeon @ 2012-03-29 3:51 UTC (permalink / raw)
To: Dong, Chuanxiao; +Cc: linux-mmc, cjb, Hunter, Adrian
Actually, Specfication is described to be misunderstood easily.
Nice day.
2012/3/29 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
>
>> -----Original Message-----
>> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
>> Sent: Thursday, March 29, 2012 11:30 AM
>> To: Dong, Chuanxiao
>> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
>> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
>>
>> I think that write block delay * SECURE_ERASE_MULT is right in case of secure
>> erase + ERASE_GROUP_DEF disable.
> Thanks Namjae, seems I misunderstand the meaning of "Erase Timeout". It just means a timeout value for erase operation.
>
>>
>> See the specification contents on 4.4.1.
>> Erase / Secure Erase
>> The duration of an erase command will be (order of magnitude) the number of
>> Erase blocks to be erased multiplied by the block write delay. If ERASE_GROUP_DEF
>> (EXT_CSD byte
>> [175]) is enabled,
>> ERASE_TIMEOUT_MULT should be used to calculate the duration.
>> Secure Erase timeout is calculated based on the Erase Timeout and additional
>> SEC_ERASE_MULT factor (EXT_CSD byte [230]).
>>
>> Thanks.
>>
>> 2012/3/29 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
>> >> -----Original Message-----
>> >> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
>> >> Sent: Wednesday, March 28, 2012 8:36 PM
>> >> To: Dong, Chuanxiao
>> >> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
>> >> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout
>> >> calculation
>> >>
>> >> If ERASE_GROUP_DEF is disable with secure erase, erase timeout is
>> >> calculated with 300ms * ERASE_TIMEOUT_MULT. Is it right ?
>> >
>> > My understanding about the JESD84-A441 is different with current
>> mmc_mmc_erase_timeout implemented. From the EXT_CSD[230], seems no
>> matter ERASE_GROUP_DEF is enabled or not, secure erase timeout is calculated as
>> 300ms * ERASE_TIMEOUT_MULT * SECURE_ERASE_MULT. That is why I submitted
>> this patch.
>> >
>> > Does someone else can correct me if my understanding about the erase timeout
>> calculation is wrong?
>> >
>> > Thanks
>> > Chuanxiao
>> >
>> >>
>> >> Thanks.
>> >>
>> >> 2012/3/28 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
>> >> > What I am checking with is eMMC4.41 spec, not eMMC4.5 spec.
>> >> > Forward you the link:
>> >> > www.jedec.org/sites/default/files/docs/JESD84-A441.pdf
>> >> >
>> >> > Thanks
>> >> > Chuanxiao
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
>> >> >> Sent: Wednesday, March 28, 2012 5:17 PM
>> >> >> To: Dong, Chuanxiao
>> >> >> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
>> >> >> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout
>> >> >> calculation
>> >> >>
>> >> >> Hi. Chuanxiao.
>> >> >> Would you share your specification with me ?
>> >> >> When I check the latest emmc 4.5 spec, I can not find it.
>> >> >> Thanks.
>> >> >>
>> >> >> 2012/3/28 Chuanxiao Dong <chuanxiao.dong@intel.com>:
>> >> >> > According to JEDEC 7.8.2, mmc_erase_timeout calculation should be
>> follow:
>> >> >> > 1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT *
>> >> >> > SEC_ERASE_MULT 2. Secure trim timeout = 300ms *
>> >> >> > ERASE_TIMEOUT_MULT *
>> >> SEC_TRIM_MULT 3.
>> >> >> > Trim timeout = 300ms * TRIM_MULT 4. Erase timeout:
>> >> >> > a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms *
>> >> >> > ERASE_TIMEOUT_MULT
>> >> >> > b. if ERASE_GROUP_DEF is false: Erase timeout = write block
>> >> >> > delay
>> >> >> >
>> >> >> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
>> >> >> > ---
>> >> >> > drivers/mmc/core/core.c | 42
>> >> >> > +++++++++++++++++++++++++++++-------------
>> >> >> > 1 files changed, 29 insertions(+), 13 deletions(-)
>> >> >> >
>> >> >> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>> >> >> > index 14f262e..d9d6d1c 100644
>> >> >> > --- a/drivers/mmc/core/core.c
>> >> >> > +++ b/drivers/mmc/core/core.c
>> >> >> > @@ -1405,12 +1405,36 @@ static unsigned int
>> >> >> > mmc_mmc_erase_timeout(struct mmc_card *card,
>> >> >> > {
>> >> >> > unsigned int erase_timeout;
>> >> >> >
>> >> >> > - if (card->ext_csd.erase_group_def & 1) {
>> >> >> > - /* High Capacity Erase Group Size uses HC
>> >> >> > timeouts */
>> >> >> > - if (arg == MMC_TRIM_ARG)
>> >> >> > - erase_timeout =
>> >> >> > card->ext_csd.trim_timeout;
>> >> >> > + /*
>> >> >> > + * JEDEC 7.8.2
>> >> >> > + *
>> >> >> > + * 1. Secure erase/trim timeout is calculated absed on
>> >> >> > + Erase Timeout
>> >> >> > + * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
>> >> >> > + * So secure erase/trim timeout = ERASE Timeout *
>> >> >> > + SEC_ERASE_MULT/
>> >> >> > + * SEC_TRIM_MULT.
>> >> >> > + * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
>> >> >> > + *
>> >> >> > + * 2. trim timeout is calculated based on the TRIM_MULT factor.
>> >> >> > + * So trim timeout = 300ms * TRIM_MULT
>> >> >> > + *
>> >> >> > + * 3. erase timeout calculation:
>> >> >> > + * a. if ERASE_GROUP_DEF is enabled,
>> >> >> > + ERASE_TIMEOUT_MULT should be
>> >> >> > + * used to calculate erase timeout, so:
>> >> >> > + * erase timeout = 300 * ERASE_TIMEOUT_MULT
>> >> >> > + * b. if ERASE_GROUP_DEF is diabled, the duration
>> >> >> > + of an erase
>> >> >> > + * command will be the number of Erase blocks to be
>> >> >> > + erased
>> >> >> > + * multiplied by the block write delay.
>> >> >> > + */
>> >> >> > + if (arg & MMC_SECURE_ARGS) {
>> >> >> > + erase_timeout = card->ext_csd.hc_erase_timeout;
>> >> >> > + if (arg == MMC_SECURE_ERASE_ARG)
>> >> >> > + erase_timeout *=
>> >> >> > + card->ext_csd.sec_erase_mult;
>> >> >> > else
>> >> >> > - erase_timeout =
>> >> >> > card->ext_csd.hc_erase_timeout;
>> >> >> > + erase_timeout *=
>> >> >> > + card->ext_csd.sec_trim_mult;
>> >> >> > + } else if (arg & MMC_TRIM_ARGS) {
>> >> >> > + erase_timeout = card->ext_csd.trim_timeout;
>> >> >> > + } else if (card->ext_csd.erase_group_def & 1) {
>> >> >> > + erase_timeout = card->ext_csd.hc_erase_timeout;
>> >> >> > } else {
>> >> >> > /* CSD Erase Group Size uses write timeout */
>> >> >> > unsigned int mult = (10 << card->csd.r2w_factor);
>> >> >> > @@
>> >> >> > -1441,14 +1465,6 @@ static unsigned int
>> >> >> > mmc_mmc_erase_timeout(struct mmc_card *card,
>> >> >> > erase_timeout = 1;
>> >> >> > }
>> >> >> >
>> >> >> > - /* Multiplier for secure operations */
>> >> >> > - if (arg & MMC_SECURE_ARGS) {
>> >> >> > - if (arg == MMC_SECURE_ERASE_ARG)
>> >> >> > - erase_timeout *=
>> >> >> > card->ext_csd.sec_erase_mult;
>> >> >> > - else
>> >> >> > - erase_timeout *=
>> >> >> > card->ext_csd.sec_trim_mult;
>> >> >> > - }
>> >> >> > -
>> >> >> > erase_timeout *= qty;
>> >> >> >
>> >> >> > /*
>> >> >> > --
>> >> >> > 1.7.1
>> >> >> >
>> >> >> > --
>> >> >> > 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
2012-03-29 2:50 ` Dong, Chuanxiao
2012-03-29 3:29 ` Namjae Jeon
@ 2012-03-29 4:46 ` Philip Rakity
1 sibling, 0 replies; 9+ messages in thread
From: Philip Rakity @ 2012-03-29 4:46 UTC (permalink / raw)
To: Dong, Chuanxiao; +Cc: Namjae Jeon, linux-mmc, cjb, Hunter, Adrian
On Mar 28, 2012, at 7:50 PM, Dong, Chuanxiao wrote:
>> -----Original Message-----
>> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
>> Sent: Wednesday, March 28, 2012 8:36 PM
>> To: Dong, Chuanxiao
>> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
>> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout calculation
>>
>> If ERASE_GROUP_DEF is disable with secure erase, erase timeout is calculated with
>> 300ms * ERASE_TIMEOUT_MULT. Is it right ?
>
> My understanding about the JESD84-A441 is different with current mmc_mmc_erase_timeout implemented. From the EXT_CSD[230], seems no matter ERASE_GROUP_DEF is enabled or not, secure erase timeout is calculated as 300ms * ERASE_TIMEOUT_MULT * SECURE_ERASE_MULT. That is why I submitted this patch.
>
This is what is in the draft 4.51 spec
> Does someone else can correct me if my understanding about the erase timeout calculation is wrong?
>
> Thanks
> Chuanxiao
>
>>
>> Thanks.
>>
>> 2012/3/28 Dong, Chuanxiao <chuanxiao.dong@intel.com>:
>>> What I am checking with is eMMC4.41 spec, not eMMC4.5 spec.
>>> Forward you the link:
>>> www.jedec.org/sites/default/files/docs/JESD84-A441.pdf
>>>
>>> Thanks
>>> Chuanxiao
>>>
>>>> -----Original Message-----
>>>> From: Namjae Jeon [mailto:linkinjeon@gmail.com]
>>>> Sent: Wednesday, March 28, 2012 5:17 PM
>>>> To: Dong, Chuanxiao
>>>> Cc: linux-mmc@vger.kernel.org; cjb@laptop.org; Hunter, Adrian
>>>> Subject: Re: [Patch v1]mmc:core: correct mmc_erase_timeout
>>>> calculation
>>>>
>>>> Hi. Chuanxiao.
>>>> Would you share your specification with me ?
>>>> When I check the latest emmc 4.5 spec, I can not find it.
>>>> Thanks.
>>>>
>>>> 2012/3/28 Chuanxiao Dong <chuanxiao.dong@intel.com>:
>>>>> According to JEDEC 7.8.2, mmc_erase_timeout calculation should be follow:
>>>>> 1. Secure erase timeout = 300ms * ERASE_TIMEOUT_MULT *
>>>>> SEC_ERASE_MULT 2. Secure trim timeout = 300ms * ERASE_TIMEOUT_MULT *
>> SEC_TRIM_MULT 3.
>>>>> Trim timeout = 300ms * TRIM_MULT 4. Erase timeout:
>>>>> a. if ERASE_GROUP_DEF is true: Erase timeout = 300ms *
>>>>> ERASE_TIMEOUT_MULT
>>>>> b. if ERASE_GROUP_DEF is false: Erase timeout = write block delay
>>>>>
>>>>> Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
>>>>> ---
>>>>> drivers/mmc/core/core.c | 42
>>>>> +++++++++++++++++++++++++++++-------------
>>>>> 1 files changed, 29 insertions(+), 13 deletions(-)
>>>>>
>>>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>>>>> index 14f262e..d9d6d1c 100644
>>>>> --- a/drivers/mmc/core/core.c
>>>>> +++ b/drivers/mmc/core/core.c
>>>>> @@ -1405,12 +1405,36 @@ static unsigned int
>>>>> mmc_mmc_erase_timeout(struct mmc_card *card,
>>>>> {
>>>>> unsigned int erase_timeout;
>>>>>
>>>>> - if (card->ext_csd.erase_group_def & 1) {
>>>>> - /* High Capacity Erase Group Size uses HC timeouts
>>>>> */
>>>>> - if (arg == MMC_TRIM_ARG)
>>>>> - erase_timeout = card->ext_csd.trim_timeout;
>>>>> + /*
>>>>> + * JEDEC 7.8.2
>>>>> + *
>>>>> + * 1. Secure erase/trim timeout is calculated absed on
>>>>> + Erase Timeout
>>>>> + * and additional SEC_ERASE_MULT/SEC_TRIM_MULT.
>>>>> + * So secure erase/trim timeout = ERASE Timeout *
>>>>> + SEC_ERASE_MULT/
>>>>> + * SEC_TRIM_MULT.
>>>>> + * ERASE Timeout = 300ms * ERASE_TIMEOUT_MULT
>>>>> + *
>>>>> + * 2. trim timeout is calculated based on the TRIM_MULT factor.
>>>>> + * So trim timeout = 300ms * TRIM_MULT
>>>>> + *
>>>>> + * 3. erase timeout calculation:
>>>>> + * a. if ERASE_GROUP_DEF is enabled,
>>>>> + ERASE_TIMEOUT_MULT should be
>>>>> + * used to calculate erase timeout, so:
>>>>> + * erase timeout = 300 * ERASE_TIMEOUT_MULT
>>>>> + * b. if ERASE_GROUP_DEF is diabled, the duration of
>>>>> + an erase
>>>>> + * command will be the number of Erase blocks to be
>>>>> + erased
>>>>> + * multiplied by the block write delay.
>>>>> + */
>>>>> + if (arg & MMC_SECURE_ARGS) {
>>>>> + erase_timeout = card->ext_csd.hc_erase_timeout;
>>>>> + if (arg == MMC_SECURE_ERASE_ARG)
>>>>> + erase_timeout *=
>>>>> + card->ext_csd.sec_erase_mult;
>>>>> else
>>>>> - erase_timeout =
>>>>> card->ext_csd.hc_erase_timeout;
>>>>> + erase_timeout *=
>>>>> + card->ext_csd.sec_trim_mult;
>>>>> + } else if (arg & MMC_TRIM_ARGS) {
>>>>> + erase_timeout = card->ext_csd.trim_timeout;
>>>>> + } else if (card->ext_csd.erase_group_def & 1) {
>>>>> + erase_timeout = card->ext_csd.hc_erase_timeout;
>>>>> } else {
>>>>> /* CSD Erase Group Size uses write timeout */
>>>>> unsigned int mult = (10 << card->csd.r2w_factor); @@
>>>>> -1441,14 +1465,6 @@ static unsigned int
>>>>> mmc_mmc_erase_timeout(struct mmc_card *card,
>>>>> erase_timeout = 1;
>>>>> }
>>>>>
>>>>> - /* Multiplier for secure operations */
>>>>> - if (arg & MMC_SECURE_ARGS) {
>>>>> - if (arg == MMC_SECURE_ERASE_ARG)
>>>>> - erase_timeout *=
>>>>> card->ext_csd.sec_erase_mult;
>>>>> - else
>>>>> - erase_timeout *=
>>>>> card->ext_csd.sec_trim_mult;
>>>>> - }
>>>>> -
>>>>> erase_timeout *= qty;
>>>>>
>>>>> /*
>>>>> --
>>>>> 1.7.1
>>>>>
>>>>> --
>>>>> 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
> \x04�{.n�+�������+%��lzwm��b�맲��r��zX��\x19�r)���w*\x1fjg���\x1e�����ݢj/���z�ޖ��2�ޙ���&�)ߡ�a��\x7f��\x1e�G���h�\x0f�j:+v���w�٥
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-03-29 4:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28 8:29 [Patch v1]mmc:core: correct mmc_erase_timeout calculation Chuanxiao Dong
2012-03-28 9:17 ` Namjae Jeon
2012-03-28 9:22 ` Dong, Chuanxiao
2012-03-28 12:35 ` Namjae Jeon
2012-03-29 2:50 ` Dong, Chuanxiao
2012-03-29 3:29 ` Namjae Jeon
2012-03-29 3:36 ` Dong, Chuanxiao
2012-03-29 3:51 ` Namjae Jeon
2012-03-29 4:46 ` Philip Rakity
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.