diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/clock.c | 88 |
1 files changed, 46 insertions, 42 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index d3ebb74873f8..0d54fde5b455 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -42,6 +42,51 @@ u8 cpu_mask; | |||
42 | * OMAP2/3/4 specific clock functions | 42 | * OMAP2/3/4 specific clock functions |
43 | *-------------------------------------------------------------------------*/ | 43 | *-------------------------------------------------------------------------*/ |
44 | 44 | ||
45 | /* Private functions */ | ||
46 | |||
47 | /** | ||
48 | * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE | ||
49 | * @clk: struct clk * belonging to the module | ||
50 | * | ||
51 | * If the necessary clocks for the OMAP hardware IP block that | ||
52 | * corresponds to clock @clk are enabled, then wait for the module to | ||
53 | * indicate readiness (i.e., to leave IDLE). This code does not | ||
54 | * belong in the clock code and will be moved in the medium term to | ||
55 | * module-dependent code. No return value. | ||
56 | */ | ||
57 | static void _omap2_module_wait_ready(struct clk *clk) | ||
58 | { | ||
59 | void __iomem *companion_reg, *idlest_reg; | ||
60 | u8 other_bit, idlest_bit; | ||
61 | |||
62 | /* Not all modules have multiple clocks that their IDLEST depends on */ | ||
63 | if (clk->ops->find_companion) { | ||
64 | clk->ops->find_companion(clk, &companion_reg, &other_bit); | ||
65 | if (!(__raw_readl(companion_reg) & (1 << other_bit))) | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit); | ||
70 | |||
71 | omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), clk->name); | ||
72 | } | ||
73 | |||
74 | /* Enables clock without considering parent dependencies or use count | ||
75 | * REVISIT: Maybe change this to use clk->enable like on omap1? | ||
76 | */ | ||
77 | static int _omap2_clk_enable(struct clk *clk) | ||
78 | { | ||
79 | return clk->ops->enable(clk); | ||
80 | } | ||
81 | |||
82 | /* Disables clock without considering parent dependencies or use count */ | ||
83 | static void _omap2_clk_disable(struct clk *clk) | ||
84 | { | ||
85 | clk->ops->disable(clk); | ||
86 | } | ||
87 | |||
88 | /* Public functions */ | ||
89 | |||
45 | /** | 90 | /** |
46 | * omap2xxx_clk_commit - commit clock parent/rate changes in hardware | 91 | * omap2xxx_clk_commit - commit clock parent/rate changes in hardware |
47 | * @clk: struct clk * | 92 | * @clk: struct clk * |
@@ -149,33 +194,6 @@ void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, | |||
149 | *idlest_bit = clk->enable_bit; | 194 | *idlest_bit = clk->enable_bit; |
150 | } | 195 | } |
151 | 196 | ||
152 | /** | ||
153 | * omap2_module_wait_ready - wait for an OMAP module to leave IDLE | ||
154 | * @clk: struct clk * belonging to the module | ||
155 | * | ||
156 | * If the necessary clocks for the OMAP hardware IP block that | ||
157 | * corresponds to clock @clk are enabled, then wait for the module to | ||
158 | * indicate readiness (i.e., to leave IDLE). This code does not | ||
159 | * belong in the clock code and will be moved in the medium term to | ||
160 | * module-dependent code. No return value. | ||
161 | */ | ||
162 | static void omap2_module_wait_ready(struct clk *clk) | ||
163 | { | ||
164 | void __iomem *companion_reg, *idlest_reg; | ||
165 | u8 other_bit, idlest_bit; | ||
166 | |||
167 | /* Not all modules have multiple clocks that their IDLEST depends on */ | ||
168 | if (clk->ops->find_companion) { | ||
169 | clk->ops->find_companion(clk, &companion_reg, &other_bit); | ||
170 | if (!(__raw_readl(companion_reg) & (1 << other_bit))) | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit); | ||
175 | |||
176 | omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), clk->name); | ||
177 | } | ||
178 | |||
179 | int omap2_dflt_clk_enable(struct clk *clk) | 197 | int omap2_dflt_clk_enable(struct clk *clk) |
180 | { | 198 | { |
181 | u32 v; | 199 | u32 v; |
@@ -195,7 +213,7 @@ int omap2_dflt_clk_enable(struct clk *clk) | |||
195 | v = __raw_readl(clk->enable_reg); /* OCP barrier */ | 213 | v = __raw_readl(clk->enable_reg); /* OCP barrier */ |
196 | 214 | ||
197 | if (clk->ops->find_idlest) | 215 | if (clk->ops->find_idlest) |
198 | omap2_module_wait_ready(clk); | 216 | _omap2_module_wait_ready(clk); |
199 | 217 | ||
200 | return 0; | 218 | return 0; |
201 | } | 219 | } |
@@ -235,20 +253,6 @@ const struct clkops clkops_omap2_dflt = { | |||
235 | .disable = omap2_dflt_clk_disable, | 253 | .disable = omap2_dflt_clk_disable, |
236 | }; | 254 | }; |
237 | 255 | ||
238 | /* Enables clock without considering parent dependencies or use count | ||
239 | * REVISIT: Maybe change this to use clk->enable like on omap1? | ||
240 | */ | ||
241 | static int _omap2_clk_enable(struct clk *clk) | ||
242 | { | ||
243 | return clk->ops->enable(clk); | ||
244 | } | ||
245 | |||
246 | /* Disables clock without considering parent dependencies or use count */ | ||
247 | static void _omap2_clk_disable(struct clk *clk) | ||
248 | { | ||
249 | clk->ops->disable(clk); | ||
250 | } | ||
251 | |||
252 | void omap2_clk_disable(struct clk *clk) | 256 | void omap2_clk_disable(struct clk *clk) |
253 | { | 257 | { |
254 | if (clk->usecount > 0 && !(--clk->usecount)) { | 258 | if (clk->usecount > 0 && !(--clk->usecount)) { |