aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/dpll44xx.c
diff options
context:
space:
mode:
authorMike Turquette <mturquette@linaro.org>2012-11-10 18:58:41 -0500
committerPaul Walmsley <paul@pwsan.com>2012-11-12 15:55:50 -0500
commit32cc002116b866151ca24c6e9110ba8a93754753 (patch)
tree4a7d3f08bf774ed72d37bd0de541d9dac5e3083e /arch/arm/mach-omap2/dpll44xx.c
parentf5dd3bb53ca45f3b47c6889e5920c562f5a37359 (diff)
ARM: OMAP4: clock: Convert to common clk
Convert all OMAP4 specific platform files to use COMMON clk and keep all the changes under the CONFIG_COMMON_CLK macro check so it does not break any existing code. At a later point switch to COMMON clk and get rid of all old/legacy code. This converts all apis which will be called directly from COMMON clk to take a struct clk_hw parameter, and all the internal platform apis to take a struct clk_hw_omap parameter. Changes are based off the original patch from Mike Turquette. Signed-off-by: Rajendra Nayak <rnayak@ti.com> [paul@pwsan.com: created new omap2_clksel_find_parent_index() rather than modifying omap2_init_clksel_parent(); moved clkhwops_iclk_wait to clkt_iclk.c to fix OMAP4-only builds; added clk-provider.h include to clock.h to try to fix some 3430-builds] [mturquette@ti.com: squash patch for omap2_clkops_{en,dis}able_clkdm; omap2_dflt_clk_is_enabled should not enable clocks] Signed-off-by: Mike Turquette <mturquette@ti.com> [paul@pwsan.com: fix compiler warning; update to apply; added kerneldoc on non-trivial new functions; added the dpll3xxx clockdomain modifications] Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/dpll44xx.c')
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index 5854da168a9c..aa75a3c10026 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -21,7 +21,11 @@
21#include "cm-regbits-44xx.h" 21#include "cm-regbits-44xx.h"
22 22
23/* Supported only on OMAP4 */ 23/* Supported only on OMAP4 */
24#ifdef CONFIG_COMMON_CLK
25int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk)
26#else
24int omap4_dpllmx_gatectrl_read(struct clk *clk) 27int omap4_dpllmx_gatectrl_read(struct clk *clk)
28#endif
25{ 29{
26 u32 v; 30 u32 v;
27 u32 mask; 31 u32 mask;
@@ -40,7 +44,11 @@ int omap4_dpllmx_gatectrl_read(struct clk *clk)
40 return v; 44 return v;
41} 45}
42 46
47#ifdef CONFIG_COMMON_CLK
48void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk)
49#else
43void omap4_dpllmx_allow_gatectrl(struct clk *clk) 50void omap4_dpllmx_allow_gatectrl(struct clk *clk)
51#endif
44{ 52{
45 u32 v; 53 u32 v;
46 u32 mask; 54 u32 mask;
@@ -58,7 +66,11 @@ void omap4_dpllmx_allow_gatectrl(struct clk *clk)
58 __raw_writel(v, clk->clksel_reg); 66 __raw_writel(v, clk->clksel_reg);
59} 67}
60 68
69#ifdef CONFIG_COMMON_CLK
70void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
71#else
61void omap4_dpllmx_deny_gatectrl(struct clk *clk) 72void omap4_dpllmx_deny_gatectrl(struct clk *clk)
73#endif
62{ 74{
63 u32 v; 75 u32 v;
64 u32 mask; 76 u32 mask;
@@ -76,10 +88,17 @@ void omap4_dpllmx_deny_gatectrl(struct clk *clk)
76 __raw_writel(v, clk->clksel_reg); 88 __raw_writel(v, clk->clksel_reg);
77} 89}
78 90
91#ifdef CONFIG_COMMON_CLK
92const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = {
93 .allow_idle = omap4_dpllmx_allow_gatectrl,
94 .deny_idle = omap4_dpllmx_deny_gatectrl,
95};
96#else
79const struct clkops clkops_omap4_dpllmx_ops = { 97const struct clkops clkops_omap4_dpllmx_ops = {
80 .allow_idle = omap4_dpllmx_allow_gatectrl, 98 .allow_idle = omap4_dpllmx_allow_gatectrl,
81 .deny_idle = omap4_dpllmx_deny_gatectrl, 99 .deny_idle = omap4_dpllmx_deny_gatectrl,
82}; 100};
101#endif
83 102
84/** 103/**
85 * omap4_dpll_regm4xen_recalc - compute DPLL rate, considering REGM4XEN bit 104 * omap4_dpll_regm4xen_recalc - compute DPLL rate, considering REGM4XEN bit
@@ -90,8 +109,15 @@ const struct clkops clkops_omap4_dpllmx_ops = {
90 * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers) 109 * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers)
91 * upon success, or 0 upon error. 110 * upon success, or 0 upon error.
92 */ 111 */
112#ifdef CONFIG_COMMON_CLK
113unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
114 unsigned long parent_rate)
115{
116 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
117#else
93unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk) 118unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk)
94{ 119{
120#endif
95 u32 v; 121 u32 v;
96 unsigned long rate; 122 unsigned long rate;
97 struct dpll_data *dd; 123 struct dpll_data *dd;
@@ -123,8 +149,16 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk)
123 * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or 149 * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or
124 * ~0 if an error occurred in omap2_dpll_round_rate(). 150 * ~0 if an error occurred in omap2_dpll_round_rate().
125 */ 151 */
152#ifdef CONFIG_COMMON_CLK
153long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
154 unsigned long target_rate,
155 unsigned long *parent_rate)
156{
157 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
158#else
126long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate) 159long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate)
127{ 160{
161#endif
128 u32 v; 162 u32 v;
129 struct dpll_data *dd; 163 struct dpll_data *dd;
130 long r; 164 long r;
@@ -140,7 +174,11 @@ long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate)
140 if (v) 174 if (v)
141 target_rate = target_rate / OMAP4430_REGM4XEN_MULT; 175 target_rate = target_rate / OMAP4430_REGM4XEN_MULT;
142 176
177#ifdef CONFIG_COMMON_CLK
178 r = omap2_dpll_round_rate(hw, target_rate, NULL);
179#else
143 r = omap2_dpll_round_rate(clk, target_rate); 180 r = omap2_dpll_round_rate(clk, target_rate);
181#endif
144 if (r == ~0) 182 if (r == ~0)
145 return r; 183 return r;
146 184