Lines Matching refs:rate

29 	unsigned long	rate;  member
36 int (*set_rate)(struct clk *clk, unsigned long rate);
42 static int set_keytchclk_rate(struct clk *clk, unsigned long rate);
43 static int set_div_rate(struct clk *clk, unsigned long rate);
44 static int set_i2s_sclk_rate(struct clk *clk, unsigned long rate);
45 static int set_i2s_lrclk_rate(struct clk *clk, unsigned long rate);
48 .rate = EP93XX_EXT_CLK_RATE,
107 .rate = EP93XX_EXT_CLK_RATE,
111 .rate = EP93XX_EXT_CLK_RATE,
312 unsigned long rate = clk_get_rate(clk->parent); in get_uart_rate() local
317 return rate; in get_uart_rate()
319 return rate / 2; in get_uart_rate()
327 return clk->rate; in clk_get_rate()
331 static int set_keytchclk_rate(struct clk *clk, unsigned long rate) in set_keytchclk_rate() argument
347 if (rate == EP93XX_KEYTCHCLK_DIV4) in set_keytchclk_rate()
349 else if (rate == EP93XX_KEYTCHCLK_DIV16) in set_keytchclk_rate()
355 clk->rate = rate; in set_keytchclk_rate()
359 static int calc_clk_div(struct clk *clk, unsigned long rate, in calc_clk_div() argument
367 max_rate = max3(clk_pll1.rate / 4, clk_pll2.rate / 4, clk_xtali.rate / 4); in calc_clk_div()
368 rate = min(rate, max_rate); in calc_clk_div()
386 mclk_rate = mclk->rate * 2; in calc_clk_div()
390 __div = mclk_rate / (rate * __pdiv); in calc_clk_div()
396 if (!found || abs(actual_rate - rate) < rate_err) { in calc_clk_div()
402 clk->rate = actual_rate; in calc_clk_div()
403 rate_err = abs(actual_rate - rate); in calc_clk_div()
415 static int set_div_rate(struct clk *clk, unsigned long rate) in set_div_rate() argument
420 err = calc_clk_div(clk, rate, &psel, &esel, &pdiv, &div); in set_div_rate()
436 static int set_i2s_sclk_rate(struct clk *clk, unsigned long rate) in set_i2s_sclk_rate() argument
440 if (rate == clk_i2s_mclk.rate / 2) in set_i2s_sclk_rate()
443 else if (rate == clk_i2s_mclk.rate / 4) in set_i2s_sclk_rate()
449 clk_i2s_sclk.rate = rate; in set_i2s_sclk_rate()
453 static int set_i2s_lrclk_rate(struct clk *clk, unsigned long rate) in set_i2s_lrclk_rate() argument
458 if (rate == clk_i2s_sclk.rate / 32) in set_i2s_lrclk_rate()
461 else if (rate == clk_i2s_sclk.rate / 64) in set_i2s_lrclk_rate()
464 else if (rate == clk_i2s_sclk.rate / 128) in set_i2s_lrclk_rate()
470 clk_i2s_lrclk.rate = rate; in set_i2s_lrclk_rate()
474 int clk_set_rate(struct clk *clk, unsigned long rate) in clk_set_rate() argument
477 return clk->set_rate(clk, rate); in clk_set_rate()
483 long clk_round_rate(struct clk *clk, unsigned long rate) in clk_round_rate() argument
513 unsigned long long rate; in calc_pll_rate() local
516 rate = clk_xtali.rate; in calc_pll_rate()
517 rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ in calc_pll_rate()
518 rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ in calc_pll_rate()
519 do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ in calc_pll_rate()
521 rate >>= 1; in calc_pll_rate()
523 return (unsigned long)rate; in calc_pll_rate()
528 clk_m2p0.rate = clk_h.rate; in ep93xx_dma_clock_init()
529 clk_m2p1.rate = clk_h.rate; in ep93xx_dma_clock_init()
530 clk_m2p2.rate = clk_h.rate; in ep93xx_dma_clock_init()
531 clk_m2p3.rate = clk_h.rate; in ep93xx_dma_clock_init()
532 clk_m2p4.rate = clk_h.rate; in ep93xx_dma_clock_init()
533 clk_m2p5.rate = clk_h.rate; in ep93xx_dma_clock_init()
534 clk_m2p6.rate = clk_h.rate; in ep93xx_dma_clock_init()
535 clk_m2p7.rate = clk_h.rate; in ep93xx_dma_clock_init()
536 clk_m2p8.rate = clk_h.rate; in ep93xx_dma_clock_init()
537 clk_m2p9.rate = clk_h.rate; in ep93xx_dma_clock_init()
538 clk_m2m0.rate = clk_h.rate; in ep93xx_dma_clock_init()
539 clk_m2m1.rate = clk_h.rate; in ep93xx_dma_clock_init()
549 clk_pll1.rate = clk_xtali.rate; in ep93xx_clock_init()
551 clk_pll1.rate = calc_pll_rate(value); in ep93xx_clock_init()
554 clk_f.rate = clk_pll1.rate / fclk_divisors[(value >> 25) & 0x7]; in ep93xx_clock_init()
555 clk_h.rate = clk_pll1.rate / hclk_divisors[(value >> 20) & 0x7]; in ep93xx_clock_init()
556 clk_p.rate = clk_h.rate / pclk_divisors[(value >> 18) & 0x3]; in ep93xx_clock_init()
562 clk_pll2.rate = clk_xtali.rate; in ep93xx_clock_init()
564 clk_pll2.rate = calc_pll_rate(value); in ep93xx_clock_init()
566 clk_pll2.rate = 0; in ep93xx_clock_init()
569 clk_usb_host.rate = clk_pll2.rate / (((value >> 28) & 0xf) + 1); in ep93xx_clock_init()
577 clk_spi.rate /= 2; in ep93xx_clock_init()
580 clk_pll1.rate / 1000000, clk_pll2.rate / 1000000); in ep93xx_clock_init()
582 clk_f.rate / 1000000, clk_h.rate / 1000000, in ep93xx_clock_init()
583 clk_p.rate / 1000000); in ep93xx_clock_init()