aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/mmc.c')
-rw-r--r--drivers/mmc/core/mmc.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 59b9ba52e66a..2b9ed1401dc4 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -376,7 +376,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
376 } 376 }
377 377
378 card->ext_csd.raw_hc_erase_gap_size = 378 card->ext_csd.raw_hc_erase_gap_size =
379 ext_csd[EXT_CSD_PARTITION_ATTRIBUTE]; 379 ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
380 card->ext_csd.raw_sec_trim_mult = 380 card->ext_csd.raw_sec_trim_mult =
381 ext_csd[EXT_CSD_SEC_TRIM_MULT]; 381 ext_csd[EXT_CSD_SEC_TRIM_MULT];
382 card->ext_csd.raw_sec_erase_mult = 382 card->ext_csd.raw_sec_erase_mult =
@@ -551,7 +551,7 @@ static int mmc_compare_ext_csds(struct mmc_card *card, unsigned bus_width)
551 goto out; 551 goto out;
552 552
553 /* only compare read only fields */ 553 /* only compare read only fields */
554 err = (!(card->ext_csd.raw_partition_support == 554 err = !((card->ext_csd.raw_partition_support ==
555 bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) && 555 bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) &&
556 (card->ext_csd.raw_erased_mem_count == 556 (card->ext_csd.raw_erased_mem_count ==
557 bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) && 557 bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) &&
@@ -816,6 +816,9 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
816 if (!mmc_host_is_spi(host)) 816 if (!mmc_host_is_spi(host))
817 mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN); 817 mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN);
818 818
819 /* Initialization should be done at 3.3 V I/O voltage. */
820 mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
821
819 /* 822 /*
820 * Since we're changing the OCR value, we seem to 823 * Since we're changing the OCR value, we seem to
821 * need to tell some cards to go back to the idle 824 * need to tell some cards to go back to the idle
@@ -1006,7 +1009,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1006 err = mmc_select_hs200(card); 1009 err = mmc_select_hs200(card);
1007 else if (host->caps & MMC_CAP_MMC_HIGHSPEED) 1010 else if (host->caps & MMC_CAP_MMC_HIGHSPEED)
1008 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 1011 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1009 EXT_CSD_HS_TIMING, 1, 0); 1012 EXT_CSD_HS_TIMING, 1,
1013 card->ext_csd.generic_cmd6_time);
1010 1014
1011 if (err && err != -EBADMSG) 1015 if (err && err != -EBADMSG)
1012 goto free_card; 1016 goto free_card;
@@ -1116,7 +1120,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1116 * Activate wide bus and DDR (if supported). 1120 * Activate wide bus and DDR (if supported).
1117 */ 1121 */
1118 if (!mmc_card_hs200(card) && 1122 if (!mmc_card_hs200(card) &&
1119 (card->csd.mmca_vsn >= CSD_SPEC_VER_3) && 1123 (card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
1120 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { 1124 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
1121 static unsigned ext_csd_bits[][2] = { 1125 static unsigned ext_csd_bits[][2] = {
1122 { EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 }, 1126 { EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 },
@@ -1315,11 +1319,13 @@ static int mmc_suspend(struct mmc_host *host)
1315 BUG_ON(!host->card); 1319 BUG_ON(!host->card);
1316 1320
1317 mmc_claim_host(host); 1321 mmc_claim_host(host);
1318 if (mmc_card_can_sleep(host)) 1322 if (mmc_card_can_sleep(host)) {
1319 err = mmc_card_sleep(host); 1323 err = mmc_card_sleep(host);
1320 else if (!mmc_host_is_spi(host)) 1324 if (!err)
1325 mmc_card_set_sleep(host->card);
1326 } else if (!mmc_host_is_spi(host))
1321 mmc_deselect_cards(host); 1327 mmc_deselect_cards(host);
1322 host->card->state &= ~MMC_STATE_HIGHSPEED; 1328 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
1323 mmc_release_host(host); 1329 mmc_release_host(host);
1324 1330
1325 return err; 1331 return err;
@@ -1339,7 +1345,11 @@ static int mmc_resume(struct mmc_host *host)
1339 BUG_ON(!host->card); 1345 BUG_ON(!host->card);
1340 1346
1341 mmc_claim_host(host); 1347 mmc_claim_host(host);
1342 err = mmc_init_card(host, host->ocr, host->card); 1348 if (mmc_card_is_sleep(host->card)) {
1349 err = mmc_card_awake(host);
1350 mmc_card_clr_sleep(host->card);
1351 } else
1352 err = mmc_init_card(host, host->ocr, host->card);
1343 mmc_release_host(host); 1353 mmc_release_host(host);
1344 1354
1345 return err; 1355 return err;
@@ -1349,7 +1359,8 @@ static int mmc_power_restore(struct mmc_host *host)
1349{ 1359{
1350 int ret; 1360 int ret;
1351 1361
1352 host->card->state &= ~MMC_STATE_HIGHSPEED; 1362 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
1363 mmc_card_clr_sleep(host->card);
1353 mmc_claim_host(host); 1364 mmc_claim_host(host);
1354 ret = mmc_init_card(host, host->ocr, host->card); 1365 ret = mmc_init_card(host, host->ocr, host->card);
1355 mmc_release_host(host); 1366 mmc_release_host(host);