mmc: core: reset signal voltage on power up
Add a call to mmc_set_signal_voltage() to set signal voltage to 3.3v in mmc_power_up so that we do not need to touch signal voltage setting in mmc/sd/sdio init functions and rescan function. For mmc/sd cards, when doing a suspend/resume cycle, consider the unsafe resume case, the card will lose its power and when powered on again, we will set signal voltage to 3.3v in mmc_power_up before its resume function gets called, which will re-init the card. And for sdio cards, when doing a suspend/resume cycle, consider the unsafe resume case, the card will either lose its power or not depending on if it wants to wakeup the host. If power is not maintained, it is the same case as mmc/sd cards. If power is maintained, mmc_power_up will not be called and the card's signal voltage will remain at the last setting. Signed-off-by: Aaron Lu <aaron.lu@amd.com> Tested-by: Venkatraman S <svenkatr@ti.com> Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
parent
55c4665ea0
commit
108ecc4cf9
|
@ -1212,6 +1212,9 @@ static void mmc_power_up(struct mmc_host *host)
|
||||||
host->ios.timing = MMC_TIMING_LEGACY;
|
host->ios.timing = MMC_TIMING_LEGACY;
|
||||||
mmc_set_ios(host);
|
mmc_set_ios(host);
|
||||||
|
|
||||||
|
/* Set signal voltage to 3.3V */
|
||||||
|
mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This delay should be sufficient to allow the power supply
|
* This delay should be sufficient to allow the power supply
|
||||||
* to reach the minimum voltage.
|
* to reach the minimum voltage.
|
||||||
|
@ -1963,9 +1966,6 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
|
||||||
*/
|
*/
|
||||||
mmc_hw_reset_for_init(host);
|
mmc_hw_reset_for_init(host);
|
||||||
|
|
||||||
/* Initialization should be done at 3.3 V I/O voltage. */
|
|
||||||
mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sdio_reset sends CMD52 to reset card. Since we do not know
|
* sdio_reset sends CMD52 to reset card. Since we do not know
|
||||||
* if the card is being re-initialized, just send it. CMD52
|
* if the card is being re-initialized, just send it. CMD52
|
||||||
|
|
|
@ -818,9 +818,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
|
||||||
if (!mmc_host_is_spi(host))
|
if (!mmc_host_is_spi(host))
|
||||||
mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN);
|
mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN);
|
||||||
|
|
||||||
/* Initialization should be done at 3.3 V I/O voltage. */
|
|
||||||
mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since we're changing the OCR value, we seem to
|
* Since we're changing the OCR value, we seem to
|
||||||
* need to tell some cards to go back to the idle
|
* need to tell some cards to go back to the idle
|
||||||
|
|
|
@ -901,9 +901,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
|
||||||
BUG_ON(!host);
|
BUG_ON(!host);
|
||||||
WARN_ON(!host->claimed);
|
WARN_ON(!host->claimed);
|
||||||
|
|
||||||
/* The initialization should be done at 3.3 V I/O voltage. */
|
|
||||||
mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
|
|
||||||
|
|
||||||
err = mmc_sd_get_cid(host, ocr, cid, &rocr);
|
err = mmc_sd_get_cid(host, ocr, cid, &rocr);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -591,9 +591,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
|
||||||
* Inform the card of the voltage
|
* Inform the card of the voltage
|
||||||
*/
|
*/
|
||||||
if (!powered_resume) {
|
if (!powered_resume) {
|
||||||
/* The initialization should be done at 3.3 V I/O voltage. */
|
|
||||||
mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
|
|
||||||
|
|
||||||
err = mmc_send_io_op_cond(host, host->ocr, &ocr);
|
err = mmc_send_io_op_cond(host, host->ocr, &ocr);
|
||||||
if (err)
|
if (err)
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -1006,10 +1003,6 @@ static int mmc_sdio_power_restore(struct mmc_host *host)
|
||||||
* restore the correct voltage setting of the card.
|
* restore the correct voltage setting of the card.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The initialization should be done at 3.3 V I/O voltage. */
|
|
||||||
if (!mmc_card_keep_power(host))
|
|
||||||
mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
|
|
||||||
|
|
||||||
sdio_reset(host);
|
sdio_reset(host);
|
||||||
mmc_go_idle(host);
|
mmc_go_idle(host);
|
||||||
mmc_send_if_cond(host, host->ocr_avail);
|
mmc_send_if_cond(host, host->ocr_avail);
|
||||||
|
|
Loading…
Reference in New Issue