summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPavan Kunapuli <pkunapuli@nvidia.com>2014-05-13 16:52:42 +0530
committerRiham Haidar <rhaidar@nvidia.com>2014-06-09 20:57:47 -0700
commit5ef2b3751c9cd4c97fe107b00e359fef2ff872f4 (patch)
tree366d4f5cb47ff90a7286c6e035bef2d7bf9d21cf /drivers/mmc
parent07665b8176562a8a8a47edb6aca56dadf23b2fa7 (diff)
mmc: tegra: Ignore err if dvfs overrides are disabled
If dvfs overrides are disabled, continue tuning execution by treating the dvfs override API return values as expected. Bug 1516198 Change-Id: I8d27969029ce7b318d23c227e8dfb19793282fea Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Signed-off-by: Naveen Kumar Arepalli <naveenk@nvidia.com> Reviewed-on: http://git-master/r/413118 GVS: Gerrit_Virtual_Submit Tested-by: Thomas Cherry <tcherry@nvidia.com> Reviewed-by: Thomas Cherry <tcherry@nvidia.com> (cherry picked from commit 71edeee1a98a8dc7474781689b0859a32f5aca80) Reviewed-on: http://git-master/r/419948 Reviewed-by: Kerwin Wan <kerwinw@nvidia.com> Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-tegra.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 6d65d5466153..fa37f496519f 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -2009,8 +2009,10 @@ static int sdhci_tegra_calculate_best_tap(struct sdhci_host *sdhci,
curr_vmin = tegra_dvfs_predict_millivolts(pltfm_host->clk,
tuning_data->freq_hz);
- vmin = curr_vmin;
+ if (!curr_vmin)
+ curr_vmin = tegra_host->boot_vcore_mv;
+ vmin = curr_vmin;
do {
SDHCI_TEGRA_DBG("%s: checking for win opening with vmin %d\n",
mmc_hostname(sdhci->mmc), vmin);
@@ -2052,11 +2054,25 @@ static int sdhci_tegra_calculate_best_tap(struct sdhci_host *sdhci,
tuning_data->best_tap_value = best_tap_value;
tuning_data->nom_best_tap_value = best_tap_value;
- /* Set the new vmin if there is any change. */
- if ((tuning_data->best_tap_value >= 0) && (curr_vmin != vmin))
+ /*
+ * Set the new vmin if there is any change. If dvfs overrides are
+ * disabled, then print the error message but continue execution
+ * rather than disabling tuning altogether.
+ */
+ if ((tuning_data->best_tap_value >= 0) && (curr_vmin != vmin)) {
err = tegra_dvfs_set_fmax_at_vmin(pltfm_host->clk,
tuning_data->freq_hz, vmin);
-
+ if ((err == -EPERM) || (err == -ENOSYS)) {
+ /*
+ * tegra_dvfs_set_fmax_at_vmin: will return EPERM or
+ * ENOSYS, when DVFS override is not enabled, continue
+ * tuning with default core voltage.
+ */
+ SDHCI_TEGRA_DBG(
+ "dvfs overrides disabled. Vmin not updated\n");
+ err = 0;
+ }
+ }
kfree(temp_tap_data);
return err;
}
@@ -2970,8 +2986,21 @@ static int sdhci_tegra_set_tuning_voltage(struct sdhci_host *sdhci,
SDHCI_TEGRA_DBG("%s: Setting vcore override %d\n",
mmc_hostname(sdhci->mmc), voltage);
- /* First clear any previous dvfs override settings */
+ /*
+ * First clear any previous dvfs override settings. If dvfs overrides
+ * are disabled, then print the error message but continue execution
+ * rather than failing tuning altogether.
+ */
err = tegra_dvfs_override_core_voltage(pltfm_host->clk, 0);
+ if ((err == -EPERM) || (err == -ENOSYS)) {
+ /*
+ * tegra_dvfs_override_core_voltage will return EPERM or ENOSYS,
+ * when DVFS override is not enabled. Continue tuning
+ * with default core voltage
+ */
+ SDHCI_TEGRA_DBG("dvfs overrides disabled. Nothing to clear\n");
+ err = 0;
+ }
if (!voltage)
return err;
@@ -2988,8 +3017,20 @@ static int sdhci_tegra_set_tuning_voltage(struct sdhci_host *sdhci,
nom_emc_freq_set = true;
}
+ /*
+ * If dvfs overrides are disabled, then print the error message but
+ * continue tuning execution rather than failing tuning altogether.
+ */
err = tegra_dvfs_override_core_voltage(pltfm_host->clk, voltage);
- if (err)
+ if ((err == -EPERM) || (err == -ENOSYS)) {
+ /*
+ * tegra_dvfs_override_core_voltage will return EPERM or ENOSYS,
+ * when DVFS override is not enabled. Continue tuning
+ * with default core voltage
+ */
+ SDHCI_TEGRA_DBG("dvfs overrides disabled. No overrides set\n");
+ err = 0;
+ } else if (err)
dev_err(mmc_dev(sdhci->mmc),
"failed to set vcore override %dmv\n", voltage);