aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2015-03-03 09:22:50 -0500
committerTero Kristo <t-kristo@ti.com>2015-06-02 05:31:30 -0400
commitbd86cfdcbd827216fd682d62ffba2667bbe6fbc3 (patch)
treeb2263cdf232240a9d9ddbbb3139dd27423751a60
parentd5a04dddf51e234dc89f21e4e4b91e853cf49ff2 (diff)
clk: ti: clkdm: move clkdm gate clock support code to clock driver
With the legacy clock data gone, this is no longer needed under platform, so move it under the clock driver itself. Remove the exported clock driver APIs as well, as these are not needed outside clock driver anymore. Signed-off-by: Tero Kristo <t-kristo@ti.com>
-rw-r--r--arch/arm/mach-omap2/clock.c76
-rw-r--r--arch/arm/mach-omap2/clock.h3
-rw-r--r--drivers/clk/ti/clock.h3
-rw-r--r--drivers/clk/ti/clockdomain.c76
-rw-r--r--include/linux/clk/ti.h2
5 files changed, 79 insertions, 81 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 38a336b4c42b..99875dba803a 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -202,82 +202,6 @@ void omap2_init_clk_clkdm(struct clk_hw *hw)
202 } 202 }
203} 203}
204 204
205/**
206 * omap2_clkops_enable_clkdm - increment usecount on clkdm of @hw
207 * @hw: struct clk_hw * of the clock being enabled
208 *
209 * Increment the usecount of the clockdomain of the clock pointed to
210 * by @hw; if the usecount is 1, the clockdomain will be "enabled."
211 * Only needed for clocks that don't use omap2_dflt_clk_enable() as
212 * their enable function pointer. Passes along the return value of
213 * clkdm_clk_enable(), -EINVAL if @hw is not associated with a
214 * clockdomain, or 0 if clock framework-based clockdomain control is
215 * not implemented.
216 */
217int omap2_clkops_enable_clkdm(struct clk_hw *hw)
218{
219 struct clk_hw_omap *clk;
220 int ret = 0;
221
222 clk = to_clk_hw_omap(hw);
223
224 if (unlikely(!clk->clkdm)) {
225 pr_err("%s: %s: no clkdm set ?!\n", __func__,
226 __clk_get_name(hw->clk));
227 return -EINVAL;
228 }
229
230 if (unlikely(clk->enable_reg))
231 pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__,
232 __clk_get_name(hw->clk));
233
234 if (ti_clk_get_features()->flags & TI_CLK_DISABLE_CLKDM_CONTROL) {
235 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
236 __func__, __clk_get_name(hw->clk));
237 return 0;
238 }
239
240 ret = clkdm_clk_enable(clk->clkdm, hw->clk);
241 WARN(ret, "%s: could not enable %s's clockdomain %s: %d\n",
242 __func__, __clk_get_name(hw->clk), clk->clkdm->name, ret);
243
244 return ret;
245}
246
247/**
248 * omap2_clkops_disable_clkdm - decrement usecount on clkdm of @hw
249 * @hw: struct clk_hw * of the clock being disabled
250 *
251 * Decrement the usecount of the clockdomain of the clock pointed to
252 * by @hw; if the usecount is 0, the clockdomain will be "disabled."
253 * Only needed for clocks that don't use omap2_dflt_clk_disable() as their
254 * disable function pointer. No return value.
255 */
256void omap2_clkops_disable_clkdm(struct clk_hw *hw)
257{
258 struct clk_hw_omap *clk;
259
260 clk = to_clk_hw_omap(hw);
261
262 if (unlikely(!clk->clkdm)) {
263 pr_err("%s: %s: no clkdm set ?!\n", __func__,
264 __clk_get_name(hw->clk));
265 return;
266 }
267
268 if (unlikely(clk->enable_reg))
269 pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__,
270 __clk_get_name(hw->clk));
271
272 if (ti_clk_get_features()->flags & TI_CLK_DISABLE_CLKDM_CONTROL) {
273 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
274 __func__, __clk_get_name(hw->clk));
275 return;
276 }
277
278 clkdm_clk_disable(clk->clkdm, hw->clk);
279}
280
281static int __initdata mpurate; 205static int __initdata mpurate;
282 206
283/* 207/*
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 948065497472..a7e951129ffb 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -202,9 +202,6 @@ extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait;
202extern const struct clk_hw_omap_ops clkhwops_apll54; 202extern const struct clk_hw_omap_ops clkhwops_apll54;
203extern const struct clk_hw_omap_ops clkhwops_apll96; 203extern const struct clk_hw_omap_ops clkhwops_apll96;
204 204
205extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);
206extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);
207
208struct regmap; 205struct regmap;
209 206
210int __init omap2_clk_provider_init(struct device_node *np, int index, 207int __init omap2_clk_provider_init(struct device_node *np, int index,
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
index 3652c267cf81..83476d12d561 100644
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -180,6 +180,9 @@ extern const struct clk_hw_omap_ops clkhwops_iclk;
180extern const struct clk_hw_omap_ops clkhwops_iclk_wait; 180extern const struct clk_hw_omap_ops clkhwops_iclk_wait;
181extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait; 181extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
182 182
183int omap2_clkops_enable_clkdm(struct clk_hw *hw);
184void omap2_clkops_disable_clkdm(struct clk_hw *hw);
185
183int omap2_dflt_clk_enable(struct clk_hw *hw); 186int omap2_dflt_clk_enable(struct clk_hw *hw);
184void omap2_dflt_clk_disable(struct clk_hw *hw); 187void omap2_dflt_clk_disable(struct clk_hw *hw);
185int omap2_dflt_clk_is_enabled(struct clk_hw *hw); 188int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c
index 35fe1085480c..61ef87b1a688 100644
--- a/drivers/clk/ti/clockdomain.c
+++ b/drivers/clk/ti/clockdomain.c
@@ -24,6 +24,82 @@
24#undef pr_fmt 24#undef pr_fmt
25#define pr_fmt(fmt) "%s: " fmt, __func__ 25#define pr_fmt(fmt) "%s: " fmt, __func__
26 26
27/**
28 * omap2_clkops_enable_clkdm - increment usecount on clkdm of @hw
29 * @hw: struct clk_hw * of the clock being enabled
30 *
31 * Increment the usecount of the clockdomain of the clock pointed to
32 * by @hw; if the usecount is 1, the clockdomain will be "enabled."
33 * Only needed for clocks that don't use omap2_dflt_clk_enable() as
34 * their enable function pointer. Passes along the return value of
35 * clkdm_clk_enable(), -EINVAL if @hw is not associated with a
36 * clockdomain, or 0 if clock framework-based clockdomain control is
37 * not implemented.
38 */
39int omap2_clkops_enable_clkdm(struct clk_hw *hw)
40{
41 struct clk_hw_omap *clk;
42 int ret = 0;
43
44 clk = to_clk_hw_omap(hw);
45
46 if (unlikely(!clk->clkdm)) {
47 pr_err("%s: %s: no clkdm set ?!\n", __func__,
48 __clk_get_name(hw->clk));
49 return -EINVAL;
50 }
51
52 if (unlikely(clk->enable_reg))
53 pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__,
54 __clk_get_name(hw->clk));
55
56 if (ti_clk_get_features()->flags & TI_CLK_DISABLE_CLKDM_CONTROL) {
57 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
58 __func__, __clk_get_name(hw->clk));
59 return 0;
60 }
61
62 ret = ti_clk_ll_ops->clkdm_clk_enable(clk->clkdm, hw->clk);
63 WARN(ret, "%s: could not enable %s's clockdomain %s: %d\n",
64 __func__, __clk_get_name(hw->clk), clk->clkdm_name, ret);
65
66 return ret;
67}
68
69/**
70 * omap2_clkops_disable_clkdm - decrement usecount on clkdm of @hw
71 * @hw: struct clk_hw * of the clock being disabled
72 *
73 * Decrement the usecount of the clockdomain of the clock pointed to
74 * by @hw; if the usecount is 0, the clockdomain will be "disabled."
75 * Only needed for clocks that don't use omap2_dflt_clk_disable() as their
76 * disable function pointer. No return value.
77 */
78void omap2_clkops_disable_clkdm(struct clk_hw *hw)
79{
80 struct clk_hw_omap *clk;
81
82 clk = to_clk_hw_omap(hw);
83
84 if (unlikely(!clk->clkdm)) {
85 pr_err("%s: %s: no clkdm set ?!\n", __func__,
86 __clk_get_name(hw->clk));
87 return;
88 }
89
90 if (unlikely(clk->enable_reg))
91 pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__,
92 __clk_get_name(hw->clk));
93
94 if (ti_clk_get_features()->flags & TI_CLK_DISABLE_CLKDM_CONTROL) {
95 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
96 __func__, __clk_get_name(hw->clk));
97 return;
98 }
99
100 ti_clk_ll_ops->clkdm_clk_disable(clk->clkdm, hw->clk);
101}
102
27static void __init of_ti_clockdomain_setup(struct device_node *node) 103static void __init of_ti_clockdomain_setup(struct device_node *node)
28{ 104{
29 struct clk *clk; 105 struct clk *clk;
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index 440ace33ea35..27828422c9c5 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -272,8 +272,6 @@ extern const struct clk_ops ti_clk_mux_ops;
272#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw) 272#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
273 273
274void omap2_init_clk_clkdm(struct clk_hw *clk); 274void omap2_init_clk_clkdm(struct clk_hw *clk);
275int omap2_clkops_enable_clkdm(struct clk_hw *hw);
276void omap2_clkops_disable_clkdm(struct clk_hw *hw);
277int omap2_clk_disable_autoidle_all(void); 275int omap2_clk_disable_autoidle_all(void);
278int omap2_clk_enable_autoidle_all(void); 276int omap2_clk_enable_autoidle_all(void);
279int omap2_clk_allow_idle(struct clk *clk); 277int omap2_clk_allow_idle(struct clk *clk);