Lines Matching full:div
34 for (clkt = table; clkt->div; clkt++) in _get_table_div()
36 return clkt->div; in _get_table_div()
49 for (clkt = divider->table; clkt->div; clkt++) in _setup_mask()
80 unsigned int div) in _get_table_val() argument
84 for (clkt = table; clkt->div; clkt++) in _get_table_val()
85 if (clkt->div == div) in _get_table_val()
90 static unsigned int _get_val(struct clk_omap_divider *divider, u8 div) in _get_val() argument
93 return div; in _get_val()
95 return __ffs(div); in _get_val()
97 return _get_table_val(divider->table, div); in _get_val()
98 return div - 1; in _get_val()
105 unsigned int div, val; in ti_clk_divider_recalc_rate() local
110 div = _get_div(divider, val); in ti_clk_divider_recalc_rate()
111 if (!div) { in ti_clk_divider_recalc_rate()
118 return DIV_ROUND_UP(parent_rate, div); in ti_clk_divider_recalc_rate()
128 unsigned int div) in _is_valid_table_div() argument
132 for (clkt = table; clkt->div; clkt++) in _is_valid_table_div()
133 if (clkt->div == div) in _is_valid_table_div()
138 static bool _is_valid_div(struct clk_omap_divider *divider, unsigned int div) in _is_valid_div() argument
141 return is_power_of_2(div); in _is_valid_div()
143 return _is_valid_table_div(divider->table, div); in _is_valid_div()
152 int div = DIV_ROUND_UP_ULL((u64)parent_rate, rate); in _div_round_up() local
154 for (clkt = table; clkt->div; clkt++) { in _div_round_up()
155 if (clkt->div == div) in _div_round_up()
156 return clkt->div; in _div_round_up()
157 else if (clkt->div < div) in _div_round_up()
160 if ((clkt->div - div) < (up - div)) in _div_round_up()
161 up = clkt->div; in _div_round_up()
237 int div; in ti_clk_divider_round_rate() local
238 div = ti_clk_divider_bestdiv(hw, rate, prate); in ti_clk_divider_round_rate()
240 return DIV_ROUND_UP(*prate, div); in ti_clk_divider_round_rate()
247 unsigned int div, value; in ti_clk_divider_set_rate() local
255 div = DIV_ROUND_UP(parent_rate, rate); in ti_clk_divider_set_rate()
257 if (div > divider->max) in ti_clk_divider_set_rate()
258 div = divider->max; in ti_clk_divider_set_rate()
259 if (div < divider->min) in ti_clk_divider_set_rate()
260 div = divider->min; in ti_clk_divider_set_rate()
262 value = _get_val(divider, div); in ti_clk_divider_set_rate()
318 struct clk_omap_divider *div) in _register_divider() argument
332 div->hw.init = &init; in _register_divider()
335 clk = ti_clk_register(NULL, &div->hw, node->name); in _register_divider()
338 kfree(div); in _register_divider()
378 tmp[valid_div].div = div_table[i]; in ti_clk_parse_divider_data()
396 struct clk_omap_divider *div) in ti_clk_get_div_table() argument
435 table[valid_div].div = val; in ti_clk_get_div_table()
441 div->table = table; in ti_clk_get_div_table()
456 if (of_property_read_u32(node, "ti,min-div", &min_div)) in _populate_divider_min_max()
459 if (of_property_read_u32(node, "ti,max-div", &max_div)) { in _populate_divider_min_max()
460 pr_err("no max-div for %pOFn!\n", node); in _populate_divider_min_max()
465 for (clkt = divider->table; clkt->div; clkt++) { in _populate_divider_min_max()
466 val = clkt->div; in _populate_divider_min_max()
482 struct clk_omap_divider *div, in ti_clk_divider_populate() argument
488 ret = ti_clk_get_reg_addr(node, 0, &div->reg); in ti_clk_divider_populate()
493 div->shift = val; in ti_clk_divider_populate()
495 div->shift = 0; in ti_clk_divider_populate()
498 div->latch = val; in ti_clk_divider_populate()
500 div->latch = -EINVAL; in ti_clk_divider_populate()
503 div->flags = 0; in ti_clk_divider_populate()
506 div->flags |= CLK_DIVIDER_ONE_BASED; in ti_clk_divider_populate()
509 div->flags |= CLK_DIVIDER_POWER_OF_TWO; in ti_clk_divider_populate()
514 ret = ti_clk_get_div_table(node, div); in ti_clk_divider_populate()
518 return _populate_divider_min_max(node, div); in ti_clk_divider_populate()
522 * of_ti_divider_clk_setup - Setup function for simple div rate clock
531 struct clk_omap_divider *div; in of_ti_divider_clk_setup() local
533 div = kzalloc(sizeof(*div), GFP_KERNEL); in of_ti_divider_clk_setup()
534 if (!div) in of_ti_divider_clk_setup()
537 if (ti_clk_divider_populate(node, div, &flags)) in of_ti_divider_clk_setup()
540 clk = _register_divider(node, flags, div); in of_ti_divider_clk_setup()
548 kfree(div->table); in of_ti_divider_clk_setup()
549 kfree(div); in of_ti_divider_clk_setup()
555 struct clk_omap_divider *div; in of_ti_composite_divider_clk_setup() local
558 div = kzalloc(sizeof(*div), GFP_KERNEL); in of_ti_composite_divider_clk_setup()
559 if (!div) in of_ti_composite_divider_clk_setup()
562 if (ti_clk_divider_populate(node, div, &tmp)) in of_ti_composite_divider_clk_setup()
565 if (!ti_clk_add_component(node, &div->hw, CLK_COMPONENT_TYPE_DIVIDER)) in of_ti_composite_divider_clk_setup()
569 kfree(div->table); in of_ti_composite_divider_clk_setup()
570 kfree(div); in of_ti_composite_divider_clk_setup()