summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSayali Lokhande <sayalil@codeaurora.org>2017-04-24 13:40:50 +0530
committerVijay Viswanath <vviswana@codeaurora.org>2017-05-03 12:16:53 +0530
commit3970ec5d3d0b147b7538b9ab60e39507a866fee6 (patch)
treed19bf7ff91d788364c6854d31761c93fdf7d5a0d
parentea7ba3abc3b9b9d7190c00a13ec624195df55710 (diff)
mmc: core: Use mmc_reset instead of power_restore
On 4.4 kernel, 'commit 364549ddc29d ("mmc: core: Remove redundant ->power_restore() callback for MMC")' removed power_restore callback for MMC since mmc_reset is implemented. Hence use reset instead of power_restore in mmc_cmdq_hw_reset. Also modify the caller function mmc_cmdq_hw_reset to properly use the mmc_reset. Change-Id: Ia06d579401b6a083b164dff7a253d1eb3caef1a3 Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org> Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
-rw-r--r--drivers/mmc/core/core.c8
-rw-r--r--drivers/mmc/core/mmc.c25
2 files changed, 27 insertions, 6 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8bdb965d0be8..c462eee4a5f7 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -3944,12 +3944,10 @@ static void mmc_hw_reset_for_init(struct mmc_host *host)
*/
int mmc_cmdq_hw_reset(struct mmc_host *host)
{
- if (!host->bus_ops->power_restore)
- return -EOPNOTSUPP;
+ if (!host->bus_ops->reset)
+ return -EOPNOTSUPP;
- mmc_power_cycle(host, host->ocr_avail);
- mmc_select_voltage(host, host->card->ocr);
- return host->bus_ops->power_restore(host);
+ return host->bus_ops->reset(host);
}
EXPORT_SYMBOL(mmc_cmdq_hw_reset);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 600fdb8ad7ba..691287125895 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -2892,6 +2892,7 @@ EXPORT_SYMBOL(mmc_can_reset);
static int mmc_reset(struct mmc_host *host)
{
struct mmc_card *card = host->card;
+ int ret;
if ((host->caps & MMC_CAP_HW_RESET) && host->ops->hw_reset &&
mmc_can_reset(card)) {
@@ -2904,7 +2905,29 @@ static int mmc_reset(struct mmc_host *host)
/* Do a brute force power cycle */
mmc_power_cycle(host, card->ocr);
}
- return mmc_init_card(host, card->ocr, card);
+
+ /* Suspend clk scaling to avoid switching frequencies intermittently */
+
+ ret = mmc_suspend_clk_scaling(host);
+ if (ret) {
+ pr_err("%s: %s: fail to suspend clock scaling (%d)\n",
+ mmc_hostname(host), __func__, ret);
+ return ret;
+ }
+
+ ret = mmc_init_card(host, host->card->ocr, host->card);
+ if (ret) {
+ pr_err("%s: %s: mmc_init_card failed (%d)\n",
+ mmc_hostname(host), __func__, ret);
+ return ret;
+ }
+
+ ret = mmc_resume_clk_scaling(host);
+ if (ret)
+ pr_err("%s: %s: fail to resume clock scaling (%d)\n",
+ mmc_hostname(host), __func__, ret);
+
+ return ret;
}
static const struct mmc_bus_ops mmc_ops = {