From 1aa03dce3eb0bf737e52232fe0285252e5f4ecdb Mon Sep 17 00:00:00 2001 From: Pratibhasagar V Date: Thu, 29 Nov 2012 12:48:17 +0530 Subject: [PATCH] mmc: msm_sdcc: Update hw_reset functionality for resetting SD card Some targets whose regulators are controlled through platform-data in the board files. Add support for such SDC slots to enable hw_reset functionality Change-Id: I5033cd96f8816008ee7fa546bd81d83a33373299 Signed-off-by: Pratibhasagar V --- drivers/mmc/host/msm_sdcc.c | 61 ++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c index 73263a22ea4..de6db41aa9c 100644 --- a/drivers/mmc/host/msm_sdcc.c +++ b/drivers/mmc/host/msm_sdcc.c @@ -4280,35 +4280,40 @@ void msmsdcc_hw_reset(struct mmc_host *mmc) if (!card || !mmc_card_sd(card)) return; - /* - * Continuing on failing to disable regulator would lead to a panic - * anyway, since the commands would fail and console would be flooded - * with prints, eventually leading to a watchdog bark - */ - rc = msmsdcc_setup_vreg(host, false, false); - if (rc) { - pr_err("%s: %s disable regulator: failed: %d\n", - mmc_hostname(mmc), __func__, rc); - BUG_ON(rc); + pr_debug("%s: Starting h/w reset\n", mmc_hostname(host->mmc)); + + if (host->plat->translate_vdd || host->plat->vreg_data) { + + /* Disable the regulators */ + if (host->plat->translate_vdd) + rc = host->plat->translate_vdd(mmc_dev(mmc), 0); + else if (host->plat->vreg_data) + rc = msmsdcc_setup_vreg(host, false, false); + + if (rc) { + pr_err("%s: Failed to disable voltage regulator\n", + mmc_hostname(host->mmc)); + BUG_ON(rc); + } + + /* 10ms delay for supply to reach the desired voltage level */ + usleep_range(10000, 12000); + + /* Enable the regulators */ + if (host->plat->translate_vdd) + rc = host->plat->translate_vdd(mmc_dev(mmc), 1); + else if (host->plat->vreg_data) + rc = msmsdcc_setup_vreg(host, true, false); + + if (rc) { + pr_err("%s: Failed to enable voltage regulator\n", + mmc_hostname(host->mmc)); + BUG_ON(rc); + } + + /* 10ms delay for supply to reach the desired voltage level */ + usleep_range(10000, 12000); } - - /* 10ms delay for the supply to reach the desired voltage level */ - usleep_range(10000, 12000); - - /* - * Continuing on failing to enable regulator would lead to a panic - * anyway, since the commands would fail and console would be flooded - * with prints, eventually leading to a watchdog bark - */ - rc = msmsdcc_setup_vreg(host, true, false); - if (rc) { - pr_err("%s: %s enable regulator: failed: %d\n", - mmc_hostname(mmc), __func__, rc); - BUG_ON(rc); - } - - /* 10ms delay for the supply to reach the desired voltage level */ - usleep_range(10000, 12000); } static const struct mmc_host_ops msmsdcc_ops = {