summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorJeetesh Burman <jburman@nvidia.com>2015-03-24 22:55:34 +0530
committerMatthew Pedro <mapedro@nvidia.com>2015-05-04 13:39:04 -0700
commit3c5f4d1060669ec73dc0ceb4e9a876a55a89c5eb (patch)
tree935275601c06f58bbcbc75039a77e6f86230ded5 /drivers/mmc
parentf9b36d3b89f76cc48678eeb7a27cb980e89901d0 (diff)
mmc: tegra: Use 100000 precision instead of 1000
-To derive estimated tuning data for other than boot_mv and vmin we are using precision of 1000. -Use precision of 100000 to derive data more accurately Bug 1414513 Change-Id: I9caff04515980713a83f33c4cf6b524ba022d2b8 Signed-off-by: Naveen Kumar Arepalli <naveenk@nvidia.com> Reviewed-on: http://git-master/r/437992 (cherry picked from commit 36330ecf4ffe9333bf895f2e943f8b6b7201c012) Signed-off-by: Jeetesh Burman <jburman@nvidia.com> Reviewed-on: http://git-master/r/721897 GVS: Gerrit_Virtual_Submit Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-tegra.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 30a44e832155..6f2b566a1b67 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -228,6 +228,7 @@
#define TUNING_RETRIES 1
#define DFS_FREQ_COUNT 2
#define NEG_MAR_CHK_WIN_COUNT 2
+#define PRECISION_FOR_ESTIMATE 100000
/* Tuning core voltage requirements */
#define NOMINAL_VCORE_TUN BIT(0)
#define BOOT_VCORE_TUN BIT(1)
@@ -2315,19 +2316,22 @@ static int calculate_estimated_tuning_values(int speedo,
} else if (voltage_mv == t2t_coeffs->vmax) {
est_values->t2t_vmax = vmax_t2t;
} else {
- vmax_t2t = 1000 / vmax_t2t;
- vmin_t2t = 1000 / vmin_t2t;
+ vmax_t2t = PRECISION_FOR_ESTIMATE / vmax_t2t;
+ vmin_t2t = PRECISION_FOR_ESTIMATE / vmin_t2t;
/*
- * For any intermediate voltage between 0.95V and 1.25V,
+ * For any intermediate voltage between 0.95V and max vcore,
* calculate the slope and intercept from the T2T and tap hole
- * values of 0.95V and 1.25V and use them to calculate the
+ * values of 0.95V and max vcore and use them to calculate the
* actual values. 1/T2T is a linear function of voltage.
*/
- slope = ((vmax_t2t - vmin_t2t) * 1000) /
- (t2t_coeffs->vmax - t2t_coeffs->vmin);
- inpt = (vmax_t2t * 1000 - (slope * t2t_coeffs->vmax)) / 1000;
- est_values->t2t_vmax = (slope * voltage_mv) / 1000 + inpt;
- est_values->t2t_vmax = (1000 / est_values->t2t_vmax);
+ slope = ((vmax_t2t - vmin_t2t) * PRECISION_FOR_ESTIMATE) /
+ (t2t_coeffs->vmax - t2t_coeffs->vmin);
+ inpt = (vmax_t2t * PRECISION_FOR_ESTIMATE -
+ (slope * t2t_coeffs->vmax)) / PRECISION_FOR_ESTIMATE;
+ est_values->t2t_vmax = ((slope * voltage_mv) /
+ PRECISION_FOR_ESTIMATE + inpt);
+ est_values->t2t_vmax = (PRECISION_FOR_ESTIMATE /
+ est_values->t2t_vmax);
}
/* Est_UI = (1000000/freq_MHz)/Est_T2T_Vmax */
@@ -2348,15 +2352,17 @@ static int calculate_estimated_tuning_values(int speedo,
est_values->vmax_thole = vmax_thole;
} else {
/*
- * For any intermediate voltage between 0.95V and 1.25V,
+ * For any intermediate voltage between 0.95V and max vcore,
* calculate the slope and intercept from the t2t and tap hole
- * values of 0.95V and 1.25V and use them to calculate the
+ * values of 0.95V and max vcore and use them to calculate the
* actual values. Tap hole is a linear function of voltage.
*/
- slope = ((vmax_thole - vmin_thole) * 1000) /
- (t2t_coeffs->vmax - t2t_coeffs->vmin);
- inpt = (vmax_thole * 1000 - (slope * t2t_coeffs->vmax)) / 1000;
- est_values->vmax_thole = (slope * voltage_mv) / 1000 + inpt;
+ slope = ((vmax_thole - vmin_thole) * PRECISION_FOR_ESTIMATE) /
+ (t2t_coeffs->vmax - t2t_coeffs->vmin);
+ inpt = (vmax_thole * PRECISION_FOR_ESTIMATE -
+ (slope * t2t_coeffs->vmax)) / PRECISION_FOR_ESTIMATE;
+ est_values->vmax_thole = (slope * voltage_mv) /
+ PRECISION_FOR_ESTIMATE + inpt;
}
est_values->vmin_thole = vmin_thole;