aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSubhash Jadavani <subhashj@codeaurora.org>2012-03-06 07:29:12 -0500
committerChris Ball <cjb@laptop.org>2012-03-27 12:20:05 -0400
commit52d0974e36761fd1daf1eb02cfb2444a7b200087 (patch)
tree6cfa1bee02321bcbf61ee0ae20652c3ee3ed4629 /drivers
parent37f6190d54f4d90b886784fadbb9cf82d5c8b1ef (diff)
mmc: core: hs200 fixes
This patch fixes following issues when HS200 is enabled: 1. If executing_tuning() host ops is called without mmc_host_clk_hold(), card clocks might get turned off (if MMC_CLK_GATING is enabled) while execute_tuning() is in progress. So this patch makes sure that execute_tuning() is called with mmc_host_clk_hold(). 2. If host timing mode is set to HS200 mode, there should not be any communication with the card until execute_tuning() is completed. But there is a chance that CMD6 might be sent to enable set HPI_EN (of HPI_MGMT field in EXT_CSD) before execute_tuning() is called. So this patch moves this operation after execute_tuning() is completed. Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Reviewed-by: girish.shivananjappa@linaro.org Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/core/mmc.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 6defddd795f6..d7d8a93c3503 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1047,22 +1047,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1047 } 1047 }
1048 1048
1049 /* 1049 /*
1050 * Enable HPI feature (if supported)
1051 */
1052 if (card->ext_csd.hpi) {
1053 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1054 EXT_CSD_HPI_MGMT, 1, 0);
1055 if (err && err != -EBADMSG)
1056 goto free_card;
1057 if (err) {
1058 pr_warning("%s: Enabling HPI failed\n",
1059 mmc_hostname(card->host));
1060 err = 0;
1061 } else
1062 card->ext_csd.hpi_en = 1;
1063 }
1064
1065 /*
1066 * Compute bus speed. 1050 * Compute bus speed.
1067 */ 1051 */
1068 max_dtr = (unsigned int)-1; 1052 max_dtr = (unsigned int)-1;
@@ -1111,9 +1095,12 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1111 * 4. execute tuning for HS200 1095 * 4. execute tuning for HS200
1112 */ 1096 */
1113 if ((host->caps2 & MMC_CAP2_HS200) && 1097 if ((host->caps2 & MMC_CAP2_HS200) &&
1114 card->host->ops->execute_tuning) 1098 card->host->ops->execute_tuning) {
1099 mmc_host_clk_hold(card->host);
1115 err = card->host->ops->execute_tuning(card->host, 1100 err = card->host->ops->execute_tuning(card->host,
1116 MMC_SEND_TUNING_BLOCK_HS200); 1101 MMC_SEND_TUNING_BLOCK_HS200);
1102 mmc_host_clk_release(card->host);
1103 }
1117 if (err) { 1104 if (err) {
1118 pr_warning("%s: tuning execution failed\n", 1105 pr_warning("%s: tuning execution failed\n",
1119 mmc_hostname(card->host)); 1106 mmc_hostname(card->host));
@@ -1233,6 +1220,23 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1233 } 1220 }
1234 1221
1235 /* 1222 /*
1223 * Enable HPI feature (if supported)
1224 */
1225 if (card->ext_csd.hpi) {
1226 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1227 EXT_CSD_HPI_MGMT, 1,
1228 card->ext_csd.generic_cmd6_time);
1229 if (err && err != -EBADMSG)
1230 goto free_card;
1231 if (err) {
1232 pr_warning("%s: Enabling HPI failed\n",
1233 mmc_hostname(card->host));
1234 err = 0;
1235 } else
1236 card->ext_csd.hpi_en = 1;
1237 }
1238
1239 /*
1236 * If cache size is higher than 0, this indicates 1240 * If cache size is higher than 0, this indicates
1237 * the existence of cache and it can be turned on. 1241 * the existence of cache and it can be turned on.
1238 */ 1242 */