summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorSeshagir.H <sholi@nvidia.com>2014-09-25 18:21:49 +0530
committerMatthew Pedro <mapedro@nvidia.com>2015-05-04 13:43:42 -0700
commit8eadba170693964dc30b1e6ab0a80df012858bc0 (patch)
tree0b068cccf83859d0b404b26d54812004ee944149 /drivers/mmc
parentaf2031797899b32504e32af377fa65875c06a746 (diff)
mmc: tegra: select fixed tap hole margin values
bug 200035711 Change-Id: I2efdabe31ec2ab5b6b0253f54484365e61890e91 Signed-off-by: Seshagir.H <sholi@nvidia.com> Reviewed-on: http://git-master/r/538920 (cherry picked from commit ef940296b6f41e4669fe7da4c48bf34091af2512) Reviewed-on: http://git-master/r/725516 GVS: Gerrit_Virtual_Submit Reviewed-by: Jeetesh Burman <jburman@nvidia.com> Tested-by: Jeetesh Burman <jburman@nvidia.com> Reviewed-by: Naveen Kumar Arepalli <naveenk@nvidia.com> Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-tegra.c66
1 files changed, 35 insertions, 31 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index add1615a2c9f..18243806212b 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -44,6 +44,7 @@
#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>
@@ -1927,9 +1928,6 @@ 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) {
@@ -1939,12 +1937,8 @@ 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) {
- 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_margin = get_tuning_tap_hole_margins(sdhci,
+ tuning_data->calc_values.t2t_vmax);
tap_value += ((7 * tap_hole) / 100) + tap_margin;
}
}
@@ -1959,9 +1953,6 @@ 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) {
@@ -1971,12 +1962,8 @@ static int slide_window_end(struct sdhci_host *sdhci,
} else if (edge_attr == WIN_EDGE_HOLE) {
if (tap_hole >= 0) {
tap_value = tap_hole;
- 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_margin = get_tuning_tap_hole_margins(sdhci,
+ tuning_data->calc_values.t2t_vmin);
}
tap_value -= ((7 * tap_hole) / 100) + tap_margin;
}
@@ -2878,21 +2865,18 @@ 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) {
- 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");
+ 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++;
}
}
-
+ 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);
@@ -4404,6 +4388,26 @@ 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;