Commit Graph

9 Commits

Author SHA1 Message Date
Wei Yongjun 74fc23aa40 clk: mmp: fix sparse non static symbol warning
Fixes the following sparse warnings:

drivers/clk/mmp/clk-frac.c:113:6: warning:
 symbol 'clk_factor_init' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2014-12-11 12:14:09 -08:00
Chao Xie 3a2b2f8495 clk: mmp: move definiton of mmp_clk_frac to clk.h
Move the definition of structure of mmp_clk_frac to
clk.h.
So device tree support can use this structure.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2014-11-12 16:33:48 -08:00
Chao Xie 0c4c11f355 clk: mmp: add init callback for clk-frac
For the clk-frac, we need to make sure that the initial
clock rate is one item of the table.
If it is not, we use the first item in the table by default.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2014-11-12 16:33:43 -08:00
Chao Xie 6125613391 clk: mmp: add spin lock for clk-frac
The register used by clk-frac may be shared with
other clocks.
So it needs to use spin lock to protect the register
access.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2014-11-12 16:33:37 -08:00
Chao Xie 2bd1e256e4 clk: mmp: add prefix "mmp" for structures defined for clk-frac
The structures defined for clk-frac will be used out side
of clk-frac.c.
To avoid conflicts, add prefix "mmp" for these structures'
name.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2014-11-12 16:33:22 -08:00
Chao Xie 5d26c15d3b clk: mmp: try to use closer one when do round rate
The orignal code will use the bigger rate between
"previous rate" and "current rate" when caculate the
rate.
In fact, hardware cares about the closest one.
So choose the closer rate between "previous rate" and
"current rate".

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
2014-03-26 20:59:27 -07:00
Chao Xie c45693a648 clk: mmp: fix the wrong calculation formula
The formula is numerator/denominator = Fin / (Fout * factor)
So
Fout = Fin * denominator / (numerator * factor).
Current clk_factor_round_rate and clk_factor_recalc_rate use
wrong formula. This patch will fix them.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
2014-03-26 20:59:27 -07:00
Chao Xie 7433ab43fa clk: mmp: fix wrong mask when calculate denominator
The code has typo when calculate denominator. It should use
den_mask instead of num_mask.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
2014-03-26 20:59:26 -07:00
Chao Xie 6b63f02318 clk: mmp: add mmp specific clocks
add mmp specific clocks including apbc cloks, apmu clocks,
and pll2, fraction clocks

Signed-off-by: Chao Xie <xiechao.mail@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
2012-08-28 14:14:14 -07:00