diff options
author | Alex Frid <afrid@nvidia.com> | 2013-01-25 00:05:20 -0800 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2013-01-30 12:03:03 -0800 |
commit | d6f3ddb423827893ea586c5668a56ead5deb87d2 (patch) | |
tree | 471176d2d35361162295cef4e277478b5fda8a2b /arch/arm/mach-tegra/tegra11_emc.c | |
parent | dc279fea5da1dbd25682d02ef25fa3c50b1e08e4 (diff) |
ARM: tegra11: clock: Force out-of-table shared bus max limit
So far, rate cap set by shared bus user with SHARED_CEILING attribute
was not clipped to possible bus rates. Since final rounding on shared
bus is always in up direction, bus clock could run at rate above the
ceiling that does not exactly match one of available bus rates. This
is fixed now by rounding cap rate down to possible bus rate before
final shared rate is determined.
Change-Id: If1052b657b60f9a6e07b730f8a8c0f36b17fdbdd
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/194845
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra11_emc.c')
-rw-r--r-- | arch/arm/mach-tegra/tegra11_emc.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/arm/mach-tegra/tegra11_emc.c b/arch/arm/mach-tegra/tegra11_emc.c index 41f93a2a6cde..6ab9385c982e 100644 --- a/arch/arm/mach-tegra/tegra11_emc.c +++ b/arch/arm/mach-tegra/tegra11_emc.c @@ -738,9 +738,10 @@ int tegra_emc_set_rate(unsigned long rate) return 0; } -long tegra_emc_round_rate(unsigned long rate) +long tegra_emc_round_rate_updown(unsigned long rate, bool up) { int i; + unsigned long table_rate; if (!tegra_emc_table) return clk_get_rate_locked(emc); /* no table - no rate change */ @@ -758,11 +759,15 @@ long tegra_emc_round_rate(unsigned long rate) if (tegra_emc_clk_sel[i].input == NULL) continue; /* invalid entry */ - if (tegra_emc_table[i].rate >= rate) { - pr_debug("%s: using %lu\n", - __func__, tegra_emc_table[i].rate); + table_rate = tegra_emc_table[i].rate; + if (table_rate >= rate) { + if (!up && i && (table_rate > rate)) { + i--; + table_rate = tegra_emc_table[i].rate; + } + pr_debug("%s: using %lu\n", __func__, table_rate); last_round_idx = i; - return tegra_emc_table[i].rate * 1000; + return table_rate * 1000; } } |