aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/sdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/sdio.c')
-rw-r--r--drivers/mmc/core/sdio.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 26b13169156c..9587d9f8cf1c 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -593,23 +593,27 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
593 struct mmc_card *card; 593 struct mmc_card *card;
594 int err; 594 int err;
595 int retries = 10; 595 int retries = 10;
596 u32 rocr = 0;
596 597
597 BUG_ON(!host); 598 BUG_ON(!host);
598 WARN_ON(!host->claimed); 599 WARN_ON(!host->claimed);
599 600
601 /* to query card if 1.8V signalling is supported */
602 if (mmc_host_uhs(host))
603 ocr |= R4_18V_PRESENT;
604
600try_again: 605try_again:
601 if (!retries) { 606 if (!retries) {
602 pr_warning("%s: Skipping voltage switch\n", 607 pr_warning("%s: Skipping voltage switch\n",
603 mmc_hostname(host)); 608 mmc_hostname(host));
604 ocr &= ~R4_18V_PRESENT; 609 ocr &= ~R4_18V_PRESENT;
605 host->ocr &= ~R4_18V_PRESENT;
606 } 610 }
607 611
608 /* 612 /*
609 * Inform the card of the voltage 613 * Inform the card of the voltage
610 */ 614 */
611 if (!powered_resume) { 615 if (!powered_resume) {
612 err = mmc_send_io_op_cond(host, host->ocr, &ocr); 616 err = mmc_send_io_op_cond(host, ocr, &rocr);
613 if (err) 617 if (err)
614 goto err; 618 goto err;
615 } 619 }
@@ -632,8 +636,8 @@ try_again:
632 goto err; 636 goto err;
633 } 637 }
634 638
635 if ((ocr & R4_MEMORY_PRESENT) && 639 if ((rocr & R4_MEMORY_PRESENT) &&
636 mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid, NULL) == 0) { 640 mmc_sd_get_cid(host, ocr & rocr, card->raw_cid, NULL) == 0) {
637 card->type = MMC_TYPE_SD_COMBO; 641 card->type = MMC_TYPE_SD_COMBO;
638 642
639 if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO || 643 if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO ||
@@ -663,9 +667,9 @@ try_again:
663 * systems that claim 1.8v signalling in fact do not support 667 * systems that claim 1.8v signalling in fact do not support
664 * it. 668 * it.
665 */ 669 */
666 if (!powered_resume && (ocr & R4_18V_PRESENT) && mmc_host_uhs(host)) { 670 if (!powered_resume && (rocr & ocr & R4_18V_PRESENT)) {
667 err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, 671 err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180,
668 host->ocr); 672 ocr);
669 if (err == -EAGAIN) { 673 if (err == -EAGAIN) {
670 sdio_reset(host); 674 sdio_reset(host);
671 mmc_go_idle(host); 675 mmc_go_idle(host);
@@ -675,12 +679,10 @@ try_again:
675 goto try_again; 679 goto try_again;
676 } else if (err) { 680 } else if (err) {
677 ocr &= ~R4_18V_PRESENT; 681 ocr &= ~R4_18V_PRESENT;
678 host->ocr &= ~R4_18V_PRESENT;
679 } 682 }
680 err = 0; 683 err = 0;
681 } else { 684 } else {
682 ocr &= ~R4_18V_PRESENT; 685 ocr &= ~R4_18V_PRESENT;
683 host->ocr &= ~R4_18V_PRESENT;
684 } 686 }
685 687
686 /* 688 /*
@@ -1084,10 +1086,6 @@ static int mmc_sdio_power_restore(struct mmc_host *host)
1084 goto out; 1086 goto out;
1085 } 1087 }
1086 1088
1087 if (mmc_host_uhs(host))
1088 /* to query card if 1.8V signalling is supported */
1089 host->ocr |= R4_18V_PRESENT;
1090
1091 ret = mmc_sdio_init_card(host, host->ocr, host->card, 1089 ret = mmc_sdio_init_card(host, host->ocr, host->card,
1092 mmc_card_keep_power(host)); 1090 mmc_card_keep_power(host));
1093 if (!ret && host->sdio_irqs) 1091 if (!ret && host->sdio_irqs)
@@ -1170,10 +1168,6 @@ int mmc_attach_sdio(struct mmc_host *host)
1170 /* 1168 /*
1171 * Detect and init the card. 1169 * Detect and init the card.
1172 */ 1170 */
1173 if (mmc_host_uhs(host))
1174 /* to query card if 1.8V signalling is supported */
1175 host->ocr |= R4_18V_PRESENT;
1176
1177 err = mmc_sdio_init_card(host, host->ocr, NULL, 0); 1171 err = mmc_sdio_init_card(host, host->ocr, NULL, 0);
1178 if (err) 1172 if (err)
1179 goto err; 1173 goto err;