From e90735ac98b195542f0a083dee88ffb905e40456 Mon Sep 17 00:00:00 2001 From: Ryan QIAN Date: Thu, 23 Feb 2012 08:24:53 +0800 Subject: [PATCH] ENGR00175221-02 [MX6] MMCSD: clear EXE_TUNE bit after tuning finishes. - add hook for post tuning in common code - add hook for post tuning for platform code to deal with clean up stuff on finishing tuning. Signed-off-by: Ryan QIAN --- drivers/mmc/core/core.c | 7 +++++++ drivers/mmc/core/core.h | 1 + drivers/mmc/core/sd.c | 1 + drivers/mmc/host/sdhci.c | 6 ++++++ drivers/mmc/host/sdhci.h | 1 + include/linux/mmc/host.h | 1 + 6 files changed, 17 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index fb541cc8a92c..c3f7117ea266 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -662,6 +662,13 @@ void mmc_set_clock(struct mmc_host *host, unsigned int hz) mmc_host_clk_release(host); } +void mmc_finish_tuning(struct mmc_host *host) +{ + host->ios.finish_tuning_flag = 1; + mmc_set_ios(host); + host->ios.finish_tuning_flag = 0; +} + void mmc_set_tuning(struct mmc_host *host, unsigned int tuning) { WARN_ON(tuning < host->tuning_min); diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 84370cad499d..afed70f7d0cc 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -34,6 +34,7 @@ void mmc_init_erase(struct mmc_card *card); void mmc_set_chip_select(struct mmc_host *host, int mode); void mmc_set_clock(struct mmc_host *host, unsigned int hz); void mmc_set_tuning(struct mmc_host *host, unsigned int tuning); +void mmc_finish_tuning(struct mmc_host *host); void mmc_gate_clock(struct mmc_host *host); void mmc_ungate_clock(struct mmc_host *host); void mmc_set_ungated(struct mmc_host *host); diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 8fddc550a3c3..b7291e0444f6 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -648,6 +648,7 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card) avg = (min + max) / 2; mmc_set_tuning(card->host, avg); mmc_send_tuning_cmd(card); + mmc_finish_tuning(card->host); } #else if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 84ec6119abcd..519f713ffa18 100755 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1328,6 +1328,12 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (host->flags & SDHCI_DEVICE_DEAD) goto out; + if (ios->finish_tuning_flag) { + if (host->ops->post_tuning) + host->ops->post_tuning(host); + goto out; + } + if (ios->tuning_flag) { /* means this request is for tuning only */ if (host->ops->pre_tuning) diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index e6af69ecc43f..27b12505c65c 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -275,6 +275,7 @@ struct sdhci_ops { int (*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs); void (*pre_tuning)(struct sdhci_host *host, u32 val); + void (*post_tuning)(struct sdhci_host *host); void (*platform_clk_ctrl)(struct sdhci_host *host, bool enable); }; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 66bf0fb1dbfa..3fc0cc758082 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -75,6 +75,7 @@ struct mmc_ios { #define MMC_SET_DRIVER_TYPE_C 2 #define MMC_SET_DRIVER_TYPE_D 3 unsigned int tuning_flag; /* request tuning only */ + unsigned int finish_tuning_flag; unsigned int tuning; /* tuning parameter */ }; -- 2.39.5