#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>
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) {
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;
}
}
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) {
} 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;
}
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);
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;