Lines Matching refs:div

26 	for (clkt = table; clkt->div; clkt++)  in _get_table_div()
28 return clkt->div; in _get_table_div()
41 for (clkt = divider->table; clkt->div; clkt++) in _setup_mask()
72 unsigned int div) in _get_table_val() argument
76 for (clkt = table; clkt->div; clkt++) in _get_table_val()
77 if (clkt->div == div) in _get_table_val()
82 static unsigned int _get_val(struct clk_omap_divider *divider, u8 div) in _get_val() argument
85 return div; in _get_val()
87 return __ffs(div); in _get_val()
89 return _get_table_val(divider->table, div); in _get_val()
90 return div - 1; in _get_val()
97 unsigned int div, val; in ti_clk_divider_recalc_rate() local
102 div = _get_div(divider, val); in ti_clk_divider_recalc_rate()
103 if (!div) { in ti_clk_divider_recalc_rate()
110 return DIV_ROUND_UP(parent_rate, div); in ti_clk_divider_recalc_rate()
120 unsigned int div) in _is_valid_table_div() argument
124 for (clkt = table; clkt->div; clkt++) in _is_valid_table_div()
125 if (clkt->div == div) in _is_valid_table_div()
130 static bool _is_valid_div(struct clk_omap_divider *divider, unsigned int div) in _is_valid_div() argument
133 return is_power_of_2(div); in _is_valid_div()
135 return _is_valid_table_div(divider->table, div); in _is_valid_div()
144 int div = DIV_ROUND_UP_ULL((u64)parent_rate, rate); in _div_round_up() local
146 for (clkt = table; clkt->div; clkt++) { in _div_round_up()
147 if (clkt->div == div) in _div_round_up()
148 return clkt->div; in _div_round_up()
149 else if (clkt->div < div) in _div_round_up()
152 if ((clkt->div - div) < (up - div)) in _div_round_up()
153 up = clkt->div; in _div_round_up()
229 int div; in ti_clk_divider_round_rate() local
230 div = ti_clk_divider_bestdiv(hw, rate, prate); in ti_clk_divider_round_rate()
232 return DIV_ROUND_UP(*prate, div); in ti_clk_divider_round_rate()
239 unsigned int div, value; in ti_clk_divider_set_rate() local
247 div = DIV_ROUND_UP(parent_rate, rate); in ti_clk_divider_set_rate()
249 if (div > divider->max) in ti_clk_divider_set_rate()
250 div = divider->max; in ti_clk_divider_set_rate()
251 if (div < divider->min) in ti_clk_divider_set_rate()
252 div = divider->min; in ti_clk_divider_set_rate()
254 value = _get_val(divider, div); in ti_clk_divider_set_rate()
310 struct clk_omap_divider *div) in _register_divider() argument
325 div->hw.init = &init; in _register_divider()
328 return of_ti_clk_register(node, &div->hw, name); in _register_divider()
366 tmp[valid_div].div = div_table[i]; in ti_clk_parse_divider_data()
384 struct clk_omap_divider *div) in ti_clk_get_div_table() argument
423 table[valid_div].div = val; in ti_clk_get_div_table()
429 div->table = table; in ti_clk_get_div_table()
453 for (clkt = divider->table; clkt->div; clkt++) { in _populate_divider_min_max()
454 val = clkt->div; in _populate_divider_min_max()
470 struct clk_omap_divider *div, in ti_clk_divider_populate() argument
476 ret = ti_clk_get_reg_addr(node, 0, &div->reg); in ti_clk_divider_populate()
481 div->shift = val; in ti_clk_divider_populate()
483 div->shift = 0; in ti_clk_divider_populate()
486 div->latch = val; in ti_clk_divider_populate()
488 div->latch = -EINVAL; in ti_clk_divider_populate()
491 div->flags = 0; in ti_clk_divider_populate()
494 div->flags |= CLK_DIVIDER_ONE_BASED; in ti_clk_divider_populate()
497 div->flags |= CLK_DIVIDER_POWER_OF_TWO; in ti_clk_divider_populate()
502 ret = ti_clk_get_div_table(node, div); in ti_clk_divider_populate()
506 return _populate_divider_min_max(node, div); in ti_clk_divider_populate()
519 struct clk_omap_divider *div; in of_ti_divider_clk_setup() local
521 div = kzalloc(sizeof(*div), GFP_KERNEL); in of_ti_divider_clk_setup()
522 if (!div) in of_ti_divider_clk_setup()
525 if (ti_clk_divider_populate(node, div, &flags)) in of_ti_divider_clk_setup()
528 clk = _register_divider(node, flags, div); in of_ti_divider_clk_setup()
536 kfree(div->table); in of_ti_divider_clk_setup()
537 kfree(div); in of_ti_divider_clk_setup()
543 struct clk_omap_divider *div; in of_ti_composite_divider_clk_setup() local
546 div = kzalloc(sizeof(*div), GFP_KERNEL); in of_ti_composite_divider_clk_setup()
547 if (!div) in of_ti_composite_divider_clk_setup()
550 if (ti_clk_divider_populate(node, div, &tmp)) in of_ti_composite_divider_clk_setup()
553 if (!ti_clk_add_component(node, &div->hw, CLK_COMPONENT_TYPE_DIVIDER)) in of_ti_composite_divider_clk_setup()
557 kfree(div->table); in of_ti_composite_divider_clk_setup()
558 kfree(div); in of_ti_composite_divider_clk_setup()