Thread (42 messages) 42 messages, 5 authors, 2012-05-03
STALE5169d
Revisions (5)
  1. v1 [diff vs current]
  2. v3 [diff vs current]
  3. v3 [diff vs current]
  4. v3 current
  5. v3 [diff vs current]

[PATCH V3 5/8] SPEAr: clk: Add Fractional Synthesizer clock

From: Viresh Kumar <hidden>
Date: 2012-05-03 05:46:53
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 Fractional Synthesizers. Their Fout is derived from
following equations:

Fout = Fin / (2 * div) (division factor)
div is 17 bits:-
     0-13 (fractional part)
     14-16 (integer part)
     div is (16-14 bits).(13-0 bits) (in binary)

     Fout = Fin/(2 * div)
     Fout = ((Fin / 10000)/(2 * div)) * 10000
     Fout = (2^14 * (Fin / 10000)/(2^14 * (2 * div))) * 10000
     Fout = (((Fin / 10000) << 14)/(2 * (div << 14))) * 10000

div << 14 is simply 17 bit value written@register.

This patch adds in support for this type of clock.

Signed-off-by: Viresh Kumar <redacted>
Another fixup:

---
 drivers/clk/spear/clk-frac-synth.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/spear/clk-frac-synth.c b/drivers/clk/spear/clk-frac-synth.c
index b2090f8..9915dbc 100644
--- a/drivers/clk/spear/clk-frac-synth.c
+++ b/drivers/clk/spear/clk-frac-synth.c
@@ -59,10 +59,9 @@ static long clk_frac_round_rate(struct clk_hw *hw, unsigned long drate,
                unsigned long *prate)
 {
        struct clk_frac *frac = to_clk_frac(hw);
-       unsigned long parent_rate = __clk_get_rate(__clk_get_parent(hw->clk));
        int unused;
 
-       return clk_round_rate_index(hw, drate, parent_rate, frac_calc_rate,
+       return clk_round_rate_index(hw, drate, *prate, frac_calc_rate,
                        frac->rtbl_cnt, &unused);
 }
 
-- 
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