diff options
author | Prashant Gaikwad <pgaikwad@nvidia.com> | 2012-09-13 15:04:33 +0530 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2012-09-13 11:34:29 -0600 |
commit | b4350f40f73b75efdceae3d9e04266979acabd8c (patch) | |
tree | c2d470788d873f102733dad363f973e8ae8c9216 /arch/arm/mach-tegra/tegra20_clocks.c | |
parent | ce32ddaa7087da7c9d43751db423281711a1ff2e (diff) | |
download | talos-obmc-linux-b4350f40f73b75efdceae3d9e04266979acabd8c.tar.gz talos-obmc-linux-b4350f40f73b75efdceae3d9e04266979acabd8c.zip |
ARM: Tegra: Add smp_twd clock for Tegra20
Clockevent's frequency is changed upon cpufreq change
notification. It fetches local timer's rate to update the
clockevent frequency. This patch adds local timer clock
for Tegra20.
Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra20_clocks.c')
-rw-r--r-- | arch/arm/mach-tegra/tegra20_clocks.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/tegra20_clocks.c b/arch/arm/mach-tegra/tegra20_clocks.c index d9ce0087f6a6..840ab262272a 100644 --- a/arch/arm/mach-tegra/tegra20_clocks.c +++ b/arch/arm/mach-tegra/tegra20_clocks.c @@ -376,6 +376,25 @@ struct clk_ops tegra_super_ops = { .recalc_rate = tegra20_super_clk_recalc_rate, }; +static unsigned long tegra20_twd_clk_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct clk_tegra *c = to_clk_tegra(hw); + u64 rate = parent_rate; + + if (c->mul != 0 && c->div != 0) { + rate *= c->mul; + rate += c->div - 1; /* round up */ + do_div(rate, c->div); + } + + return rate; +} + +struct clk_ops tegra_twd_ops = { + .recalc_rate = tegra20_twd_clk_recalc_rate, +}; + static u8 tegra20_cop_clk_get_parent(struct clk_hw *hw) { return 0; |