diff options
author | Scott Williams <scwilliams@nvidia.com> | 2011-08-05 18:16:48 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:47:03 -0800 |
commit | 4b848adaedc9e0c335b992fefefc16545a0ca7b1 (patch) | |
tree | 5cb52fb00add02a4fa666da3555c4e47ab765602 /arch/arm/mach-tegra/clock.c | |
parent | 4182b75abce8204b13a783dd2f14d4aa63e58aaf (diff) |
ARM: tegra: Fix mutex in atomic context when updating TWD freq
The CPU frequency change notifer runs in an atomic context but
obtaining the current CPU frequency requires taking a mutex because
updating the CPU frequency involves the regulator. Instead of
directly parenting the TWD clock on the CPU clock, make the TWD
a "detached child" of the CPU clock whose rate is updated whenever
the CPU frequency changes.
Change-Id: I49e15f85f269fb3ed0bcaee36ff739b4f064d6b8
Signed-off-by: Scott Williams <scwilliams@nvidia.com>
Rebase-Id: R7aa10f2576752390464586bc629c972802beb989
Diffstat (limited to 'arch/arm/mach-tegra/clock.c')
-rw-r--r-- | arch/arm/mach-tegra/clock.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index 7ed1823fe089..65d92e1bca1a 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -645,8 +645,23 @@ void __init tegra_init_max_rate(struct clk *c, unsigned long max_rate) void __init tegra_init_clock(void) { + int ret; + struct clk *cpu; + struct clk *twd; + tegra_soc_init_clocks(); tegra_soc_init_dvfs(); + + /* The twd clock is a detached child of the CPU complex clock. + Force an update of the twd clock after DVFS as updated the + CPU clock rate. */ + cpu = tegra_get_clock_by_name("cpu"); + twd = tegra_get_clock_by_name("twd"); + ret = clk_set_rate(twd, clk_get_rate(cpu)); + if (ret) + pr_err("Failed to set twd clock rate: %d\n", ret); + else + pr_debug("TWD clock rate: %ld\n", clk_get_rate(twd)); } #ifdef CONFIG_ARCH_TEGRA_2x_SOC |