Commit b23cf0bd authored by Seungwon Jeon's avatar Seungwon Jeon Committed by Chris Ball

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.
Signed-off-by: default avatarSeungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 66fd8ad5
...@@ -458,6 +458,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) ...@@ -458,6 +458,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
else else
card->erased_byte = 0x0; card->erased_byte = 0x0;
if (card->ext_csd.rev >= 6)
card->ext_csd.generic_cmd6_time = 10 *
ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
else
card->ext_csd.generic_cmd6_time = 0;
out: out:
return err; return err;
} }
...@@ -801,7 +807,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, ...@@ -801,7 +807,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
*/ */
if (card->ext_csd.enhanced_area_en) { if (card->ext_csd.enhanced_area_en) {
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 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) if (err && err != -EBADMSG)
goto free_card; goto free_card;
...@@ -844,7 +851,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, ...@@ -844,7 +851,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
if ((card->ext_csd.hs_max_dtr != 0) && if ((card->ext_csd.hs_max_dtr != 0) &&
(host->caps & MMC_CAP_MMC_HIGHSPEED)) { (host->caps & MMC_CAP_MMC_HIGHSPEED)) {
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 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) if (err && err != -EBADMSG)
goto free_card; goto free_card;
...@@ -924,7 +932,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, ...@@ -924,7 +932,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH,
ext_csd_bits[idx][0], ext_csd_bits[idx][0],
0); card->ext_csd.generic_cmd6_time);
if (!err) { if (!err) {
mmc_set_bus_width(card->host, bus_width); mmc_set_bus_width(card->host, bus_width);
...@@ -955,7 +963,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, ...@@ -955,7 +963,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH,
ext_csd_bits[idx][1], ext_csd_bits[idx][1],
0); card->ext_csd.generic_cmd6_time);
} }
if (err) { if (err) {
printk(KERN_WARNING "%s: switch to bus width %d ddr %d " printk(KERN_WARNING "%s: switch to bus width %d ddr %d "
......
...@@ -54,6 +54,7 @@ struct mmc_ext_csd { ...@@ -54,6 +54,7 @@ struct mmc_ext_csd {
u8 rst_n_function; u8 rst_n_function;
unsigned int part_time; /* Units: ms */ unsigned int part_time; /* Units: ms */
unsigned int sa_timeout; /* Units: 100ns */ unsigned int sa_timeout; /* Units: 100ns */
unsigned int generic_cmd6_time; /* Units: 10ms */
unsigned int hs_max_dtr; unsigned int hs_max_dtr;
unsigned int sectors; unsigned int sectors;
unsigned int card_type; unsigned int card_type;
......
...@@ -305,6 +305,7 @@ struct _mmc_csd { ...@@ -305,6 +305,7 @@ struct _mmc_csd {
#define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */ #define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */
#define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */ #define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */
#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ #define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */
#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
/* /*
* EXT_CSD field definitions * EXT_CSD field definitions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment