mmc:core: correct mmc_erase_timeout calculation
PATCH 1/1 mmc:core: correct mmc_erase_timeout calculation
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
--- drivers/mmc/core/core.c | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-)
drivers/mmc/core/core.c +29 -13
@@ -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;/*
Signature · 1 line
1.7.1
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 <[email protected]>:
Quoted 81 lines
According to JEDEC 7.8.2,
mmc_erase_timeoutcalculation 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. ifERASE_GROUP_DEFis true: Erase timeout = 300ms *ERASE_TIMEOUT_MULTb. ifERASE_GROUP_DEFis false: Erase timeout = write block delaySigned-off-by Chuanxiao Dong <[email protected]>---
drivers/mmc/core/core.c | 42 +++++++++++++++++++++++++++++-------------1 files changed, 29 insertions(+), 13 deletions(-)drivers/mmc/core/core.c +24
-4@@ -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);drivers/mmc/core/core.c +0
-9@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
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
Quoted 103 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 5:17 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationHi. 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 <[email protected]>:
Quoted 90 lines
According to JEDEC 7.8.2,
mmc_erase_timeoutcalculation should be follow:
1. Secure erase timeout = 300ms *ERASE_TIMEOUT_MULT*SEC_ERASE_MULT
2. Secure trim timeout = 300ms *ERASE_TIMEOUT_MULT*SEC_TRIM_MULT3. Trim timeout = 300ms *TRIM_MULT4. Erase timeout:
a. ifERASE_GROUP_DEFis true: Erase timeout = 300ms *ERASE_TIMEOUT_MULT
b. ifERASE_GROUP_DEFis false: Erase timeout = write block delaySigned-off-by Chuanxiao Dong <[email protected]>---
drivers/mmc/core/core.c | 42
+++++++++++++++++++++++++++++-------------1 files changed, 29 insertions(+), 13 deletions(-)drivers/mmc/core/core.c index renamed from drivers/mmc/core/core.c +0
-014f262e..d9d6d1c 100644
drivers/mmc/core/core.c +29
-4@@ -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(structmmc_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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
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 <[email protected]>:
Quoted 109 lines
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
ChuanxiaoQuoted 103 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 5:17 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationHi. 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 <[email protected]>:
Quoted 90 lines
According to JEDEC 7.8.2,
mmc_erase_timeoutcalculation should be follow:
1. Secure erase timeout = 300ms *ERASE_TIMEOUT_MULT*SEC_ERASE_MULT
2. Secure trim timeout = 300ms *ERASE_TIMEOUT_MULT*SEC_TRIM_MULT3. Trim timeout = 300ms *TRIM_MULT4. Erase timeout:
a. ifERASE_GROUP_DEFis true: Erase timeout = 300ms *ERASE_TIMEOUT_MULT
b. ifERASE_GROUP_DEFis false: Erase timeout = write block delaySigned-off-by Chuanxiao Dong <[email protected]>---
drivers/mmc/core/core.c | 42
+++++++++++++++++++++++++++++-------------1 files changed, 29 insertions(+), 13 deletions(-)drivers/mmc/core/core.c index renamed from drivers/mmc/core/core.c +0
-014f262e..d9d6d1c 100644
drivers/mmc/core/core.c +29
-4@@ -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(structmmc_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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 8:36 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationIf
ERASE_GROUP_DEFis 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
Quoted 121 lines
Thanks.
2012/3/28 Dong, Chuanxiao <[email protected]>:
Quoted 4 lines
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.pdfQuoted 20 lines
Thanks
ChuanxiaoQuoted 17 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 5:17 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationHi. 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 <[email protected]>:
Quoted 3 lines
According to JEDEC 7.8.2,
mmc_erase_timeoutcalculation should be follow:
1. Secure erase timeout = 300ms *ERASE_TIMEOUT_MULT*SEC_ERASE_MULT2. Secure trim timeout = 300ms *ERASE_TIMEOUT_MULT*
SEC_TRIM_MULT3.Quoted 92 lines
Quoted 92 lines
Quoted 92 lines
Trim timeout = 300ms *
TRIM_MULT4. Erase timeout:
a. ifERASE_GROUP_DEFis true: Erase timeout = 300ms *ERASE_TIMEOUT_MULT
b. ifERASE_GROUP_DEFis false: Erase timeout = write block delaySigned-off-by Chuanxiao Dong <[email protected]>---
drivers/mmc/core/core.c | 42
+++++++++++++++++++++++++++++-------------1 files changed, 29 insertions(+), 13 deletions(-)drivers/mmc/core/core.c +30
-4@@ -1405,12 +1405,36 @@ static unsigned intmmc_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(structmmc_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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
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 <[email protected]>:
Quoted 138 lines
Quoted 9 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 8:36 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationIf
ERASE_GROUP_DEFis 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_timeoutimplemented. From the EXT_CSD[230], seems no matterERASE_GROUP_DEFis 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
ChuanxiaoQuoted 121 lines
Thanks.
2012/3/28 Dong, Chuanxiao <[email protected]>:
Quoted 4 lines
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.pdfQuoted 20 lines
Thanks
ChuanxiaoQuoted 17 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 5:17 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationHi. 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 <[email protected]>:
Quoted 3 lines
According to JEDEC 7.8.2,
mmc_erase_timeoutcalculation should be follow:
1. Secure erase timeout = 300ms *ERASE_TIMEOUT_MULT*SEC_ERASE_MULT2. Secure trim timeout = 300ms *ERASE_TIMEOUT_MULT*
SEC_TRIM_MULT3.Quoted 92 lines
Quoted 92 lines
Quoted 92 lines
Trim timeout = 300ms *
TRIM_MULT4. Erase timeout:
a. ifERASE_GROUP_DEFis true: Erase timeout = 300ms *ERASE_TIMEOUT_MULT
b. ifERASE_GROUP_DEFis false: Erase timeout = write block delaySigned-off-by Chuanxiao Dong <[email protected]>---
drivers/mmc/core/core.c | 42
+++++++++++++++++++++++++++++-------------1 files changed, 29 insertions(+), 13 deletions(-)drivers/mmc/core/core.c +30
-4@@ -1405,12 +1405,36 @@ static unsigned intmmc_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(structmmc_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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Thursday, March 29, 2012 11:30 AM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationI think that write block delay *
SECURE_ERASE_MULTis right in case of secure erase +ERASE_GROUP_DEFdisable.
Thanks Namjae, seems I misunderstand the meaning of "Erase Timeout". It just means a timeout value for erase operation.
Quoted 163 lines
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. IfERASE_GROUP_DEF(EXT_CSDbyte
[175]) is enabled,ERASE_TIMEOUT_MULTshould be used to calculate the duration.
Secure Erase timeout is calculated based on the Erase Timeout and additionalSEC_ERASE_MULTfactor (EXT_CSDbyte [230]).Thanks.
2012/3/29 Dong, Chuanxiao <[email protected]>:
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 8:36 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationQuoted 4 lines
Quoted 2 lines
If
ERASE_GROUP_DEFis 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_timeoutimplemented. From the EXT_CSD[230], seems no matterERASE_GROUP_DEFis enabled or not, secure erase timeout is calculated as 300ms *ERASE_TIMEOUT_MULT*SECURE_ERASE_MULT. That is why I submitted this patch.Quoted 2 lines
Does someone else can correct me if my understanding about the erase timeout
calculation is wrong?
Quoted 30 lines
Thanks
ChuanxiaoQuoted 26 lines
Thanks.
2012/3/28 Dong, Chuanxiao <[email protected]>:
Quoted 22 lines
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.pdfThanks
ChuanxiaoQuoted 15 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 5:17 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationHi. 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 <[email protected]>:
Quoted 1 line
According to JEDEC 7.8.2,
mmc_erase_timeoutcalculation should befollow:
Quoted 99 lines
Quoted 99 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
1. Secure erase timeout = 300ms *
ERASE_TIMEOUT_MULT*SEC_ERASE_MULT2. Secure trim timeout = 300ms *ERASE_TIMEOUT_MULT*
SEC_TRIM_MULT3.Quoted 95 lines
Quoted 95 lines
Quoted 95 lines
Trim timeout = 300ms *
TRIM_MULT4. Erase timeout:
a. ifERASE_GROUP_DEFis true: Erase timeout = 300ms *ERASE_TIMEOUT_MULT
b. ifERASE_GROUP_DEFis false: Erase timeout = write block delaySigned-off-by Chuanxiao Dong <[email protected]>---
drivers/mmc/core/core.c | 42
+++++++++++++++++++++++++++++-------------1 files changed, 29 insertions(+), 13 deletions(-)drivers/mmc/core/core.c +0
-2@@ -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 HCtimeouts */
- 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 theTRIM_MULTfactor.
+ * So trim timeout = 300ms *TRIM_MULT
+ *
+ * 3. erase timeout calculation:
+ * a. ifERASE_GROUP_DEFis enabled,
+ERASE_TIMEOUT_MULTshould be
+ * used to calculate erase timeout, so:
+ * erase timeout = 300 *ERASE_TIMEOUT_MULT
+ * b. ifERASE_GROUP_DEFis 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(structmmc_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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Actually, Specfication is described to be misunderstood easily.
Nice day.
2012/3/29 Dong, Chuanxiao <[email protected]>:
Quoted 175 lines
Quoted 10 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Thursday, March 29, 2012 11:30 AM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationI think that write block delay *
SECURE_ERASE_MULTis right in case of secure erase +ERASE_GROUP_DEFdisable.Thanks Namjae, seems I misunderstand the meaning of "Erase Timeout". It just means a timeout value for erase operation.
Quoted 163 lines
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. IfERASE_GROUP_DEF(EXT_CSDbyte
[175]) is enabled,ERASE_TIMEOUT_MULTshould be used to calculate the duration.
Secure Erase timeout is calculated based on the Erase Timeout and additionalSEC_ERASE_MULTfactor (EXT_CSDbyte [230]).Thanks.
2012/3/29 Dong, Chuanxiao <[email protected]>:
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 8:36 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationQuoted 4 lines
Quoted 2 lines
If
ERASE_GROUP_DEFis 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_timeoutimplemented. From the EXT_CSD[230], seems no matterERASE_GROUP_DEFis enabled or not, secure erase timeout is calculated as 300ms *ERASE_TIMEOUT_MULT*SECURE_ERASE_MULT. That is why I submitted this patch.Quoted 2 lines
Does someone else can correct me if my understanding about the erase timeout
calculation is wrong?
Quoted 30 lines
Thanks
ChuanxiaoQuoted 26 lines
Thanks.
2012/3/28 Dong, Chuanxiao <[email protected]>:
Quoted 22 lines
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.pdfThanks
ChuanxiaoQuoted 15 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 5:17 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationHi. 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 <[email protected]>:
Quoted 1 line
According to JEDEC 7.8.2,
mmc_erase_timeoutcalculation should befollow:
Quoted 99 lines
Quoted 99 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
1. Secure erase timeout = 300ms *
ERASE_TIMEOUT_MULT*SEC_ERASE_MULT2. Secure trim timeout = 300ms *ERASE_TIMEOUT_MULT*
SEC_TRIM_MULT3.Quoted 95 lines
Quoted 95 lines
Quoted 95 lines
Trim timeout = 300ms *
TRIM_MULT4. Erase timeout:
a. ifERASE_GROUP_DEFis true: Erase timeout = 300ms *ERASE_TIMEOUT_MULT
b. ifERASE_GROUP_DEFis false: Erase timeout = write block delaySigned-off-by Chuanxiao Dong <[email protected]>---
drivers/mmc/core/core.c | 42
+++++++++++++++++++++++++++++-------------1 files changed, 29 insertions(+), 13 deletions(-)drivers/mmc/core/core.c +0
-2@@ -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 HCtimeouts */
- 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 theTRIM_MULTfactor.
+ * So trim timeout = 300ms *TRIM_MULT
+ *
+ * 3. erase timeout calculation:
+ * a. ifERASE_GROUP_DEFis enabled,
+ERASE_TIMEOUT_MULTshould be
+ * used to calculate erase timeout, so:
+ * erase timeout = 300 *ERASE_TIMEOUT_MULT
+ * b. ifERASE_GROUP_DEFis 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(structmmc_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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Chuanxiao
Quoted 7 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 8:36 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculation
Quoted 5 lines
Quoted 2 lines
If
ERASE_GROUP_DEFis 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_timeoutimplemented. From the EXT_CSD[230], seems no matterERASE_GROUP_DEFis 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
Quoted 127 lines
Does someone else can correct me if my understanding about the erase timeout calculation is wrong?
Thanks
ChuanxiaoQuoted 113 lines
Thanks.
2012/3/28 Dong, Chuanxiao <[email protected]>:
Quoted 4 lines
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.pdfQuoted 20 lines
Thanks
ChuanxiaoQuoted 17 lines
-----Original Message-----
From: Namjae Jeon [mailto:[email protected]]
Sent: Wednesday, March 28, 2012 5:17 PM
To: Dong, Chuanxiao
Cc: [email protected]; [email protected]; Hunter, Adrian
Subject: Re: [Patch v1]mmc:core: correctmmc_erase_timeoutcalculationHi. 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 <[email protected]>:
Quoted 3 lines
According to JEDEC 7.8.2,
mmc_erase_timeoutcalculation should be follow:
1. Secure erase timeout = 300ms *ERASE_TIMEOUT_MULT*SEC_ERASE_MULT2. Secure trim timeout = 300ms *ERASE_TIMEOUT_MULT*
SEC_TRIM_MULT3.Quoted 84 lines
Quoted 84 lines
Quoted 84 lines
Trim timeout = 300ms *
TRIM_MULT4. Erase timeout:
a. ifERASE_GROUP_DEFis true: Erase timeout = 300ms *ERASE_TIMEOUT_MULT
b. ifERASE_GROUP_DEFis false: Erase timeout = write block delaySigned-off-by Chuanxiao Dong <[email protected]>--- drivers/mmc/core/core.c | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-)drivers/mmc/core/core.c +30
-5@@ -1405,12 +1405,36 @@ static unsigned intmmc_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;drivers/mmc/core/core.c +6
-1+ 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 intmmc_mmc_erase_timeout(struct
mmc_card*card,erase_timeout = 1; }drivers/mmc/core/core.c +0
-4-/* Multiplier for secure operations */ -if (arg &MMC_SECURE_ARGS ) { -if (arg ==MMC_SECURE_ERASE_ARG ) - erase_timeout *=
card->ext_csd.sec_erase_mult;drivers/mmc/core/core.c +0
-2-else - erase_timeout *=
card->ext_csd.sec_trim_mult;drivers/mmc/core/core.c +0
-2- } - erase_timeout *= qty;Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
/*--
1.7.1--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html�{.n�+�������+%��lzwm��b�맲��r��zX���r)���w*jg��������ݢj/���z�ޖ��2�ޙ���&�)ߡ�a�����G���h��j:+v���w�٥