aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r--drivers/mmc/host/sdhci.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 409cde5970ae..8994493dd940 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1244,7 +1244,16 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1244 ctrl &= ~SDHCI_CTRL_HISPD; 1244 ctrl &= ~SDHCI_CTRL_HISPD;
1245 1245
1246 if (host->version >= SDHCI_SPEC_300) { 1246 if (host->version >= SDHCI_SPEC_300) {
1247 u16 ctrl_2; 1247 u16 clk, ctrl_2;
1248 unsigned int clock;
1249
1250 /* In case of UHS-I modes, set High Speed Enable */
1251 if ((ios->timing == MMC_TIMING_UHS_SDR50) ||
1252 (ios->timing == MMC_TIMING_UHS_SDR104) ||
1253 (ios->timing == MMC_TIMING_UHS_DDR50) ||
1254 (ios->timing == MMC_TIMING_UHS_SDR25) ||
1255 (ios->timing == MMC_TIMING_UHS_SDR12))
1256 ctrl |= SDHCI_CTRL_HISPD;
1248 1257
1249 ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); 1258 ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
1250 if (!(ctrl_2 & SDHCI_CTRL_PRESET_VAL_ENABLE)) { 1259 if (!(ctrl_2 & SDHCI_CTRL_PRESET_VAL_ENABLE)) {
@@ -1267,8 +1276,6 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1267 * need to reset SD Clock Enable before changing High 1276 * need to reset SD Clock Enable before changing High
1268 * Speed Enable to avoid generating clock gliches. 1277 * Speed Enable to avoid generating clock gliches.
1269 */ 1278 */
1270 u16 clk;
1271 unsigned int clock;
1272 1279
1273 /* Reset SD Clock Enable */ 1280 /* Reset SD Clock Enable */
1274 clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); 1281 clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
@@ -1282,6 +1289,33 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1282 host->clock = 0; 1289 host->clock = 0;
1283 sdhci_set_clock(host, clock); 1290 sdhci_set_clock(host, clock);
1284 } 1291 }
1292
1293 ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
1294
1295 /* Select Bus Speed Mode for host */
1296 ctrl_2 &= ~SDHCI_CTRL_UHS_MASK;
1297 if (ios->timing == MMC_TIMING_UHS_SDR12)
1298 ctrl_2 |= SDHCI_CTRL_UHS_SDR12;
1299 else if (ios->timing == MMC_TIMING_UHS_SDR25)
1300 ctrl_2 |= SDHCI_CTRL_UHS_SDR25;
1301 else if (ios->timing == MMC_TIMING_UHS_SDR50)
1302 ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
1303 else if (ios->timing == MMC_TIMING_UHS_SDR104)
1304 ctrl_2 |= SDHCI_CTRL_UHS_SDR104;
1305 else if (ios->timing == MMC_TIMING_UHS_DDR50)
1306 ctrl_2 |= SDHCI_CTRL_UHS_DDR50;
1307
1308 /* Reset SD Clock Enable */
1309 clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
1310 clk &= ~SDHCI_CLOCK_CARD_EN;
1311 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
1312
1313 sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
1314
1315 /* Re-enable SD Clock */
1316 clock = host->clock;
1317 host->clock = 0;
1318 sdhci_set_clock(host, clock);
1285 } else 1319 } else
1286 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); 1320 sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
1287 1321