summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/tegra3_emc.c
diff options
context:
space:
mode:
authorAlex Frid <afrid@nvidia.com>2011-11-04 21:06:52 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 00:58:16 -0700
commit200fe0c2f1c6e76f2bcca99fd029817806ec989a (patch)
treeb0571f81d4f7c8ee7453c3a9d44d6ec006b53cee /arch/arm/mach-tegra/tegra3_emc.c
parent01f5d656857332946c8c2af09c7aab33b02de439 (diff)
ARM: tegra: dvfs: Make EMC voltage scaling board dependent
Added minimum voltage field to Tegra3 EMC frequency scaling table. Adjusted default (common) EMC DVFS mapping, respectively, when EMC frequency table for the particular board/dram chip combination is loaded. Bug 895245 Signed-off-by: Alex Frid <afrid@nvidia.com> (cherry picked from commit 1fe4d12c4abdd08abd45eb755d3d50780cafb19c) (cherry picked from commit 4020c6aacfd5ec3c7106cc05e720bc4c356ac58d) Change-Id: Ia10183001996aee37259efdb533640ebf72d552a Reviewed-on: http://git-master/r/67012 Tested-by: Aleksandr Frid <afrid@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Rebase-Id: Rb1cb3a849c9c870b0c338a5a0a7e9cb9a7572674
Diffstat (limited to 'arch/arm/mach-tegra/tegra3_emc.c')
-rw-r--r--arch/arm/mach-tegra/tegra3_emc.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/tegra3_emc.c b/arch/arm/mach-tegra/tegra3_emc.c
index 81f5ddc6140d..d36e8bdb64bd 100644
--- a/arch/arm/mach-tegra/tegra3_emc.c
+++ b/arch/arm/mach-tegra/tegra3_emc.c
@@ -760,6 +760,35 @@ static const struct clk_mux_sel *find_matching_input(
return NULL;
}
+static void adjust_emc_dvfs_table(const struct tegra_emc_table *table,
+ int table_size)
+{
+ int i, j;
+ unsigned long rate;
+
+ if (table[0].rev < 0x33)
+ return;
+
+ for (i = 0; i < MAX_DVFS_FREQS; i++) {
+ int mv = emc->dvfs->millivolts[i];
+ if (!mv)
+ break;
+
+ /* For each dvfs voltage find maximum supported rate;
+ use 1MHz placeholder if not found */
+ for (rate = 1000, j = 0; j < table_size; j++) {
+ if (tegra_emc_clk_sel[j].input == NULL)
+ continue; /* invalid entry */
+
+ if ((mv >= table[j].emc_min_mv) &&
+ (rate < table[j].rate))
+ rate = table[j].rate;
+ }
+ /* Table entries specify rate in kHz */
+ emc->dvfs->freqs[i] = rate * 1000;
+ }
+}
+
static bool is_emc_bridge(void)
{
int mv;
@@ -890,6 +919,7 @@ static int tegra_emc_probe(struct platform_device *pdev)
break;
case 0x31:
case 0x32:
+ case 0x33:
emc_num_burst_regs = 107;
break;
default:
@@ -941,6 +971,7 @@ static int tegra_emc_probe(struct platform_device *pdev)
tegra_emc_table = table;
+ adjust_emc_dvfs_table(tegra_emc_table, tegra_emc_table_size);
mv = tegra_dvfs_predict_millivolts(emc, max_rate * 1000);
if ((mv <= 0) || (mv > emc->dvfs->max_millivolts)) {
tegra_emc_table = NULL;