summaryrefslogtreecommitdiffstats
path: root/drivers/clk/ti
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk/ti')
-rw-r--r--drivers/clk/ti/autoidle.c8
-rw-r--r--drivers/clk/ti/clkt_dpll.c11
-rw-r--r--drivers/clk/ti/clock.h2
-rw-r--r--drivers/clk/ti/divider.c6
-rw-r--r--drivers/clk/ti/dpll3xxx.c31
-rw-r--r--drivers/clk/ti/dpll44xx.c4
-rw-r--r--drivers/clk/ti/gate.c6
7 files changed, 33 insertions, 35 deletions
diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c
index 527f2c6dd0aa..345af43465f0 100644
--- a/drivers/clk/ti/autoidle.c
+++ b/drivers/clk/ti/autoidle.c
@@ -169,21 +169,21 @@ int __init of_ti_clk_autoidle_setup(struct device_node *node)
169 169
170/** 170/**
171 * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock 171 * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
172 * @clk: struct clk * to initialize 172 * @hw: struct clk_hw * to initialize
173 * 173 *
174 * Add an OMAP clock @clk to the internal list of OMAP clocks. Used 174 * Add an OMAP clock @clk to the internal list of OMAP clocks. Used
175 * temporarily for autoidle handling, until this support can be 175 * temporarily for autoidle handling, until this support can be
176 * integrated into the common clock framework code in some way. No 176 * integrated into the common clock framework code in some way. No
177 * return value. 177 * return value.
178 */ 178 */
179void omap2_init_clk_hw_omap_clocks(struct clk *clk) 179void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw)
180{ 180{
181 struct clk_hw_omap *c; 181 struct clk_hw_omap *c;
182 182
183 if (__clk_get_flags(clk) & CLK_IS_BASIC) 183 if (clk_hw_get_flags(hw) & CLK_IS_BASIC)
184 return; 184 return;
185 185
186 c = to_clk_hw_omap(__clk_get_hw(clk)); 186 c = to_clk_hw_omap(hw);
187 list_add(&c->node, &clk_hw_omap_clocks); 187 list_add(&c->node, &clk_hw_omap_clocks);
188} 188}
189 189
diff --git a/drivers/clk/ti/clkt_dpll.c b/drivers/clk/ti/clkt_dpll.c
index a01fc7f305c1..9023ca9caf84 100644
--- a/drivers/clk/ti/clkt_dpll.c
+++ b/drivers/clk/ti/clkt_dpll.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/clk.h>
19#include <linux/clk-provider.h> 20#include <linux/clk-provider.h>
20#include <linux/io.h> 21#include <linux/io.h>
21#include <linux/clk/ti.h> 22#include <linux/clk/ti.h>
@@ -75,7 +76,7 @@ static int _dpll_test_fint(struct clk_hw_omap *clk, unsigned int n)
75 dd = clk->dpll_data; 76 dd = clk->dpll_data;
76 77
77 /* DPLL divider must result in a valid jitter correction val */ 78 /* DPLL divider must result in a valid jitter correction val */
78 fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n; 79 fint = clk_hw_get_rate(clk_hw_get_parent(&clk->hw)) / n;
79 80
80 if (dd->flags & DPLL_J_TYPE) { 81 if (dd->flags & DPLL_J_TYPE) {
81 fint_min = OMAP3PLUS_DPLL_FINT_JTYPE_MIN; 82 fint_min = OMAP3PLUS_DPLL_FINT_JTYPE_MIN;
@@ -253,7 +254,7 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
253 v >>= __ffs(dd->enable_mask); 254 v >>= __ffs(dd->enable_mask);
254 255
255 if (_omap2_dpll_is_in_bypass(v)) 256 if (_omap2_dpll_is_in_bypass(v))
256 return __clk_get_rate(dd->clk_bypass); 257 return clk_get_rate(dd->clk_bypass);
257 258
258 v = ti_clk_ll_ops->clk_readl(dd->mult_div1_reg); 259 v = ti_clk_ll_ops->clk_readl(dd->mult_div1_reg);
259 dpll_mult = v & dd->mult_mask; 260 dpll_mult = v & dd->mult_mask;
@@ -261,7 +262,7 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
261 dpll_div = v & dd->div1_mask; 262 dpll_div = v & dd->div1_mask;
262 dpll_div >>= __ffs(dd->div1_mask); 263 dpll_div >>= __ffs(dd->div1_mask);
263 264
264 dpll_clk = (long long)__clk_get_rate(dd->clk_ref) * dpll_mult; 265 dpll_clk = (long long)clk_get_rate(dd->clk_ref) * dpll_mult;
265 do_div(dpll_clk, dpll_div + 1); 266 do_div(dpll_clk, dpll_div + 1);
266 267
267 return dpll_clk; 268 return dpll_clk;
@@ -300,8 +301,8 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
300 301
301 dd = clk->dpll_data; 302 dd = clk->dpll_data;
302 303
303 ref_rate = __clk_get_rate(dd->clk_ref); 304 ref_rate = clk_get_rate(dd->clk_ref);
304 clk_name = __clk_get_name(hw->clk); 305 clk_name = clk_hw_get_name(hw);
305 pr_debug("clock: %s: starting DPLL round_rate, target rate %lu\n", 306 pr_debug("clock: %s: starting DPLL round_rate, target rate %lu\n",
306 clk_name, target_rate); 307 clk_name, target_rate);
307 308
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
index d8aafd333058..90f3f472ae1c 100644
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -204,7 +204,7 @@ int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
204 ti_of_clk_init_cb_t func); 204 ti_of_clk_init_cb_t func);
205int ti_clk_add_component(struct device_node *node, struct clk_hw *hw, int type); 205int ti_clk_add_component(struct device_node *node, struct clk_hw *hw, int type);
206 206
207void omap2_init_clk_hw_omap_clocks(struct clk *clk); 207void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw);
208int of_ti_clk_autoidle_setup(struct device_node *node); 208int of_ti_clk_autoidle_setup(struct device_node *node);
209void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks); 209void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
210 210
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c
index b6b2ac37dfad..5b1726829e6d 100644
--- a/drivers/clk/ti/divider.c
+++ b/drivers/clk/ti/divider.c
@@ -109,7 +109,7 @@ static unsigned long ti_clk_divider_recalc_rate(struct clk_hw *hw,
109 if (!div) { 109 if (!div) {
110 WARN(!(divider->flags & CLK_DIVIDER_ALLOW_ZERO), 110 WARN(!(divider->flags & CLK_DIVIDER_ALLOW_ZERO),
111 "%s: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set\n", 111 "%s: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set\n",
112 __clk_get_name(hw->clk)); 112 clk_hw_get_name(hw));
113 return parent_rate; 113 return parent_rate;
114 } 114 }
115 115
@@ -181,7 +181,7 @@ static int ti_clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
181 *best_parent_rate = parent_rate_saved; 181 *best_parent_rate = parent_rate_saved;
182 return i; 182 return i;
183 } 183 }
184 parent_rate = __clk_round_rate(__clk_get_parent(hw->clk), 184 parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw),
185 MULT_ROUND_UP(rate, i)); 185 MULT_ROUND_UP(rate, i));
186 now = DIV_ROUND_UP(parent_rate, i); 186 now = DIV_ROUND_UP(parent_rate, i);
187 if (now <= rate && now > best) { 187 if (now <= rate && now > best) {
@@ -194,7 +194,7 @@ static int ti_clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
194 if (!bestdiv) { 194 if (!bestdiv) {
195 bestdiv = _get_maxdiv(divider); 195 bestdiv = _get_maxdiv(divider);
196 *best_parent_rate = 196 *best_parent_rate =
197 __clk_round_rate(__clk_get_parent(hw->clk), 1); 197 clk_hw_round_rate(clk_hw_get_parent(hw), 1);
198 } 198 }
199 199
200 return bestdiv; 200 return bestdiv;
diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c
index 353a9b772025..f4dec00fb684 100644
--- a/drivers/clk/ti/dpll3xxx.c
+++ b/drivers/clk/ti/dpll3xxx.c
@@ -69,7 +69,7 @@ static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state)
69 const char *clk_name; 69 const char *clk_name;
70 70
71 dd = clk->dpll_data; 71 dd = clk->dpll_data;
72 clk_name = __clk_get_name(clk->hw.clk); 72 clk_name = clk_hw_get_name(&clk->hw);
73 73
74 state <<= __ffs(dd->idlest_mask); 74 state <<= __ffs(dd->idlest_mask);
75 75
@@ -98,7 +98,7 @@ static u16 _omap3_dpll_compute_freqsel(struct clk_hw_omap *clk, u8 n)
98 unsigned long fint; 98 unsigned long fint;
99 u16 f = 0; 99 u16 f = 0;
100 100
101 fint = __clk_get_rate(clk->dpll_data->clk_ref) / n; 101 fint = clk_get_rate(clk->dpll_data->clk_ref) / n;
102 102
103 pr_debug("clock: fint is %lu\n", fint); 103 pr_debug("clock: fint is %lu\n", fint);
104 104
@@ -145,7 +145,7 @@ static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk)
145 u8 state = 1; 145 u8 state = 1;
146 int r = 0; 146 int r = 0;
147 147
148 pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk->hw.clk)); 148 pr_debug("clock: locking DPLL %s\n", clk_hw_get_name(&clk->hw));
149 149
150 dd = clk->dpll_data; 150 dd = clk->dpll_data;
151 state <<= __ffs(dd->idlest_mask); 151 state <<= __ffs(dd->idlest_mask);
@@ -193,7 +193,7 @@ static int _omap3_noncore_dpll_bypass(struct clk_hw_omap *clk)
193 return -EINVAL; 193 return -EINVAL;
194 194
195 pr_debug("clock: configuring DPLL %s for low-power bypass\n", 195 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
196 __clk_get_name(clk->hw.clk)); 196 clk_hw_get_name(&clk->hw));
197 197
198 ai = omap3_dpll_autoidle_read(clk); 198 ai = omap3_dpll_autoidle_read(clk);
199 199
@@ -223,7 +223,7 @@ static int _omap3_noncore_dpll_stop(struct clk_hw_omap *clk)
223 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) 223 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
224 return -EINVAL; 224 return -EINVAL;
225 225
226 pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk->hw.clk)); 226 pr_debug("clock: stopping DPLL %s\n", clk_hw_get_name(&clk->hw));
227 227
228 ai = omap3_dpll_autoidle_read(clk); 228 ai = omap3_dpll_autoidle_read(clk);
229 229
@@ -251,7 +251,7 @@ static void _lookup_dco(struct clk_hw_omap *clk, u8 *dco, u16 m, u8 n)
251{ 251{
252 unsigned long fint, clkinp; /* watch out for overflow */ 252 unsigned long fint, clkinp; /* watch out for overflow */
253 253
254 clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk)); 254 clkinp = clk_hw_get_rate(clk_hw_get_parent(&clk->hw));
255 fint = (clkinp / n) * m; 255 fint = (clkinp / n) * m;
256 256
257 if (fint < 1000000000) 257 if (fint < 1000000000)
@@ -277,7 +277,7 @@ static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n)
277 unsigned long clkinp, sd; /* watch out for overflow */ 277 unsigned long clkinp, sd; /* watch out for overflow */
278 int mod1, mod2; 278 int mod1, mod2;
279 279
280 clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk)); 280 clkinp = clk_hw_get_rate(clk_hw_get_parent(&clk->hw));
281 281
282 /* 282 /*
283 * target sigma-delta to near 250MHz 283 * target sigma-delta to near 250MHz
@@ -429,15 +429,15 @@ int omap3_noncore_dpll_enable(struct clk_hw *hw)
429 if (r) { 429 if (r) {
430 WARN(1, 430 WARN(1,
431 "%s: could not enable %s's clockdomain %s: %d\n", 431 "%s: could not enable %s's clockdomain %s: %d\n",
432 __func__, __clk_get_name(hw->clk), 432 __func__, clk_hw_get_name(hw),
433 clk->clkdm_name, r); 433 clk->clkdm_name, r);
434 return r; 434 return r;
435 } 435 }
436 } 436 }
437 437
438 parent = __clk_get_hw(__clk_get_parent(hw->clk)); 438 parent = clk_hw_get_parent(hw);
439 439
440 if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) { 440 if (clk_hw_get_rate(hw) == clk_get_rate(dd->clk_bypass)) {
441 WARN_ON(parent != __clk_get_hw(dd->clk_bypass)); 441 WARN_ON(parent != __clk_get_hw(dd->clk_bypass));
442 r = _omap3_noncore_dpll_bypass(clk); 442 r = _omap3_noncore_dpll_bypass(clk);
443 } else { 443 } else {
@@ -489,7 +489,7 @@ int omap3_noncore_dpll_determine_rate(struct clk_hw *hw,
489 if (!dd) 489 if (!dd)
490 return -EINVAL; 490 return -EINVAL;
491 491
492 if (__clk_get_rate(dd->clk_bypass) == req->rate && 492 if (clk_get_rate(dd->clk_bypass) == req->rate &&
493 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) { 493 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
494 req->best_parent_hw = __clk_get_hw(dd->clk_bypass); 494 req->best_parent_hw = __clk_get_hw(dd->clk_bypass);
495 } else { 495 } else {
@@ -553,8 +553,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
553 if (!dd) 553 if (!dd)
554 return -EINVAL; 554 return -EINVAL;
555 555
556 if (__clk_get_hw(__clk_get_parent(hw->clk)) != 556 if (clk_hw_get_parent(hw) != __clk_get_hw(dd->clk_ref))
557 __clk_get_hw(dd->clk_ref))
558 return -EINVAL; 557 return -EINVAL;
559 558
560 if (dd->last_rounded_rate == 0) 559 if (dd->last_rounded_rate == 0)
@@ -567,7 +566,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
567 } 566 }
568 567
569 pr_debug("%s: %s: set rate: locking rate to %lu.\n", __func__, 568 pr_debug("%s: %s: set rate: locking rate to %lu.\n", __func__,
570 __clk_get_name(hw->clk), rate); 569 clk_hw_get_name(hw), rate);
571 570
572 ret = omap3_noncore_dpll_program(clk, freqsel); 571 ret = omap3_noncore_dpll_program(clk, freqsel);
573 572
@@ -704,13 +703,11 @@ static void omap3_dpll_deny_idle(struct clk_hw_omap *clk)
704static struct clk_hw_omap *omap3_find_clkoutx2_dpll(struct clk_hw *hw) 703static struct clk_hw_omap *omap3_find_clkoutx2_dpll(struct clk_hw *hw)
705{ 704{
706 struct clk_hw_omap *pclk = NULL; 705 struct clk_hw_omap *pclk = NULL;
707 struct clk *parent;
708 706
709 /* Walk up the parents of clk, looking for a DPLL */ 707 /* Walk up the parents of clk, looking for a DPLL */
710 do { 708 do {
711 do { 709 do {
712 parent = __clk_get_parent(hw->clk); 710 hw = clk_hw_get_parent(hw);
713 hw = __clk_get_hw(parent);
714 } while (hw && (clk_hw_get_flags(hw) & CLK_IS_BASIC)); 711 } while (hw && (clk_hw_get_flags(hw) & CLK_IS_BASIC));
715 if (!hw) 712 if (!hw)
716 break; 713 break;
diff --git a/drivers/clk/ti/dpll44xx.c b/drivers/clk/ti/dpll44xx.c
index 73af77a90586..660d7436ac24 100644
--- a/drivers/clk/ti/dpll44xx.c
+++ b/drivers/clk/ti/dpll44xx.c
@@ -94,7 +94,7 @@ static void omap4_dpll_lpmode_recalc(struct dpll_data *dd)
94{ 94{
95 long fint, fout; 95 long fint, fout;
96 96
97 fint = __clk_get_rate(dd->clk_ref) / (dd->last_rounded_n + 1); 97 fint = clk_get_rate(dd->clk_ref) / (dd->last_rounded_n + 1);
98 fout = fint * dd->last_rounded_m; 98 fout = fint * dd->last_rounded_m;
99 99
100 if ((fint < OMAP4_DPLL_LP_FINT_MAX) && (fout < OMAP4_DPLL_LP_FOUT_MAX)) 100 if ((fint < OMAP4_DPLL_LP_FINT_MAX) && (fout < OMAP4_DPLL_LP_FOUT_MAX))
@@ -212,7 +212,7 @@ int omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw,
212 if (!dd) 212 if (!dd)
213 return -EINVAL; 213 return -EINVAL;
214 214
215 if (__clk_get_rate(dd->clk_bypass) == req->rate && 215 if (clk_get_rate(dd->clk_bypass) == req->rate &&
216 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) { 216 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
217 req->best_parent_hw = __clk_get_hw(dd->clk_bypass); 217 req->best_parent_hw = __clk_get_hw(dd->clk_bypass);
218 } else { 218 } else {
diff --git a/drivers/clk/ti/gate.c b/drivers/clk/ti/gate.c
index 0c6fdfcd5f93..5429d3534363 100644
--- a/drivers/clk/ti/gate.c
+++ b/drivers/clk/ti/gate.c
@@ -62,7 +62,7 @@ static const struct clk_ops omap_gate_clk_hsdiv_restore_ops = {
62 * (Any other value different from the Read value) to the 62 * (Any other value different from the Read value) to the
63 * corresponding CM_CLKSEL register will refresh the dividers. 63 * corresponding CM_CLKSEL register will refresh the dividers.
64 */ 64 */
65static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *clk) 65static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *hw)
66{ 66{
67 struct clk_divider *parent; 67 struct clk_divider *parent;
68 struct clk_hw *parent_hw; 68 struct clk_hw *parent_hw;
@@ -70,10 +70,10 @@ static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
70 int ret; 70 int ret;
71 71
72 /* Clear PWRDN bit of HSDIVIDER */ 72 /* Clear PWRDN bit of HSDIVIDER */
73 ret = omap2_dflt_clk_enable(clk); 73 ret = omap2_dflt_clk_enable(hw);
74 74
75 /* Parent is the x2 node, get parent of parent for the m2 div */ 75 /* Parent is the x2 node, get parent of parent for the m2 div */
76 parent_hw = __clk_get_hw(__clk_get_parent(__clk_get_parent(clk->clk))); 76 parent_hw = clk_hw_get_parent(clk_hw_get_parent(hw));
77 parent = to_clk_divider(parent_hw); 77 parent = to_clk_divider(parent_hw);
78 78
79 /* Restore the dividers */ 79 /* Restore the dividers */