Thread (42 messages) 42 messages, 5 authors, 2012-05-03
STALE5165d

[PATCH V3 6/8] SPEAr: clk: Add General Purpose Timer Synthesizer clock

From: Viresh Kumar <hidden>
Date: 2012-04-27 04:46:17
Subsystem: common clk framework, spear platform/clock/pinctrl support, the rest · Maintainers: Michael Turquette, Stephen Boyd, Viresh Kumar, Linus Torvalds

On 4/24/2012 12:20 PM, Viresh KUMAR wrote:
All SPEAr SoC's contain GPT Synthesizers. Their Fout is derived from
following equations:

Fout= Fin/((2 ^ (N+1)) * (M+1))

This patch adds in support for this type of clock.
    fixup! SPEAr: clk: Add General Purpose Timer Synthesizer clock
---
 drivers/clk/spear/clk-gpt-synth.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/spear/clk-gpt-synth.c b/drivers/clk/spear/clk-gpt-synth.c
index 514539c..f3b252a 100644
--- a/drivers/clk/spear/clk-gpt-synth.c
+++ b/drivers/clk/spear/clk-gpt-synth.c
@@ -46,10 +46,11 @@ static long clk_gpt_round_rate(struct clk_hw *hw, unsigned long drate,
                unsigned long *prate)
 {
        struct clk_gpt *gpt = to_clk_gpt(hw);
+       unsigned long parent_rate = __clk_get_rate(__clk_get_parent(hw->clk));
        int unused;
 
-       return clk_round_rate_index(hw, drate, gpt_calc_rate, gpt->rtbl_cnt,
-                       &unused);
+       return clk_round_rate_index(hw, drate, parent_rate, gpt_calc_rate,
+                       gpt->rtbl_cnt, &unused);
 }
 
 static unsigned long clk_gpt_recalc_rate(struct clk_hw *hw,
@@ -77,14 +78,16 @@ static unsigned long clk_gpt_recalc_rate(struct clk_hw *hw,
 }
 
 /* Configures new clock rate of gpt */
-static int clk_gpt_set_rate(struct clk_hw *hw, unsigned long drate)
+static int clk_gpt_set_rate(struct clk_hw *hw, unsigned long drate,
+                               unsigned long prate)
 {
        struct clk_gpt *gpt = to_clk_gpt(hw);
        struct gpt_rate_tbl *rtbl = gpt->rtbl;
        unsigned long flags = 0, val;
        int i;
 
-       clk_round_rate_index(hw, drate, gpt_calc_rate, gpt->rtbl_cnt, &i);
+       clk_round_rate_index(hw, drate, prate, gpt_calc_rate, gpt->rtbl_cnt,
+                       &i);
 
        if (gpt->lock)
                spin_lock_irqsave(gpt->lock, flags);
-- 
viresh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help