mmc: core: Add default timeout value for CMD6.
Subsystems (2)
PATCH v2 1/1 mmc: core: Add default timeout value for CMD6.
EXT_CSD[248] includes the default maximum timeout for CMD6. This field is added at eMMC4.5 Spec. And it can be used for default timeout except for some operations which don't define the timeout(i.e. background operation, sanitize, flush cache) in eMMC4.5 Spec.
---
v2 : apply default maximum timeout of CMD6 which specific timeout is not defined.
drivers/mmc/core/mmc.c | 14 ++++++++++---- include/linux/mmc/card.h | 1 + include/linux/mmc/mmc.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/mmc/core/mmc.c +10 -4
@@ -410,6 +410,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)else card->erased_byte =0x0 ; +if (card->ext_csd.rev >=6 ) + card->ext_csd.generic_cmd6_time =10 * + ext_csd[EXT_CSD_GENERIC_CMD6_TIME ]; + out:return err; }
@@ -668,7 +672,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,*/ if (card->ext_csd.enhanced_area_en) { err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL , -EXT_CSD_ERASE_GROUP_DEF ,1 ,0 ); +EXT_CSD_ERASE_GROUP_DEF ,1 , + card->ext_csd.generic_cmd6_time);if (err && err != -EBADMSG ) goto free_card;
@@ -711,7 +716,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,if ((card->ext_csd.hs_max_dtr !=0 ) && (host->caps &MMC_CAP_MMC_HIGHSPEED )) { err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL , -EXT_CSD_HS_TIMING ,1 ,0 ); +EXT_CSD_HS_TIMING ,1 , + card->ext_csd.generic_cmd6_time);if (err && err != -EBADMSG ) goto free_card;
@@ -783,7 +789,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL ,EXT_CSD_BUS_WIDTH , ext_csd_bits[idx][0 ], -0 ); + card->ext_csd.generic_cmd6_time);if (!err) {mmc_set_bus_width (card->host, bus_width);
@@ -806,7 +812,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL ,EXT_CSD_BUS_WIDTH , ext_csd_bits[idx][1 ], -0 ); + card->ext_csd.generic_cmd6_time); }if (err) { printk(KERN_WARNING "%s: switch to bus width %d ddr %d "
include/linux/mmc/card.h +1 -0
@@ -52,6 +52,7 @@ struct mmc_ext_csd {u8 part_config;unsigned int part_time;/* Units: ms */ unsigned int sa_timeout;/* Units: 100ns */ +unsigned int generic_cmd6_time;/* Units: ms */ unsigned int hs_max_dtr;unsigned int sectors;unsigned int card_type;
include/linux/mmc/mmc.h +1 -0
@@ -293,6 +293,7 @@ struct _mmc_csd {#define EXT_CSD_SEC_ERASE_MULT 230/* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231/* RO */ #define EXT_CSD_TRIM_MULT 232/* RO */ +#define EXT_CSD_GENERIC_CMD6_TIME 248/* RO */ /* * EXT_CSD field definitions
--
1.7.0.4
Nitpick: see below comments and typo.
Quoted 22 lines · Seungwon Jeon
EXT_CSD[248] includes the default maximum timeout for CMD6. This field is added at eMMC4.5 Spec. And it can be used for default timeout except for some operations which don't define the timeout(i.e. background operation, sanitize, flush cache) in eMMC4.5 Spec.
Signed-off-by Seungwon Jeon <[email protected]>---
v2 : apply default maximum timeout of CMD6 which specific timeout is not defined.drivers/mmc/core/mmc.c | 14 ++++++++++----
include/linux/mmc/card.h | 1 +
include/linux/mmc/mmc.h | 1 +3 files changed, 12 insertions(+), 4 deletions(-)drivers/mmc/core/mmc.c +0
-0@@ -410,6 +410,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)else
card->erased_byte =0x0;
Quoted 3 lines
+ if (
card->ext_csd.rev>= 6)
+card->ext_csd.generic_cmd6_time= 10 *
+ ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
Even though generic_cmd6_time is cleared at card initialization. Make sure set the 0 when not eMMC v4.5 to make consistent with previous version and codes.
else
card->ext_csd.generic_cmd6_time = 0;Quoted 48 lines
+
out:
return err;
}drivers/mmc/core/mmc.c +2
-1@@ -668,7 +672,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,*/ if (card->ext_csd.enhanced_area_en) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_ERASE_GROUP_DEF, 1, 0); + EXT_CSD_ERASE_GROUP_DEF, 1, + card->ext_csd.generic_cmd6_time); if (err && err != -EBADMSG) goto free_card;@@ -711,7 +716,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,if ((
card->ext_csd.hs_max_dtr!= 0) && (host->caps&MMC_CAP_MMC_HIGHSPEED)) { err = mmc_switch(card,EXT_CSD_CMD_SET_NORMAL,
- EXT_CSD_HS_TIMING, 1, 0);
+ EXT_CSD_HS_TIMING, 1,
+ card->ext_csd.generic_cmd6_time); if (err && err !=-EBADMSG)
gotofree_card;drivers/mmc/core/mmc.c +2
-2@@ -783,7 +789,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx][0], - 0); + card->ext_csd.generic_cmd6_time); if (!err) { mmc_set_bus_width(card->host, bus_width);@@ -806,7 +812,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx][1], - 0); + card->ext_csd.generic_cmd6_time); } if (err) {printk(KERN_WARNING "%s: switch to bus width %d ddr %d "
include/linux/mmc/card.h +0
-0@@ -52,6 +52,7 @@ struct mmc_ext_csd { u8 part_config;
Quoted 3 lines
unsigned int part_time; /* Units: ms */ unsigned int sa_timeout; /* Units: 100ns */
+ unsigned int generic_cmd6_time; /* Units: ms */
The correct unit is 10ms
Quoted 23 lines
unsigned int hs_max_dtr;
unsigned int sectors;
unsigned int card_type;include/linux/mmc/mmc.h +1
-1@@ -293,6 +293,7 @@ struct _mmc_csd { #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_TRIM_MULT 232 /* RO */ +#define EXT_CSD_GENERIC_CMD6_TIME 248/* RO */ /** EXT_CSD field definitions -- 1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thank you for comment.
I will apply it.
Best regards,
Seungwon Jeon.
Quoted 30 lines · Kyungmin Park
Acked-by Kyungmin Park <[email protected]>Nitpick: see below comments and typo.
Quoted 8 lines · Seungwon Jeon
EXT_CSD[248] includes the default maximum timeout for CMD6. This field is added at eMMC4.5 Spec. And it can be used for default timeout except for some operations which don't define the timeout(i.e. background operation, sanitize, flush cache) in eMMC4.5 Spec.
Signed-off-by Seungwon Jeon <[email protected]>---
v2 : apply default maximum timeout of CMD6 which specific timeout is notdefined.
drivers/mmc/core/mmc.c static int mmc_read_ext_csd(struct mmc_card *card,
Quoted 11 lines
drivers/mmc/core/mmc.c | 14 ++++++++++---- include/linux/mmc/card.h | 1 + include/linux/mmc/mmc.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-)drivers/mmc/core/mmc.c +0
-0@@ -410,6 +410,10 @@ static int mmc_read_ext_csd(struct mmc_card *card,u8
*ext_csd)Quoted 3 lines
drivers/mmc/core/mmc.c +0
-0else card->erased_byte =0x0 ;
Quoted 8 lines
drivers/mmc/core/mmc.c static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) · line 415
Quoted 3 lines
drivers/mmc/core/mmc.c +3
-0+if (card->ext_csd.rev >=6 ) + card->ext_csd.generic_cmd6_time =10 * + ext_csd[EXT_CSD_GENERIC_CMD6_TIME ];Even though
generic_cmd6_timeis cleared at card initialization. Make sure set the 0 when not eMMC v4.5 to make consistent with previous version and codes.else card->ext_csd.generic_cmd6_time = 0;
Yes, it would be better.
Quoted 86 lines
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32
Quoted 5 lines
drivers/mmc/core/mmc.c +1
-0+ out:return err; }@@ -668,7 +672,8 @@ static int mmc_init_card(struct mmc_host *host, u32ocr,
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32
Quoted 10 lines
drivers/mmc/core/mmc.c +2
-1*/ if (card->ext_csd.enhanced_area_en) { err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL , -EXT_CSD_ERASE_GROUP_DEF ,1 ,0 ); +EXT_CSD_ERASE_GROUP_DEF ,1 , + card->ext_csd.generic_cmd6_time);if (err && err != -EBADMSG ) goto free_card;@@ -711,7 +716,8 @@ static int mmc_init_card(struct mmc_host *host, u32ocr,
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32
Quoted 10 lines
drivers/mmc/core/mmc.c +2
-1if ((card->ext_csd.hs_max_dtr !=0 ) && (host->caps &MMC_CAP_MMC_HIGHSPEED )) { err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL , -EXT_CSD_HS_TIMING ,1 ,0 ); +EXT_CSD_HS_TIMING ,1 , + card->ext_csd.generic_cmd6_time);if (err && err != -EBADMSG ) goto free_card;@@ -783,7 +789,7 @@ static int mmc_init_card(struct mmc_host *host, u32ocr,
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32
Quoted 9 lines
drivers/mmc/core/mmc.c +1
-1err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL ,EXT_CSD_BUS_WIDTH , ext_csd_bits[idx][0 ], -0 ); + card->ext_csd.generic_cmd6_time);if (!err) {mmc_set_bus_width (card->host, bus_width);@@ -806,7 +812,7 @@ static int mmc_init_card(struct mmc_host *host, u32ocr,
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32 ocr,
Quoted 8 lines
drivers/mmc/core/mmc.c +1
-1err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL ,EXT_CSD_BUS_WIDTH , ext_csd_bits[idx][1 ], -0 ); + card->ext_csd.generic_cmd6_time); } if (err) { printk(KERN_WARNING "%s: switch to bus width %dddr %d "
include/linux/mmc/card.h struct mmc_ext_csd { · line 55
Quoted 9 lines
include/linux/mmc/card.h +1
-0@@ -52,6 +52,7 @@ struct mmc_ext_csd {u8 part_config;unsigned int part_time;/* Units: ms */ unsigned int sa_timeout;/* Units: 100ns */ +unsigned int generic_cmd6_time;/* Units: ms */ The correct unit is 10ms
Quoted 18 lines
include/linux/mmc/card.h +0
-0unsigned int hs_max_dtr;unsigned int sectors;unsigned int card_type;include/linux/mmc/mmc.h +1
-1@@ -293,6 +293,7 @@ struct _mmc_csd {#define EXT_CSD_SEC_ERASE_MULT 230/* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231/* RO */ #define EXT_CSD_TRIM_MULT 232/* RO */ +#define EXT_CSD_GENERIC_CMD6_TIME 248/* RO */ /* * EXT_CSD field definitions -- 1.7.0.4
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
Quoted 3 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Jeon,
I tried to apply your patch to the latest Chris-mmc/mmc-next branch. but the patch fails. can you please check
err message.
error: patch failed: include/linux/mmc/card.h:52
error: include/linux/mmc/card.h: patch does not apply
error: patch failed: include/linux/mmc/mmc.h:293
error: include/linux/mmc/mmc.h: patch does not apply Patch failed at 0001 mmc: core: Add default timeout value for CMD6.
regards
Girish K S
Quoted 99 lines
EXT_CSD[248] includes the default maximum timeout for CMD6. This field is added at eMMC4.5 Spec. And it can be used for default timeout except for some operations which don't define the timeout(i.e. background operation, sanitize, flush cache) in eMMC4.5 Spec.
Signed-off-by Seungwon Jeon <[email protected]>---
v2 : apply default maximum timeout of CMD6 which specific timeout is not defined.drivers/mmc/core/mmc.c | 14 ++++++++++----
include/linux/mmc/card.h | 1 +
include/linux/mmc/mmc.h | 1 +3 files changed, 12 insertions(+), 4 deletions(-)drivers/mmc/core/mmc.c +0
-0@@ -410,6 +410,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)else
card->erased_byte =0x0;+ if (
card->ext_csd.rev>= 6)
+card->ext_csd.generic_cmd6_time= 10 *
+ ext_csd[EXT_CSD_GENERIC_CMD6_TIME]; +
out:
return err;
}drivers/mmc/core/mmc.c +2
-1@@ -668,7 +672,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,*/ if (card->ext_csd.enhanced_area_en) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_ERASE_GROUP_DEF, 1, 0); + EXT_CSD_ERASE_GROUP_DEF, 1, + card->ext_csd.generic_cmd6_time); if (err && err != -EBADMSG) goto free_card;@@ -711,7 +716,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,if ((
card->ext_csd.hs_max_dtr!= 0) && (host->caps&MMC_CAP_MMC_HIGHSPEED)) { err = mmc_switch(card,EXT_CSD_CMD_SET_NORMAL,
- EXT_CSD_HS_TIMING, 1, 0);
+ EXT_CSD_HS_TIMING, 1,
+ card->ext_csd.generic_cmd6_time); if (err && err !=-EBADMSG)
gotofree_card;drivers/mmc/core/mmc.c +2
-2@@ -783,7 +789,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx][0], - 0); + card->ext_csd.generic_cmd6_time); if (!err) { mmc_set_bus_width(card->host, bus_width);@@ -806,7 +812,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx][1], - 0); + card->ext_csd.generic_cmd6_time); } if (err) {printk(KERN_WARNING "%s: switch to bus width %d ddr %d "
include/linux/mmc/card.h +0
-0@@ -52,6 +52,7 @@ struct mmc_ext_csd { u8 part_config;unsigned int part_time; /* Units: ms */ unsigned int sa_timeout; /* Units: 100ns */
+ unsigned int generic_cmd6_time; /* Units: ms */ unsigned int hs_max_dtr;
unsigned int sectors;
unsigned int card_type;include/linux/mmc/mmc.h +1
-1@@ -293,6 +293,7 @@ struct _mmc_csd { #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_TRIM_MULT 232 /* RO */ +#define EXT_CSD_GENERIC_CMD6_TIME 248/* RO */ /** EXT_CSD field definitions -- 1.7.0.4
--
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 · Girish K S
Hi Jeon,
I tried to apply your patch to the latest Chris-mmc/mmc-next branch. but the patch fails. can you please check
err message.
Quoted 5 lines
error: patch failed:
include/linux/mmc/card.h:52
error:include/linux/mmc/card.h: patch does not apply
error: patch failed:include/linux/mmc/mmc.h:293
error:include/linux/mmc/mmc.h: patch does not apply Patch failed at 0001 mmc: core: Add default timeout value for CMD6.
Thank you for informing me.
But V4 is latest patch.
Anyway, since I has submitted this patch, several patches were updated. So base branch is changed. Could I update this patch?
Best regards,
Seungwon Jeon.
Quoted 109 lines
regards
Girish K SQuoted 8 lines
EXT_CSD[248] includes the default maximum timeout for CMD6. This field is added at eMMC4.5 Spec. And it can be used for default timeout except for some operations which don't define the timeout(i.e. background operation, sanitize, flush cache) in eMMC4.5 Spec.
Signed-off-by Seungwon Jeon <[email protected]>---
v2 : apply default maximum timeout of CMD6 which specific timeout is notdefined.
drivers/mmc/core/mmc.c static int mmc_read_ext_csd(struct mmc_card *card,
Quoted 11 lines
drivers/mmc/core/mmc.c | 14 ++++++++++---- include/linux/mmc/card.h | 1 + include/linux/mmc/mmc.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-)drivers/mmc/core/mmc.c +0
-0@@ -410,6 +410,10 @@ static int mmc_read_ext_csd(struct mmc_card *card,u8
*ext_csd)drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32
Quoted 11 lines
drivers/mmc/core/mmc.c +4
-0else card->erased_byte =0x0 ; +if (card->ext_csd.rev >=6 ) + card->ext_csd.generic_cmd6_time =10 * + ext_csd[EXT_CSD_GENERIC_CMD6_TIME ]; + out:return err; }@@ -668,7 +672,8 @@ static int mmc_init_card(struct mmc_host *host, u32ocr,
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32
Quoted 10 lines
drivers/mmc/core/mmc.c +2
-1*/ if (card->ext_csd.enhanced_area_en) { err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL , -EXT_CSD_ERASE_GROUP_DEF ,1 ,0 ); +EXT_CSD_ERASE_GROUP_DEF ,1 , + card->ext_csd.generic_cmd6_time);if (err && err != -EBADMSG ) goto free_card;@@ -711,7 +716,8 @@ static int mmc_init_card(struct mmc_host *host, u32ocr,
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32
Quoted 10 lines
drivers/mmc/core/mmc.c +2
-1if ((card->ext_csd.hs_max_dtr !=0 ) && (host->caps &MMC_CAP_MMC_HIGHSPEED )) { err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL , -EXT_CSD_HS_TIMING ,1 ,0 ); +EXT_CSD_HS_TIMING ,1 , + card->ext_csd.generic_cmd6_time);if (err && err != -EBADMSG ) goto free_card;@@ -783,7 +789,7 @@ static int mmc_init_card(struct mmc_host *host, u32ocr,
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32
Quoted 9 lines
drivers/mmc/core/mmc.c +1
-1err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL ,EXT_CSD_BUS_WIDTH , ext_csd_bits[idx][0 ], -0 ); + card->ext_csd.generic_cmd6_time);if (!err) {mmc_set_bus_width (card->host, bus_width);@@ -806,7 +812,7 @@ static int mmc_init_card(struct mmc_host *host, u32ocr,
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32 ocr,
Quoted 8 lines
drivers/mmc/core/mmc.c +1
-1err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL ,EXT_CSD_BUS_WIDTH , ext_csd_bits[idx][1 ], -0 ); + card->ext_csd.generic_cmd6_time); } if (err) { printk(KERN_WARNING "%s: switch to bus width %dddr %d "
Quoted 32 lines
include/linux/mmc/card.h +1
-0@@ -52,6 +52,7 @@ struct mmc_ext_csd {u8 part_config;unsigned int part_time;/* Units: ms */ unsigned int sa_timeout;/* Units: 100ns */ +unsigned int generic_cmd6_time;/* Units: ms */ unsigned int hs_max_dtr;unsigned int sectors;unsigned int card_type;include/linux/mmc/mmc.h +1
-1@@ -293,6 +293,7 @@ struct _mmc_csd {#define EXT_CSD_SEC_ERASE_MULT 230/* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231/* RO */ #define EXT_CSD_TRIM_MULT 232/* RO */ +#define EXT_CSD_GENERIC_CMD6_TIME 248/* RO */ /* * EXT_CSD field definitions -- 1.7.0.4
--
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