Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: ti: Convert to clk_hw based provider APIs

We're removing struct clk from the clk provider API, so switch
this code to using the clk_hw based provider APIs.

Acked-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Stephen Boyd and committed by
Michael Turquette
a53ad8ef 5cdb1dc5

+33 -35
+4 -4
drivers/clk/ti/autoidle.c
··· 169 169 170 170 /** 171 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 174 * Add an OMAP clock @clk to the internal list of OMAP clocks. Used 175 175 * temporarily for autoidle handling, until this support can be 176 176 * integrated into the common clock framework code in some way. No 177 177 * return value. 178 178 */ 179 - void omap2_init_clk_hw_omap_clocks(struct clk *clk) 179 + void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw) 180 180 { 181 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 184 return; 185 185 186 - c = to_clk_hw_omap(__clk_get_hw(clk)); 186 + c = to_clk_hw_omap(hw); 187 187 list_add(&c->node, &clk_hw_omap_clocks); 188 188 } 189 189
+6 -5
drivers/clk/ti/clkt_dpll.c
··· 16 16 17 17 #include <linux/kernel.h> 18 18 #include <linux/errno.h> 19 + #include <linux/clk.h> 19 20 #include <linux/clk-provider.h> 20 21 #include <linux/io.h> 21 22 #include <linux/clk/ti.h> ··· 76 75 dd = clk->dpll_data; 77 76 78 77 /* DPLL divider must result in a valid jitter correction val */ 79 - fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n; 78 + fint = clk_hw_get_rate(clk_hw_get_parent(&clk->hw)) / n; 80 79 81 80 if (dd->flags & DPLL_J_TYPE) { 82 81 fint_min = OMAP3PLUS_DPLL_FINT_JTYPE_MIN; ··· 254 253 v >>= __ffs(dd->enable_mask); 255 254 256 255 if (_omap2_dpll_is_in_bypass(v)) 257 - return __clk_get_rate(dd->clk_bypass); 256 + return clk_get_rate(dd->clk_bypass); 258 257 259 258 v = ti_clk_ll_ops->clk_readl(dd->mult_div1_reg); 260 259 dpll_mult = v & dd->mult_mask; ··· 262 261 dpll_div = v & dd->div1_mask; 263 262 dpll_div >>= __ffs(dd->div1_mask); 264 263 265 - dpll_clk = (long long)__clk_get_rate(dd->clk_ref) * dpll_mult; 264 + dpll_clk = (long long)clk_get_rate(dd->clk_ref) * dpll_mult; 266 265 do_div(dpll_clk, dpll_div + 1); 267 266 268 267 return dpll_clk; ··· 301 300 302 301 dd = clk->dpll_data; 303 302 304 - ref_rate = __clk_get_rate(dd->clk_ref); 305 - clk_name = __clk_get_name(hw->clk); 303 + ref_rate = clk_get_rate(dd->clk_ref); 304 + clk_name = clk_hw_get_name(hw); 306 305 pr_debug("clock: %s: starting DPLL round_rate, target rate %lu\n", 307 306 clk_name, target_rate); 308 307
+1 -1
drivers/clk/ti/clock.h
··· 204 204 ti_of_clk_init_cb_t func); 205 205 int ti_clk_add_component(struct device_node *node, struct clk_hw *hw, int type); 206 206 207 - void omap2_init_clk_hw_omap_clocks(struct clk *clk); 207 + void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw); 208 208 int of_ti_clk_autoidle_setup(struct device_node *node); 209 209 void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks); 210 210
+3 -3
drivers/clk/ti/divider.c
··· 109 109 if (!div) { 110 110 WARN(!(divider->flags & CLK_DIVIDER_ALLOW_ZERO), 111 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 113 return parent_rate; 114 114 } 115 115 ··· 181 181 *best_parent_rate = parent_rate_saved; 182 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 185 MULT_ROUND_UP(rate, i)); 186 186 now = DIV_ROUND_UP(parent_rate, i); 187 187 if (now <= rate && now > best) { ··· 194 194 if (!bestdiv) { 195 195 bestdiv = _get_maxdiv(divider); 196 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 200 return bestdiv;
+14 -17
drivers/clk/ti/dpll3xxx.c
··· 69 69 const char *clk_name; 70 70 71 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 74 state <<= __ffs(dd->idlest_mask); 75 75 ··· 98 98 unsigned long fint; 99 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 103 pr_debug("clock: fint is %lu\n", fint); 104 104 ··· 145 145 u8 state = 1; 146 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 150 dd = clk->dpll_data; 151 151 state <<= __ffs(dd->idlest_mask); ··· 193 193 return -EINVAL; 194 194 195 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 198 ai = omap3_dpll_autoidle_read(clk); 199 199 ··· 223 223 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) 224 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 228 ai = omap3_dpll_autoidle_read(clk); 229 229 ··· 251 251 { 252 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 255 fint = (clkinp / n) * m; 256 256 257 257 if (fint < 1000000000) ··· 277 277 unsigned long clkinp, sd; /* watch out for overflow */ 278 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 283 * target sigma-delta to near 250MHz ··· 429 429 if (r) { 430 430 WARN(1, 431 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 433 clk->clkdm_name, r); 434 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 441 WARN_ON(parent != __clk_get_hw(dd->clk_bypass)); 442 442 r = _omap3_noncore_dpll_bypass(clk); 443 443 } else { ··· 489 489 if (!dd) 490 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 493 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) { 494 494 req->best_parent_hw = __clk_get_hw(dd->clk_bypass); 495 495 } else { ··· 553 553 if (!dd) 554 554 return -EINVAL; 555 555 556 - if (__clk_get_hw(__clk_get_parent(hw->clk)) != 557 - __clk_get_hw(dd->clk_ref)) 556 + if (clk_hw_get_parent(hw) != __clk_get_hw(dd->clk_ref)) 558 557 return -EINVAL; 559 558 560 559 if (dd->last_rounded_rate == 0) ··· 566 567 } 567 568 568 569 pr_debug("%s: %s: set rate: locking rate to %lu.\n", __func__, 569 - __clk_get_name(hw->clk), rate); 570 + clk_hw_get_name(hw), rate); 570 571 571 572 ret = omap3_noncore_dpll_program(clk, freqsel); 572 573 ··· 703 704 static struct clk_hw_omap *omap3_find_clkoutx2_dpll(struct clk_hw *hw) 704 705 { 705 706 struct clk_hw_omap *pclk = NULL; 706 - struct clk *parent; 707 707 708 708 /* Walk up the parents of clk, looking for a DPLL */ 709 709 do { 710 710 do { 711 - parent = __clk_get_parent(hw->clk); 712 - hw = __clk_get_hw(parent); 711 + hw = clk_hw_get_parent(hw); 713 712 } while (hw && (clk_hw_get_flags(hw) & CLK_IS_BASIC)); 714 713 if (!hw) 715 714 break;
+2 -2
drivers/clk/ti/dpll44xx.c
··· 94 94 { 95 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 98 fout = fint * dd->last_rounded_m; 99 99 100 100 if ((fint < OMAP4_DPLL_LP_FINT_MAX) && (fout < OMAP4_DPLL_LP_FOUT_MAX)) ··· 212 212 if (!dd) 213 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 216 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) { 217 217 req->best_parent_hw = __clk_get_hw(dd->clk_bypass); 218 218 } else {
+3 -3
drivers/clk/ti/gate.c
··· 62 62 * (Any other value different from the Read value) to the 63 63 * corresponding CM_CLKSEL register will refresh the dividers. 64 64 */ 65 - static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *clk) 65 + static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *hw) 66 66 { 67 67 struct clk_divider *parent; 68 68 struct clk_hw *parent_hw; ··· 70 70 int ret; 71 71 72 72 /* Clear PWRDN bit of HSDIVIDER */ 73 - ret = omap2_dflt_clk_enable(clk); 73 + ret = omap2_dflt_clk_enable(hw); 74 74 75 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 77 parent = to_clk_divider(parent_hw); 78 78 79 79 /* Restore the dividers */