@@ -1346,7 +1346,7 @@ static void mmc_poweroff_notify(struct mmc_host *host)
* If a host does all the power sequencing itself, ignore the
* initial MMC_POWER_UP stage.
*/
-static void mmc_power_up(struct mmc_host *host)
+void mmc_power_up(struct mmc_host *host)
{
int bit;
@@ -45,6 +45,7 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage,
void mmc_set_timing(struct mmc_host *host, unsigned int timing);
void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type);
void mmc_power_off(struct mmc_host *host);
+void mmc_power_up(struct mmc_host *host);
static inline void mmc_delay(unsigned int ms)
{
@@ -720,6 +720,7 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr)
* state. We wait 1ms to give cards time to
* respond.
*/
+try_again:
mmc_go_idle(host);
/*
@@ -748,7 +749,6 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr)
if (max_current > 150)
ocr |= SD_OCR_XPC;
-try_again:
err = mmc_send_app_op_cond(host, ocr, rocr);
if (err)
return err;
@@ -761,7 +761,11 @@ try_again:
((*rocr & 0x41000000) == 0x41000000)) {
err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, true);
if (err) {
- ocr &= ~SD_OCR_S18R;
+ /* Power cycle card */
+ pr_warning("%s: Signal voltage switch failed, "
+ "power cycling card\n", mmc_hostname(host));
+ mmc_power_off(host);
+ mmc_power_up(host);
goto try_again;
}
}
Signed-off-by: Johan Rudholm <johan.rudholm@stericsson.com> --- drivers/mmc/core/core.c | 2 +- drivers/mmc/core/core.h | 1 + drivers/mmc/core/sd.c | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-)