Commit e7747475b61fdc2a4a412475a9d64d8c309916e3

Authored by Ulf Hansson
Committed by Chris Ball
1 parent 8f7f6b7e46

mmc: core: Fixup suspend/resume issues for UHS-I cards

Even if cards supports 1.8V I/O voltage those should anyway be
initialized at 3.3V I/O according to (e)MMC, SD and SDIO specs.
Some eMMC and embedded SDIO devices are able to be initialized
at 1.8V as well, but it is better to be safe.

Do note that initialization in this context means that the card
has been completely powered off, otherwise the card will remain
at the last I/O voltage level that were negotitiated.

Due to the above being taken care of the suspend/resume issues
for UHS-I SD-cards has been fixed.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Acked-by: Philip Rakity <prakity@marvell.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Chris Ball <cjb@laptop.org>

Showing 4 changed files with 17 additions and 5 deletions Side-by-side Diff

drivers/mmc/core/core.c
... ... @@ -2068,6 +2068,9 @@
2068 2068 */
2069 2069 mmc_hw_reset_for_init(host);
2070 2070  
  2071 + /* Initialization should be done at 3.3 V I/O voltage. */
  2072 + mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
  2073 +
2071 2074 /*
2072 2075 * sdio_reset sends CMD52 to reset card. Since we do not know
2073 2076 * if the card is being re-initialized, just send it. CMD52
drivers/mmc/core/mmc.c
... ... @@ -816,6 +816,9 @@
816 816 if (!mmc_host_is_spi(host))
817 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 823 * Since we're changing the OCR value, we seem to
821 824 * need to tell some cards to go back to the idle
drivers/mmc/core/sd.c
... ... @@ -911,6 +911,9 @@
911 911 BUG_ON(!host);
912 912 WARN_ON(!host->claimed);
913 913  
  914 + /* The initialization should be done at 3.3 V I/O voltage. */
  915 + mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
  916 +
914 917 err = mmc_sd_get_cid(host, ocr, cid, &rocr);
915 918 if (err)
916 919 return err;
... ... @@ -1155,11 +1158,6 @@
1155 1158  
1156 1159 BUG_ON(!host);
1157 1160 WARN_ON(!host->claimed);
1158   -
1159   - /* Make sure we are at 3.3V signalling voltage */
1160   - err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, false);
1161   - if (err)
1162   - return err;
1163 1161  
1164 1162 /* Disable preset value enable if already set since last time */
1165 1163 if (host->ops->enable_preset_value) {
drivers/mmc/core/sdio.c
... ... @@ -585,6 +585,9 @@
585 585 * Inform the card of the voltage
586 586 */
587 587 if (!powered_resume) {
  588 + /* The initialization should be done at 3.3 V I/O voltage. */
  589 + mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
  590 +
588 591 err = mmc_send_io_op_cond(host, host->ocr, &ocr);
589 592 if (err)
590 593 goto err;
... ... @@ -996,6 +999,11 @@
996 999 * With these steps taken, mmc_select_voltage() is also required to
997 1000 * restore the correct voltage setting of the card.
998 1001 */
  1002 +
  1003 + /* The initialization should be done at 3.3 V I/O voltage. */
  1004 + if (!mmc_card_keep_power(host))
  1005 + mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
  1006 +
999 1007 sdio_reset(host);
1000 1008 mmc_go_idle(host);
1001 1009 mmc_send_if_cond(host, host->ocr_avail);