aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorSeungwon Jeon <tgih.jun@samsung.com>2011-09-23 01:15:29 -0400
committerChris Ball <cjb@laptop.org>2011-10-26 16:32:21 -0400
commitb23cf0bd55b0c6b703982446f679e00d6d929524 (patch)
tree7701af9bd8b7f35321dfb4a5accf71fc9c04e60d /drivers/mmc
parent66fd8ad5100b5003046aa744a4f12fa31bb831f9 (diff)
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: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/mmc.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 2a4c9a4d3c00..7dde373d1439 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -458,6 +458,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
458 else 458 else
459 card->erased_byte = 0x0; 459 card->erased_byte = 0x0;
460 460
461 if (card->ext_csd.rev >= 6)
462 card->ext_csd.generic_cmd6_time = 10 *
463 ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
464 else
465 card->ext_csd.generic_cmd6_time = 0;
466
461out: 467out:
462 return err; 468 return err;
463} 469}
@@ -801,7 +807,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
801 */ 807 */
802 if (card->ext_csd.enhanced_area_en) { 808 if (card->ext_csd.enhanced_area_en) {
803 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 809 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
804 EXT_CSD_ERASE_GROUP_DEF, 1, 0); 810 EXT_CSD_ERASE_GROUP_DEF, 1,
811 card->ext_csd.generic_cmd6_time);
805 812
806 if (err && err != -EBADMSG) 813 if (err && err != -EBADMSG)
807 goto free_card; 814 goto free_card;
@@ -844,7 +851,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
844 if ((card->ext_csd.hs_max_dtr != 0) && 851 if ((card->ext_csd.hs_max_dtr != 0) &&
845 (host->caps & MMC_CAP_MMC_HIGHSPEED)) { 852 (host->caps & MMC_CAP_MMC_HIGHSPEED)) {
846 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 853 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
847 EXT_CSD_HS_TIMING, 1, 0); 854 EXT_CSD_HS_TIMING, 1,
855 card->ext_csd.generic_cmd6_time);
848 if (err && err != -EBADMSG) 856 if (err && err != -EBADMSG)
849 goto free_card; 857 goto free_card;
850 858
@@ -924,7 +932,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
924 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 932 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
925 EXT_CSD_BUS_WIDTH, 933 EXT_CSD_BUS_WIDTH,
926 ext_csd_bits[idx][0], 934 ext_csd_bits[idx][0],
927 0); 935 card->ext_csd.generic_cmd6_time);
928 if (!err) { 936 if (!err) {
929 mmc_set_bus_width(card->host, bus_width); 937 mmc_set_bus_width(card->host, bus_width);
930 938
@@ -955,7 +963,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
955 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 963 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
956 EXT_CSD_BUS_WIDTH, 964 EXT_CSD_BUS_WIDTH,
957 ext_csd_bits[idx][1], 965 ext_csd_bits[idx][1],
958 0); 966 card->ext_csd.generic_cmd6_time);
959 } 967 }
960 if (err) { 968 if (err) {
961 printk(KERN_WARNING "%s: switch to bus width %d ddr %d " 969 printk(KERN_WARNING "%s: switch to bus width %d ddr %d "