Lines Matching +full:- +full:clk

4  * Copyright (C) 2006-2008 Andrzej Zaborowski  <balrog@zabor.org>
6 * Clocks data comes in part from arch/arm/mach-omap1/clock.h in Linux.
27 struct clk { struct
30 struct clk *parent; argument
31 struct clk *child1; argument
32 struct clk *sibling; argument
42 int enabled; /* Is enabled, regardless of its input clk */ argument
50 static struct clk xtal_osc12m = { argument
56 static struct clk xtal_osc32k = {
62 static struct clk ck_ref = {
71 static struct clk dpll1 = {
78 static struct clk dpll2 = {
84 static struct clk dpll3 = {
90 static struct clk dpll4 = {
97 static struct clk apll = {
105 static struct clk ck_48m = {
111 static struct clk ck_dpll1out = {
117 static struct clk sossi_ck = {
123 static struct clk clkm1 = {
131 static struct clk clkm2 = {
139 static struct clk clkm3 = {
147 static struct clk arm_ck = {
155 static struct clk armper_ck = {
162 static struct clk arm_gpio_ck = {
170 static struct clk armxor_ck = {
177 static struct clk armtim_ck = {
184 static struct clk armwdt_ck = {
193 static struct clk arminth_ck16xx = {
204 static struct clk dsp_ck = {
210 static struct clk dspmmu_ck = {
217 static struct clk dspper_ck = {
223 static struct clk dspxor_ck = {
229 static struct clk dsptim_ck = {
235 static struct clk tc_ck = {
243 static struct clk arminth_ck15xx = {
253 static struct clk tipb_ck = {
254 /* No-idle controlled by "tc_ck" */
260 static struct clk l3_ocpi_ck = {
261 /* No-idle controlled by "tc_ck" */
267 static struct clk tc1_ck = {
273 static struct clk tc2_ck = {
279 static struct clk dma_ck = {
280 /* No-idle controlled by "tc_ck" */
287 static struct clk dma_lcdfree_ck = {
293 static struct clk api_ck = {
300 static struct clk lb_ck = {
306 static struct clk lbfree_ck = {
312 static struct clk hsab_ck = {
318 static struct clk rhea1_ck = {
324 static struct clk rhea2_ck = {
330 static struct clk lcd_ck_16xx = {
336 static struct clk lcd_ck_1510 = {
342 static struct clk uart1_1510 = {
350 static struct clk uart1_16xx = {
358 static struct clk uart2_ck = {
367 static struct clk uart3_1510 = {
375 static struct clk uart3_16xx = {
383 static struct clk usb_clk0 = { /* 6 MHz output on W4_USB_CLK0 */
391 static struct clk usb_hhc_ck1510 = {
398 static struct clk usb_hhc_ck16xx = {
402 /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
406 static struct clk usb_w2fc_mclk = {
414 static struct clk mclk_1510 = {
421 static struct clk bclk_310 = {
427 static struct clk mclk_310 = {
433 static struct clk mclk_16xx = {
439 static struct clk bclk_1510 = {
446 static struct clk bclk_16xx = {
452 static struct clk mmc1_ck = {
461 static struct clk mmc2_ck = {
470 static struct clk cam_mclk = {
476 static struct clk cam_exclk = {
483 static struct clk cam_lclk = {
488 static struct clk i2c_fck = {
496 static struct clk i2c_ick = {
503 static struct clk clk32k = {
504 .name = "clk32-kHz",
510 static struct clk *onchip_clks[] = {
513 /* non-ULPD clocks */
582 void omap_clk_adduser(struct clk *clk, qemu_irq user) in omap_clk_adduser() argument
586 for (i = clk->users; *i; i ++); in omap_clk_adduser()
590 struct clk *omap_findclk(struct omap_mpu_state_s *mpu, const char *name) in omap_findclk()
592 struct clk *i; in omap_findclk()
594 for (i = mpu->clks; i->name; i ++) in omap_findclk()
595 if (!strcmp(i->name, name) || (i->alias && !strcmp(i->alias, name))) in omap_findclk()
600 void omap_clk_get(struct clk *clk) in omap_clk_get() argument
602 clk->usecount ++; in omap_clk_get()
605 void omap_clk_put(struct clk *clk) in omap_clk_put() argument
607 if (!(clk->usecount --)) in omap_clk_put()
608 hw_error("%s: %s is not in use\n", __func__, clk->name); in omap_clk_put()
611 static void omap_clk_update(struct clk *clk) in omap_clk_update() argument
615 struct clk *i; in omap_clk_update()
617 if (clk->parent) in omap_clk_update()
618 parent = clk->parent->running; in omap_clk_update()
622 running = parent && (clk->enabled || in omap_clk_update()
623 ((clk->flags & ALWAYS_ENABLED) && clk->usecount)); in omap_clk_update()
624 if (clk->running != running) { in omap_clk_update()
625 clk->running = running; in omap_clk_update()
626 for (user = clk->users; *user; user ++) in omap_clk_update()
628 for (i = clk->child1; i; i = i->sibling) in omap_clk_update()
633 static void omap_clk_rate_update_full(struct clk *clk, unsigned long int rate, in omap_clk_rate_update_full() argument
636 struct clk *i; in omap_clk_rate_update_full()
639 clk->rate = muldiv64(rate, mult, div); in omap_clk_rate_update_full()
640 if (clk->running) in omap_clk_rate_update_full()
641 for (user = clk->users; *user; user ++) in omap_clk_rate_update_full()
643 for (i = clk->child1; i; i = i->sibling) in omap_clk_rate_update_full()
645 div * i->divisor, mult * i->multiplier); in omap_clk_rate_update_full()
648 static void omap_clk_rate_update(struct clk *clk) in omap_clk_rate_update() argument
650 struct clk *i; in omap_clk_rate_update()
653 for (i = clk; i->parent; i = i->parent) { in omap_clk_rate_update()
654 div *= i->divisor; in omap_clk_rate_update()
655 mult *= i->multiplier; in omap_clk_rate_update()
658 omap_clk_rate_update_full(clk, i->rate, div, mult); in omap_clk_rate_update()
661 void omap_clk_reparent(struct clk *clk, struct clk *parent) in omap_clk_reparent() argument
663 struct clk **p; in omap_clk_reparent()
665 if (clk->parent) { in omap_clk_reparent()
666 for (p = &clk->parent->child1; *p != clk; p = &(*p)->sibling); in omap_clk_reparent()
667 *p = clk->sibling; in omap_clk_reparent()
670 clk->parent = parent; in omap_clk_reparent()
672 clk->sibling = parent->child1; in omap_clk_reparent()
673 parent->child1 = clk; in omap_clk_reparent()
674 omap_clk_update(clk); in omap_clk_reparent()
675 omap_clk_rate_update(clk); in omap_clk_reparent()
677 clk->sibling = NULL; in omap_clk_reparent()
680 void omap_clk_onoff(struct clk *clk, int on) in omap_clk_onoff() argument
682 clk->enabled = on; in omap_clk_onoff()
683 omap_clk_update(clk); in omap_clk_onoff()
686 void omap_clk_canidle(struct clk *clk, int can) in omap_clk_canidle() argument
689 omap_clk_put(clk); in omap_clk_canidle()
691 omap_clk_get(clk); in omap_clk_canidle()
694 void omap_clk_setrate(struct clk *clk, int divide, int multiply) in omap_clk_setrate() argument
696 clk->divisor = divide; in omap_clk_setrate()
697 clk->multiplier = multiply; in omap_clk_setrate()
698 omap_clk_rate_update(clk); in omap_clk_setrate()
701 int64_t omap_clk_getrate(omap_clk clk) in omap_clk_getrate() argument
703 return clk->rate; in omap_clk_getrate()
708 struct clk **i, *j, *k; in omap_clk_init()
720 if ((*i)->flags & flag) in omap_clk_init()
722 mpu->clks = g_new0(struct clk, count + 1); in omap_clk_init()
723 for (i = onchip_clks, j = mpu->clks; *i; i ++) in omap_clk_init()
724 if ((*i)->flags & flag) { in omap_clk_init()
725 memcpy(j, *i, sizeof(struct clk)); in omap_clk_init()
726 for (k = mpu->clks; k < j; k ++) in omap_clk_init()
727 if (j->parent && !strcmp(j->parent->name, k->name)) { in omap_clk_init()
728 j->parent = k; in omap_clk_init()
729 j->sibling = k->child1; in omap_clk_init()
730 k->child1 = j; in omap_clk_init()
731 } else if (k->parent && !strcmp(k->parent->name, j->name)) { in omap_clk_init()
732 k->parent = j; in omap_clk_init()
733 k->sibling = j->child1; in omap_clk_init()
734 j->child1 = k; in omap_clk_init()
736 j->divisor = j->divisor ?: 1; in omap_clk_init()
737 j->multiplier = j->multiplier ?: 1; in omap_clk_init()
740 for (j = mpu->clks; count --; j ++) { in omap_clk_init()