aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorSeungwon Jeon <tgih.jun@samsung.com>2014-04-23 04:07:35 -0400
committerChris Ball <chris@printf.net>2014-05-12 18:05:53 -0400
commitcdc991790c51c693d0c347a5286af017826a5d01 (patch)
tree6a40a17c97298372886e1c41a5b892974743a680 /drivers/mmc/core
parentb78871d0cf13d37e7bdcf39c49782ca3885343bc (diff)
mmc: drop the speed mode of card's state
Timing mode identifier has same role and can take the place of speed mode. This change removes all related speed mode. Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/bus.c8
-rw-r--r--drivers/mmc/core/core.c3
-rw-r--r--drivers/mmc/core/mmc.c11
-rw-r--r--drivers/mmc/core/sd.c16
-rw-r--r--drivers/mmc/core/sd.h1
-rw-r--r--drivers/mmc/core/sdio.c8
6 files changed, 13 insertions, 34 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 824644875d41..f37e9d6af84a 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -341,16 +341,16 @@ int mmc_add_card(struct mmc_card *card)
341 if (mmc_host_is_spi(card->host)) { 341 if (mmc_host_is_spi(card->host)) {
342 pr_info("%s: new %s%s%s card on SPI\n", 342 pr_info("%s: new %s%s%s card on SPI\n",
343 mmc_hostname(card->host), 343 mmc_hostname(card->host),
344 mmc_card_highspeed(card) ? "high speed " : "", 344 mmc_card_hs(card) ? "high speed " : "",
345 mmc_card_ddr_mode(card) ? "DDR " : "", 345 mmc_card_ddr52(card) ? "DDR " : "",
346 type); 346 type);
347 } else { 347 } else {
348 pr_info("%s: new %s%s%s%s%s card at address %04x\n", 348 pr_info("%s: new %s%s%s%s%s card at address %04x\n",
349 mmc_hostname(card->host), 349 mmc_hostname(card->host),
350 mmc_card_uhs(card) ? "ultra high speed " : 350 mmc_card_uhs(card) ? "ultra high speed " :
351 (mmc_card_highspeed(card) ? "high speed " : ""), 351 (mmc_card_hs(card) ? "high speed " : ""),
352 (mmc_card_hs200(card) ? "HS200 " : ""), 352 (mmc_card_hs200(card) ? "HS200 " : ""),
353 mmc_card_ddr_mode(card) ? "DDR " : "", 353 mmc_card_ddr52(card) ? "DDR " : "",
354 uhs_bus_speed_mode, type, card->rca); 354 uhs_bus_speed_mode, type, card->rca);
355 } 355 }
356 356
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index d97dff5fab62..02baa30653fa 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2192,7 +2192,7 @@ int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
2192{ 2192{
2193 struct mmc_command cmd = {0}; 2193 struct mmc_command cmd = {0};
2194 2194
2195 if (mmc_card_blockaddr(card) || mmc_card_ddr_mode(card)) 2195 if (mmc_card_blockaddr(card) || mmc_card_ddr52(card))
2196 return 0; 2196 return 0;
2197 2197
2198 cmd.opcode = MMC_SET_BLOCKLEN; 2198 cmd.opcode = MMC_SET_BLOCKLEN;
@@ -2272,7 +2272,6 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
2272 } 2272 }
2273 } 2273 }
2274 2274
2275 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_DDR);
2276 if (mmc_host_is_spi(host)) { 2275 if (mmc_host_is_spi(host)) {
2277 host->ios.chip_select = MMC_CS_HIGH; 2276 host->ios.chip_select = MMC_CS_HIGH;
2278 host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; 2277 host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index fbcf93d81858..31220529e171 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1083,11 +1083,9 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1083 } else { 1083 } else {
1084 if (card->ext_csd.hs_max_dtr > 52000000 && 1084 if (card->ext_csd.hs_max_dtr > 52000000 &&
1085 host->caps2 & MMC_CAP2_HS200) { 1085 host->caps2 & MMC_CAP2_HS200) {
1086 mmc_card_set_hs200(card);
1087 mmc_set_timing(card->host, 1086 mmc_set_timing(card->host,
1088 MMC_TIMING_MMC_HS200); 1087 MMC_TIMING_MMC_HS200);
1089 } else { 1088 } else {
1090 mmc_card_set_highspeed(card);
1091 mmc_set_timing(card->host, MMC_TIMING_MMC_HS); 1089 mmc_set_timing(card->host, MMC_TIMING_MMC_HS);
1092 } 1090 }
1093 } 1091 }
@@ -1098,10 +1096,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1098 */ 1096 */
1099 max_dtr = (unsigned int)-1; 1097 max_dtr = (unsigned int)-1;
1100 1098
1101 if (mmc_card_highspeed(card) || mmc_card_hs200(card)) { 1099 if (mmc_card_hs(card) || mmc_card_hs200(card)) {
1102 if (max_dtr > card->ext_csd.hs_max_dtr) 1100 if (max_dtr > card->ext_csd.hs_max_dtr)
1103 max_dtr = card->ext_csd.hs_max_dtr; 1101 max_dtr = card->ext_csd.hs_max_dtr;
1104 if (mmc_card_highspeed(card) && (max_dtr > 52000000)) 1102 if (mmc_card_hs(card) && (max_dtr > 52000000))
1105 max_dtr = 52000000; 1103 max_dtr = 52000000;
1106 } else if (max_dtr > card->csd.max_dtr) { 1104 } else if (max_dtr > card->csd.max_dtr) {
1107 max_dtr = card->csd.max_dtr; 1105 max_dtr = card->csd.max_dtr;
@@ -1112,7 +1110,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1112 /* 1110 /*
1113 * Indicate DDR mode (if supported). 1111 * Indicate DDR mode (if supported).
1114 */ 1112 */
1115 if (mmc_card_highspeed(card)) { 1113 if (mmc_card_hs(card)) {
1116 if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V) 1114 if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V)
1117 && (host->caps & MMC_CAP_1_8V_DDR)) 1115 && (host->caps & MMC_CAP_1_8V_DDR))
1118 ddr = MMC_1_8V_DDR_MODE; 1116 ddr = MMC_1_8V_DDR_MODE;
@@ -1255,7 +1253,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1255 if (err) 1253 if (err)
1256 goto err; 1254 goto err;
1257 } 1255 }
1258 mmc_card_set_ddr_mode(card);
1259 mmc_set_timing(card->host, MMC_TIMING_MMC_DDR52); 1256 mmc_set_timing(card->host, MMC_TIMING_MMC_DDR52);
1260 mmc_set_bus_width(card->host, bus_width); 1257 mmc_set_bus_width(card->host, bus_width);
1261 } 1258 }
@@ -1499,7 +1496,6 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
1499 err = mmc_sleep(host); 1496 err = mmc_sleep(host);
1500 else if (!mmc_host_is_spi(host)) 1497 else if (!mmc_host_is_spi(host))
1501 err = mmc_deselect_cards(host); 1498 err = mmc_deselect_cards(host);
1502 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
1503 1499
1504 if (!err) { 1500 if (!err) {
1505 mmc_power_off(host); 1501 mmc_power_off(host);
@@ -1629,7 +1625,6 @@ static int mmc_power_restore(struct mmc_host *host)
1629{ 1625{
1630 int ret; 1626 int ret;
1631 1627
1632 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
1633 mmc_claim_host(host); 1628 mmc_claim_host(host);
1634 ret = mmc_init_card(host, host->card->ocr, host->card); 1629 ret = mmc_init_card(host, host->card->ocr, host->card);
1635 mmc_release_host(host); 1630 mmc_release_host(host);
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index aef515755e5b..0c44510bf717 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -887,7 +887,7 @@ unsigned mmc_sd_get_max_clock(struct mmc_card *card)
887{ 887{
888 unsigned max_dtr = (unsigned int)-1; 888 unsigned max_dtr = (unsigned int)-1;
889 889
890 if (mmc_card_highspeed(card)) { 890 if (mmc_card_hs(card)) {
891 if (max_dtr > card->sw_caps.hs_max_dtr) 891 if (max_dtr > card->sw_caps.hs_max_dtr)
892 max_dtr = card->sw_caps.hs_max_dtr; 892 max_dtr = card->sw_caps.hs_max_dtr;
893 } else if (max_dtr > card->csd.max_dtr) { 893 } else if (max_dtr > card->csd.max_dtr) {
@@ -897,12 +897,6 @@ unsigned mmc_sd_get_max_clock(struct mmc_card *card)
897 return max_dtr; 897 return max_dtr;
898} 898}
899 899
900void mmc_sd_go_highspeed(struct mmc_card *card)
901{
902 mmc_card_set_highspeed(card);
903 mmc_set_timing(card->host, MMC_TIMING_SD_HS);
904}
905
906/* 900/*
907 * Handle the detection and initialisation of a card. 901 * Handle the detection and initialisation of a card.
908 * 902 *
@@ -977,16 +971,13 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
977 err = mmc_sd_init_uhs_card(card); 971 err = mmc_sd_init_uhs_card(card);
978 if (err) 972 if (err)
979 goto free_card; 973 goto free_card;
980
981 /* Card is an ultra-high-speed card */
982 mmc_card_set_uhs(card);
983 } else { 974 } else {
984 /* 975 /*
985 * Attempt to change to high-speed (if supported) 976 * Attempt to change to high-speed (if supported)
986 */ 977 */
987 err = mmc_sd_switch_hs(card); 978 err = mmc_sd_switch_hs(card);
988 if (err > 0) 979 if (err > 0)
989 mmc_sd_go_highspeed(card); 980 mmc_set_timing(card->host, MMC_TIMING_SD_HS);
990 else if (err) 981 else if (err)
991 goto free_card; 982 goto free_card;
992 983
@@ -1081,7 +1072,7 @@ static int _mmc_sd_suspend(struct mmc_host *host)
1081 1072
1082 if (!mmc_host_is_spi(host)) 1073 if (!mmc_host_is_spi(host))
1083 err = mmc_deselect_cards(host); 1074 err = mmc_deselect_cards(host);
1084 host->card->state &= ~MMC_STATE_HIGHSPEED; 1075
1085 if (!err) { 1076 if (!err) {
1086 mmc_power_off(host); 1077 mmc_power_off(host);
1087 mmc_card_set_suspended(host->card); 1078 mmc_card_set_suspended(host->card);
@@ -1190,7 +1181,6 @@ static int mmc_sd_power_restore(struct mmc_host *host)
1190{ 1181{
1191 int ret; 1182 int ret;
1192 1183
1193 host->card->state &= ~MMC_STATE_HIGHSPEED;
1194 mmc_claim_host(host); 1184 mmc_claim_host(host);
1195 ret = mmc_sd_init_card(host, host->card->ocr, host->card); 1185 ret = mmc_sd_init_card(host, host->card->ocr, host->card);
1196 mmc_release_host(host); 1186 mmc_release_host(host);
diff --git a/drivers/mmc/core/sd.h b/drivers/mmc/core/sd.h
index 4b34b24f3f76..aab824a9a7f3 100644
--- a/drivers/mmc/core/sd.h
+++ b/drivers/mmc/core/sd.h
@@ -12,6 +12,5 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
12 bool reinit); 12 bool reinit);
13unsigned mmc_sd_get_max_clock(struct mmc_card *card); 13unsigned mmc_sd_get_max_clock(struct mmc_card *card);
14int mmc_sd_switch_hs(struct mmc_card *card); 14int mmc_sd_switch_hs(struct mmc_card *card);
15void mmc_sd_go_highspeed(struct mmc_card *card);
16 15
17#endif 16#endif
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 9933e426bc36..e636d9e99e4a 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -363,7 +363,7 @@ static unsigned mmc_sdio_get_max_clock(struct mmc_card *card)
363{ 363{
364 unsigned max_dtr; 364 unsigned max_dtr;
365 365
366 if (mmc_card_highspeed(card)) { 366 if (mmc_card_hs(card)) {
367 /* 367 /*
368 * The SDIO specification doesn't mention how 368 * The SDIO specification doesn't mention how
369 * the CIS transfer speed register relates to 369 * the CIS transfer speed register relates to
@@ -733,7 +733,6 @@ try_again:
733 mmc_set_clock(host, card->cis.max_dtr); 733 mmc_set_clock(host, card->cis.max_dtr);
734 734
735 if (card->cccr.high_speed) { 735 if (card->cccr.high_speed) {
736 mmc_card_set_highspeed(card);
737 mmc_set_timing(card->host, MMC_TIMING_SD_HS); 736 mmc_set_timing(card->host, MMC_TIMING_SD_HS);
738 } 737 }
739 738
@@ -792,16 +791,13 @@ try_again:
792 err = mmc_sdio_init_uhs_card(card); 791 err = mmc_sdio_init_uhs_card(card);
793 if (err) 792 if (err)
794 goto remove; 793 goto remove;
795
796 /* Card is an ultra-high-speed card */
797 mmc_card_set_uhs(card);
798 } else { 794 } else {
799 /* 795 /*
800 * Switch to high-speed (if supported). 796 * Switch to high-speed (if supported).
801 */ 797 */
802 err = sdio_enable_hs(card); 798 err = sdio_enable_hs(card);
803 if (err > 0) 799 if (err > 0)
804 mmc_sd_go_highspeed(card); 800 mmc_set_timing(card->host, MMC_TIMING_SD_HS);
805 else if (err) 801 else if (err)
806 goto remove; 802 goto remove;
807 803