Revert "mmc: tegra: select fixed tap hole margin values"
Jeetesh Burman [Thu, 18 Jun 2015 05:49:27 +0000 (10:49 +0530)]
This reverts commit 8eadba170693964dc30b1e6ab0a80df012858bc0.

Signed-off-by: Jeetesh Burman <jburman@nvidia.com>
Change-Id: Icd990d1e9c8df4c66c46e7e29a03cc6233e206bd
Reviewed-on: http://git-master/r/759473
GVS: Gerrit_Virtual_Submit
Reviewed-by: Winnie Hsu <whsu@nvidia.com>

drivers/mmc/host/sdhci-tegra.c
include/linux/tegra-fuse.h

index 1824380..add1615 100644 (file)
@@ -44,7 +44,6 @@
 #include <linux/devfreq.h>
 #include <linux/clk/tegra.h>
 #include <linux/tegra-soc.h>
-#include <linux/tegra-fuse.h>
 
 #include <linux/platform_data/mmc-sdhci-tegra.h>
 #include <mach/pinmux.h>
@@ -1928,6 +1927,9 @@ static int slide_window_start(struct sdhci_host *sdhci,
        struct tegra_tuning_data *tuning_data,
        int tap_value, enum tap_win_edge_attr edge_attr, int tap_hole)
 {
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci);
+       struct sdhci_tegra *tegra_host = pltfm_host->priv;
+       const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
        int tap_margin = 0;
 
        if (edge_attr == WIN_EDGE_BOUN_START) {
@@ -1937,8 +1939,12 @@ static int slide_window_start(struct sdhci_host *sdhci,
                        tap_value += (1000 / tuning_data->calc_values.t2t_vmax);
        } else if (edge_attr == WIN_EDGE_HOLE) {
                if (tap_hole >= 0) {
-                       tap_margin = get_tuning_tap_hole_margins(sdhci,
-                                       tuning_data->calc_values.t2t_vmax);
+                       if (soc_data->nvquirks & NVQUIRK_TMP_VAR_1_5_TAP_MARGIN)
+                               tap_margin = 2;
+                       else
+                               tap_margin = (((2 * (450 /
+                                       tuning_data->calc_values.t2t_vmax)) +
+                                       1) / 2);
                        tap_value += ((7 * tap_hole) / 100) + tap_margin;
                }
        }
@@ -1953,6 +1959,9 @@ static int slide_window_end(struct sdhci_host *sdhci,
        struct tegra_tuning_data *tuning_data,
        int tap_value, enum tap_win_edge_attr edge_attr, int tap_hole)
 {
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci);
+       struct sdhci_tegra *tegra_host = pltfm_host->priv;
+       const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
        int tap_margin = 0;
 
        if (edge_attr == WIN_EDGE_BOUN_END) {
@@ -1962,8 +1971,12 @@ static int slide_window_end(struct sdhci_host *sdhci,
        } else if (edge_attr == WIN_EDGE_HOLE) {
                if (tap_hole >= 0) {
                        tap_value = tap_hole;
-                       tap_margin = get_tuning_tap_hole_margins(sdhci,
-                                       tuning_data->calc_values.t2t_vmin);
+                       if (soc_data->nvquirks & NVQUIRK_TMP_VAR_1_5_TAP_MARGIN)
+                               tap_margin = 2;
+                       else
+                               tap_margin = (((2 * (450 /
+                                       tuning_data->calc_values.t2t_vmin)) +
+                                       1) / 2);
                }
                tap_value -= ((7 * tap_hole) / 100) + tap_margin;
        }
@@ -2865,18 +2878,21 @@ static int get_tuning_tap_hole_margins(struct sdhci_host *sdhci,
        int i;
        int tap_margin = 0;
 
-       if (soc_data->nvquirks & NVQUIRK_SELECT_FIXED_TAP_HOLE_MARGINS &&
-                       soc_data->tap_hole_margins) {
-               tap_hole = soc_data->tap_hole_margins;
-               dev_id = dev_name(mmc_dev(sdhci->mmc));
-               for (i = 0; i < soc_data->tap_hole_margins_count; i++) {
-                       if (!strcmp(dev_id, tap_hole->dev_id))
-                               return tap_hole->tap_hole_margin;
-                       tap_hole++;
+       if (soc_data->nvquirks & NVQUIRK_SELECT_FIXED_TAP_HOLE_MARGINS)  {
+               if (soc_data->tap_hole_margins) {
+                       tap_hole = soc_data->tap_hole_margins;
+                       dev_id = dev_name(mmc_dev(sdhci->mmc));
+                       for (i = 0; i < soc_data->tap_hole_margins_count; i++) {
+                               if (!strcmp(dev_id, tap_hole->dev_id))
+                                       return tap_hole->tap_hole_margin;
+                               tap_hole++;
+                       }
+               } else {
+                       dev_info(mmc_dev(sdhci->mmc),
+                               "Fixed tap hole margins missing\n");
                }
        }
-       dev_info(mmc_dev(sdhci->mmc),
-                               "Tap hole margins missing\n");
+
        /* if no margin are available calculate tap margin */
        tap_margin = (((2 * (450 / t2t_tuning_value)) +
                        1) / 2);
@@ -4388,26 +4404,6 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
        tegra_host->tap_cmd = TAP_CMD_TRIM_DEFAULT_VOLTAGE;
        tegra_host->speedo = plat->cpu_speedo;
        dev_info(mmc_dev(host->mmc), "Speedo value %d\n", tegra_host->speedo);
-
-       /* update t2t and tap_hole for automotive speedo */
-       if (tegra_is_soc_automotive_speedo() &&
-                       (soc_data == &soc_data_tegra12)) {
-               soc_data_tegra12.t2t_coeffs = t12x_automotive_tuning_coeffs;
-               soc_data_tegra12.t2t_coeffs_count =
-                               ARRAY_SIZE(t12x_automotive_tuning_coeffs);
-               soc_data_tegra12.tap_hole_coeffs =
-                               t12x_automotive_tap_hole_coeffs;
-               soc_data_tegra12.tap_hole_coeffs_count =
-                               ARRAY_SIZE(t12x_automotive_tap_hole_coeffs);
-               /* For automotive SDR50 mode POR frequency is 99Mhz */
-               soc_data_tegra12.tuning_freq_list[0] = 99000000;
-               soc_data_tegra12.nvquirks |=
-                               NVQUIRK_SELECT_FIXED_TAP_HOLE_MARGINS;
-               soc_data_tegra12.tap_hole_margins =
-                               t12x_automotive_tap_hole_margins;
-               soc_data_tegra12.tap_hole_margins_count =
-                               ARRAY_SIZE(t12x_automotive_tap_hole_margins);
-       }
        host->mmc->pm_caps |= plat->pm_caps;
        host->mmc->pm_flags |= plat->pm_flags;
 
index 3d72db3..0d2b9c9 100644 (file)
@@ -51,14 +51,6 @@ int tegra_cpu_process_id(void);
 int tegra_core_process_id(void);
 int tegra_gpu_process_id(void);
 int tegra_get_age(void);
-#if defined(CONFIG_ARCH_TEGRA_12x_SOC) && !defined(CONFIG_ARCH_TEGRA_13x_SOC)
-bool tegra_is_soc_automotive_speedo(void);
-#else
-static inline bool tegra_is_soc_automotive_speedo(void)
-{
-        return 0;
-}
-#endif
 
 int tegra_package_id(void);
 int tegra_cpu_speedo_id(void);