Lines Matching +full:clock +full:- +full:freq
1 /*-
51 SYSCTL_NODE(_hw, OID_AUTO, clock, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
54 MALLOC_DEFINE(M_CLOCK, "clocks", "Clock framework");
64 /* Default clock methods. */
66 static int clknode_method_recalc_freq(struct clknode *clk, uint64_t *freq);
73 * Clock controller methods.
87 * Clock node - basic element for modeling SOC clock graph. It holds the clock
88 * provider's data about the clock, and the links for the clock's membership in
94 /* Clock nodes topology. */
95 struct clkdom *clkdom; /* Owning clock domain */
102 int parent_idx; /* Parent index or -1 */
117 struct sx lock; /* Lock for this clock */
122 uint64_t freq; /* Actual frequency */ member
128 * Per consumer data, information about how a consumer is using a clock node.
138 * Clock domain - a group of clocks provided by one clock device.
146 clknode_ofw_mapper_func *ofw_mapper; /* Find clock using FDT xref */
151 * The system-wide list of clock domains.
156 * Each clock node is linked on a system-wide list and can be searched by name.
161 * Locking - we use three levels of locking:
162 * - First, topology lock is taken. This one protect all lists.
163 * - Second level is per clknode lock. It protects clknode data.
164 * - Third level is outside of this file, it protect clock device registers.
165 * First two levels use sleepable locks; clock device can use mutex or sx lock.
168 SX_SYSINIT(clock_topology, &clk_topo_lock, "Clock topology lock");
176 #define CLKNODE_SLOCK(_sc) sx_slock(&((_sc)->lock))
177 #define CLKNODE_XLOCK(_sc) sx_xlock(&((_sc)->lock))
178 #define CLKNODE_UNLOCK(_sc) sx_unlock(&((_sc)->lock))
197 * Default clock methods for base class.
207 clknode_method_recalc_freq(struct clknode *clknode, uint64_t *freq) in clknode_method_recalc_freq() argument
262 panic("Clock parent names array have empty string"); in strdup_list()
282 clknode_refresh_cache(struct clknode *clknode, uint64_t freq) in clknode_refresh_cache() argument
290 rv = CLKNODE_RECALC_FREQ(clknode, &freq); in clknode_refresh_cache()
293 * this leaves the world in a partially-updated state. in clknode_refresh_cache()
297 clknode->name); in clknode_refresh_cache()
301 clknode->freq = freq; in clknode_refresh_cache()
304 TAILQ_FOREACH(entry, &(clknode->children), sibling_link) { in clknode_refresh_cache()
305 rv = clknode_refresh_cache(entry, freq); in clknode_refresh_cache()
324 if (strcmp(entry->name, name) == 0) in clknode_find_by_name()
337 TAILQ_FOREACH(entry, &clkdom->clknode_list, clkdom_link) { in clknode_find_by_id()
338 if (entry->id == id) in clknode_find_by_id()
345 /* -------------------------------------------------------------------------- */
347 * Clock domain functions
350 /* Find clock domain associated to device in global list. */
359 if (entry->dev == dev) in clkdom_get_by_dev()
389 * Create a clock domain. Returns with the topo lock held.
397 clkdom->dev = dev; in clkdom_create()
398 TAILQ_INIT(&clkdom->clknode_list); in clkdom_create()
400 clkdom->ofw_mapper = clknode_default_ofw_map; in clkdom_create()
408 "Clock list for the domain"); in clkdom_create()
428 * Finalize initialization of clock domain. Releases topo lock.
441 if ((node = ofw_bus_get_node(clkdom->dev)) == -1) { in clkdom_finit()
442 device_printf(clkdom->dev, in clkdom_finit()
449 /* Make clock domain globally visible. */ in clkdom_finit()
453 OF_device_register_xref(OF_xref_from_node(node), clkdom->dev); in clkdom_finit()
456 /* Register all clock names into global list. */ in clkdom_finit()
457 TAILQ_FOREACH(clknode, &clkdom->clknode_list, clkdom_link) { in clkdom_finit()
464 TAILQ_FOREACH(clknode, &clkdom->clknode_list, clkdom_link) { in clkdom_finit()
465 if (clknode->parent_cnt == 0) in clkdom_finit()
467 for (i = 0; i < clknode->parent_cnt; i++) { in clkdom_finit()
468 if (clknode->parents[i] != NULL) in clkdom_finit()
470 if (clknode->parent_names[i] == NULL) in clkdom_finit()
472 clknode->parents[i] = clknode_find_by_name( in clkdom_finit()
473 clknode->parent_names[i]); in clkdom_finit()
474 if (clknode->parents[i] == NULL) { in clkdom_finit()
475 device_printf(clkdom->dev, in clkdom_finit()
476 "Clock %s have unknown parent: %s\n", in clkdom_finit()
477 clknode->name, clknode->parent_names[i]); in clkdom_finit()
483 if (clknode->parent_idx == CLKNODE_IDX_NONE) { in clkdom_finit()
484 device_printf(clkdom->dev, in clkdom_finit()
485 "Clock %s have not set parent idx\n", in clkdom_finit()
486 clknode->name); in clkdom_finit()
490 if (clknode->parents[clknode->parent_idx] == NULL) { in clkdom_finit()
491 device_printf(clkdom->dev, in clkdom_finit()
492 "Clock %s have unknown parent(idx %d): %s\n", in clkdom_finit()
493 clknode->name, clknode->parent_idx, in clkdom_finit()
494 clknode->parent_names[clknode->parent_idx]); in clkdom_finit()
498 clknode_adjust_parent(clknode, clknode->parent_idx); in clkdom_finit()
504 /* Dump clock domain. */
510 uint64_t freq; in clkdom_dump() local
513 TAILQ_FOREACH(clknode, &clkdom->clknode_list, clkdom_link) { in clkdom_dump()
514 rv = clknode_get_freq(clknode, &freq); in clkdom_dump()
516 printf("Clock: %s, error getting frequency: %d\n", in clkdom_dump()
517 clknode->name, rv); in clkdom_dump()
521 if (clknode->parent != NULL) { in clkdom_dump()
522 printf("Clock: %s, parent: %s(%d), freq: %ju\n", in clkdom_dump()
523 clknode->name, clknode->parent->name, in clkdom_dump()
524 clknode->parent_idx, (uintmax_t)freq); in clkdom_dump()
526 printf("Clock: %s, parent: none, freq: %ju\n", in clkdom_dump()
527 clknode->name, (uintmax_t)freq); in clkdom_dump()
534 * Create and initialize clock object, but do not register it.
546 KASSERT(def->name != NULL, ("clock name is NULL")); in clknode_create()
547 KASSERT(def->name[0] != '\0', ("clock name is empty")); in clknode_create()
548 if (def->flags & CLK_NODE_LINKED) { in clknode_create()
549 KASSERT(def->parent_cnt == 0, in clknode_create()
550 ("Linked clock must not have parents")); in clknode_create()
551 KASSERT(clknode_class->size== 0, in clknode_create()
552 ("Linked clock cannot have own softc")); in clknode_create()
557 clknode = clknode_find_by_name(def->name); in clknode_create()
560 if (!(clknode->flags & CLK_NODE_LINKED) && in clknode_create()
561 def->flags & CLK_NODE_LINKED) { in clknode_create()
563 * New clock is linked and real already exists. in clknode_create()
568 } else if (clknode->flags & CLK_NODE_LINKED && in clknode_create()
569 !(def->flags & CLK_NODE_LINKED)) { in clknode_create()
571 * New clock is real but linked already exists. in clknode_create()
573 * (real clock must be owned by another) and from in clknode_create()
581 KASSERT(clkdom != clknode->clkdom, in clknode_create()
582 ("linked clock must be from another " in clknode_create()
584 TAILQ_REMOVE(&clkdom->clknode_list, clknode, in clknode_create()
588 } else if (clknode->flags & CLK_NODE_LINKED && in clknode_create()
589 def->flags & CLK_NODE_LINKED) { in clknode_create()
597 panic("Duplicated clock registration: %s\n", def->name); in clknode_create()
603 sx_init(&clknode->lock, "Clocknode lock"); in clknode_create()
604 TAILQ_INIT(&clknode->children); in clknode_create()
611 if (clknode_class->size > 0) { in clknode_create()
612 clknode->softc = malloc(clknode_class->size, in clknode_create()
617 clknode->parents = malloc(sizeof(struct clknode *) * def->parent_cnt, in clknode_create()
621 if (def->flags & CLK_NODE_STATIC_STRINGS) { in clknode_create()
622 clknode->name = def->name; in clknode_create()
623 clknode->parent_names = def->parent_names; in clknode_create()
625 clknode->name = strdup(def->name, M_CLOCK); in clknode_create()
626 clknode->parent_names = in clknode_create()
627 strdup_list(def->parent_names, def->parent_cnt); in clknode_create()
631 clknode->id = def->id; in clknode_create()
632 clknode->clkdom = clkdom; in clknode_create()
633 clknode->flags = def->flags; in clknode_create()
634 clknode->parent_cnt = def->parent_cnt; in clknode_create()
635 clknode->parent = NULL; in clknode_create()
636 clknode->parent_idx = CLKNODE_IDX_NONE; in clknode_create()
641 sysctl_ctx_init(&clknode->sysctl_ctx); in clknode_create()
642 clknode_oid = SYSCTL_ADD_NODE(&clknode->sysctl_ctx, in clknode_create()
644 OID_AUTO, clknode->name, in clknode_create()
645 CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "A clock node"); in clknode_create()
647 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, in clknode_create()
653 "The clock frequency"); in clknode_create()
657 kobj_method = kobj_lookup_method(((kobj_t)clknode)->ops->cls, NULL, in clknode_create()
659 if (kobj_method != &kobj_desc->deflt && in clknode_create()
660 kobj_method->func != (kobjop_t)clknode_method_set_gate) { in clknode_create()
661 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, in clknode_create()
667 "The clock gate status"); in clknode_create()
670 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, in clknode_create()
676 "The clock parent"); in clknode_create()
677 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, in clknode_create()
683 "The clock parents list"); in clknode_create()
684 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, in clknode_create()
690 "The clock childrens list"); in clknode_create()
691 SYSCTL_ADD_INT(&clknode->sysctl_ctx, in clknode_create()
694 CTLFLAG_RD, &clknode->enable_cnt, 0, "The clock enable counter"); in clknode_create()
700 * Register clock object into clock domain hierarchy.
708 if (clknode->flags & CLK_NODE_REGISTERED) in clknode_register()
717 TAILQ_INSERT_TAIL(&clkdom->clknode_list, clknode, clkdom_link); in clknode_register()
718 clknode->flags |= CLK_NODE_REGISTERED; in clknode_register()
730 if (clknode->flags & CLK_NODE_LINKED) in clknode_finish()
731 printf("Unresolved linked clock found: %s\n", in clknode_finish()
732 clknode->name); in clknode_finish()
737 * Clock providers interface.
741 * Reparent clock node.
749 if (clknode->parent_cnt == 0) in clknode_adjust_parent()
751 if ((idx == CLKNODE_IDX_NONE) || (idx >= clknode->parent_cnt)) in clknode_adjust_parent()
752 panic("%s: Invalid parent index %d for clock %s", in clknode_adjust_parent()
753 __func__, idx, clknode->name); in clknode_adjust_parent()
755 if (clknode->parents[idx] == NULL) in clknode_adjust_parent()
756 panic("%s: Invalid parent index %d for clock %s", in clknode_adjust_parent()
757 __func__, idx, clknode->name); in clknode_adjust_parent()
760 if (clknode->parent != NULL) { in clknode_adjust_parent()
761 TAILQ_REMOVE(&clknode->parent->children, clknode, sibling_link); in clknode_adjust_parent()
765 clknode->parent_idx = idx; in clknode_adjust_parent()
766 clknode->parent = clknode->parents[idx]; in clknode_adjust_parent()
767 TAILQ_INSERT_TAIL(&clknode->parent->children, clknode, sibling_link); in clknode_adjust_parent()
771 * Set parent index - init function.
777 if (clknode->parent_cnt == 0) { in clknode_init_parent_idx()
778 clknode->parent_idx = CLKNODE_IDX_NONE; in clknode_init_parent_idx()
779 clknode->parent = NULL; in clknode_init_parent_idx()
783 (idx >= clknode->parent_cnt) || in clknode_init_parent_idx()
784 (clknode->parent_names[idx] == NULL)) in clknode_init_parent_idx()
785 panic("%s: Invalid parent index %d for clock %s", in clknode_init_parent_idx()
786 __func__, idx, clknode->name); in clknode_init_parent_idx()
787 clknode->parent_idx = idx; in clknode_init_parent_idx()
794 uint64_t freq; in clknode_set_parent_by_idx() local
800 if (clknode->parent_cnt == 0) in clknode_set_parent_by_idx()
803 if (clknode->parent_idx == idx) in clknode_set_parent_by_idx()
806 oldidx = clknode->parent_idx; in clknode_set_parent_by_idx()
813 rv = clknode_get_freq(clknode->parent, &freq); in clknode_set_parent_by_idx()
816 rv = clknode_refresh_cache(clknode, freq); in clknode_set_parent_by_idx()
824 uint64_t freq; in clknode_set_parent_by_name() local
830 if (clknode->parent_cnt == 0) in clknode_set_parent_by_name()
835 * This feature is used in clock domain initialization and allows us to in clknode_set_parent_by_name()
836 * set clock source and target frequency on the tail node of the clock in clknode_set_parent_by_name()
839 if (clknode->parent_cnt == 1) { in clknode_set_parent_by_name()
840 rv = clknode_set_parent_by_name(clknode->parent, name); in clknode_set_parent_by_name()
844 for (idx = 0; idx < clknode->parent_cnt; idx++) { in clknode_set_parent_by_name()
845 if (clknode->parent_names[idx] == NULL) in clknode_set_parent_by_name()
847 if (strcmp(clknode->parent_names[idx], name) == 0) in clknode_set_parent_by_name()
850 if (idx >= clknode->parent_cnt) { in clknode_set_parent_by_name()
853 if (clknode->parent_idx == idx) in clknode_set_parent_by_name()
856 oldidx = clknode->parent_idx; in clknode_set_parent_by_name()
864 rv = clknode_get_freq(clknode->parent, &freq); in clknode_set_parent_by_name()
867 rv = clknode_refresh_cache(clknode, freq); in clknode_set_parent_by_name()
875 return (clknode->parent); in clknode_get_parent()
882 return (clknode->name); in clknode_get_name()
889 return (clknode->parent_names); in clknode_get_parent_names()
896 return (clknode->parent_cnt); in clknode_get_parents_num()
903 return (clknode->parent_idx); in clknode_get_parent_idx()
910 return (clknode->flags); in clknode_get_flags()
918 return (clknode->softc); in clknode_get_softc()
925 return (clknode->clkdom->dev); in clknode_get_device()
933 clkdom->ofw_mapper = map; in clkdom_set_ofw_mapper()
941 clknode_get_freq(struct clknode *clknode, uint64_t *freq) in clknode_get_freq() argument
948 *freq = clknode->freq; in clknode_get_freq()
949 if (*freq != 0) in clknode_get_freq()
952 /* Get frequency from parent, if the clock has a parent. */ in clknode_get_freq()
953 if (clknode->parent_cnt > 0) { in clknode_get_freq()
954 rv = clknode_get_freq(clknode->parent, freq); in clknode_get_freq()
962 rv = CLKNODE_RECALC_FREQ(clknode, freq); in clknode_get_freq()
966 clknode->name, rv); in clknode_get_freq()
971 clknode->freq = *freq; in clknode_get_freq()
977 _clknode_set_freq(struct clknode *clknode, uint64_t *freq, int flags, in _clknode_set_freq() argument
987 if (clknode->freq == *freq) in _clknode_set_freq()
994 * clock is disabled in _clknode_set_freq()
996 * clock is glitch free and is enabled by calling consumer only in _clknode_set_freq()
999 clknode->enable_cnt > 1 && in _clknode_set_freq()
1000 clknode->enable_cnt > enablecnt && in _clknode_set_freq()
1001 (clknode->flags & CLK_NODE_GLITCH_FREE) == 0) { in _clknode_set_freq()
1005 /* Get frequency from parent, if the clock has a parent. */ in _clknode_set_freq()
1006 if (clknode->parent_cnt > 0) { in _clknode_set_freq()
1007 rv = clknode_get_freq(clknode->parent, &parent_freq); in _clknode_set_freq()
1013 /* Set frequency for this clock. */ in _clknode_set_freq()
1014 rv = CLKNODE_SET_FREQ(clknode, parent_freq, freq, flags, &done); in _clknode_set_freq()
1017 clknode->name, rv); in _clknode_set_freq()
1024 /* Success - invalidate frequency cache for all children. */ in _clknode_set_freq()
1026 clknode->freq = *freq; in _clknode_set_freq()
1027 /* Clock might have reparent during set_freq */ in _clknode_set_freq()
1028 if (clknode->parent_cnt > 0) { in _clknode_set_freq()
1029 rv = clknode_get_freq(clknode->parent, in _clknode_set_freq()
1037 } else if (clknode->parent != NULL) { in _clknode_set_freq()
1039 rv = _clknode_set_freq(clknode->parent, freq, flags, in _clknode_set_freq()
1044 clknode->name); in _clknode_set_freq()
1052 clknode_set_freq(struct clknode *clknode, uint64_t freq, int flags, in clknode_set_freq() argument
1056 return (_clknode_set_freq(clknode, &freq, flags, enablecnt)); in clknode_set_freq()
1060 clknode_test_freq(struct clknode *clknode, uint64_t freq, int flags, in clknode_test_freq() argument
1065 rv = _clknode_set_freq(clknode, &freq, flags | CLK_SET_DRYRUN, in clknode_test_freq()
1068 *out_freq = freq; in clknode_test_freq()
1080 /* Enable clock for each node in chain, starting from source. */ in clknode_enable()
1081 if (clknode->parent_cnt > 0) { in clknode_enable()
1082 rv = clknode_enable(clknode->parent); in clknode_enable()
1090 if (clknode->enable_cnt == 0) { in clknode_enable()
1097 clknode->enable_cnt++; in clknode_enable()
1111 /* Disable clock for each node in chain, starting from consumer. */ in clknode_disable()
1112 if ((clknode->enable_cnt == 1) && in clknode_disable()
1113 ((clknode->flags & CLK_NODE_CANNOT_STOP) == 0)) { in clknode_disable()
1120 clknode->enable_cnt--; in clknode_disable()
1123 if (clknode->parent_cnt > 0) { in clknode_disable()
1124 rv = clknode_disable(clknode->parent); in clknode_disable()
1139 if ((clknode->enable_cnt != 0) && (depth == 0)) { in clknode_stop()
1143 /* Stop clock for each node in chain, starting from consumer. */ in clknode_stop()
1144 if ((clknode->enable_cnt == 0) && in clknode_stop()
1145 ((clknode->flags & CLK_NODE_CANNOT_STOP) == 0)) { in clknode_stop()
1154 if (clknode->parent_cnt > 0) in clknode_stop()
1155 rv = clknode_stop(clknode->parent, depth + 1); in clknode_stop()
1159 /* --------------------------------------------------------------------------
1161 * Clock consumers interface.
1173 clk->dev = dev; in clk_create()
1174 clk->clknode = clknode; in clk_create()
1175 clk->enable_cnt = 0; in clk_create()
1176 clknode->ref_cnt++; in clk_create()
1182 clk_get_freq(clk_t clk, uint64_t *freq) in clk_get_freq() argument
1187 clknode = clk->clknode; in clk_get_freq()
1188 KASSERT(clknode->ref_cnt > 0, in clk_get_freq()
1189 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_get_freq()
1192 rv = clknode_get_freq(clknode, freq); in clk_get_freq()
1198 clk_set_freq(clk_t clk, uint64_t freq, int flags) in clk_set_freq() argument
1204 clknode = clk->clknode; in clk_set_freq()
1205 KASSERT(clknode->ref_cnt > 0, in clk_set_freq()
1206 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_set_freq()
1209 rv = clknode_set_freq(clknode, freq, flags, clk->enable_cnt); in clk_set_freq()
1215 clk_test_freq(clk_t clk, uint64_t freq, int flags) in clk_test_freq() argument
1221 clknode = clk->clknode; in clk_test_freq()
1222 KASSERT(clknode->ref_cnt > 0, in clk_test_freq()
1223 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_test_freq()
1226 rv = clknode_set_freq(clknode, freq, flags | CLK_SET_DRYRUN, 0); in clk_test_freq()
1237 clknode = clk->clknode; in clk_get_parent()
1238 KASSERT(clknode->ref_cnt > 0, in clk_get_parent()
1239 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_get_parent()
1247 *parent = clk_create(parentnode, clk->dev); in clk_get_parent()
1259 clknode = clk->clknode; in clk_set_parent_by_clk()
1260 parentnode = parent->clknode; in clk_set_parent_by_clk()
1261 KASSERT(clknode->ref_cnt > 0, in clk_set_parent_by_clk()
1262 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_set_parent_by_clk()
1263 KASSERT(parentnode->ref_cnt > 0, in clk_set_parent_by_clk()
1264 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_set_parent_by_clk()
1266 rv = clknode_set_parent_by_name(clknode, parentnode->name); in clk_set_parent_by_clk()
1277 clknode = clk->clknode; in clk_enable()
1278 KASSERT(clknode->ref_cnt > 0, in clk_enable()
1279 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_enable()
1283 clk->enable_cnt++; in clk_enable()
1294 clknode = clk->clknode; in clk_disable()
1295 KASSERT(clknode->ref_cnt > 0, in clk_disable()
1296 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_disable()
1297 KASSERT(clk->enable_cnt > 0, in clk_disable()
1298 ("Attempt to disable already disabled clock: %s\n", clknode->name)); in clk_disable()
1302 clk->enable_cnt--; in clk_disable()
1313 clknode = clk->clknode; in clk_stop()
1314 KASSERT(clknode->ref_cnt > 0, in clk_stop()
1315 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_stop()
1316 KASSERT(clk->enable_cnt == 0, in clk_stop()
1317 ("Attempt to stop already enabled clock: %s\n", clknode->name)); in clk_stop()
1330 clknode = clk->clknode; in clk_release()
1331 KASSERT(clknode->ref_cnt > 0, in clk_release()
1332 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_release()
1334 while (clk->enable_cnt > 0) { in clk_release()
1336 clk->enable_cnt--; in clk_release()
1339 clknode->ref_cnt--; in clk_release()
1353 clknode = clk->clknode; in clk_get_name()
1354 KASSERT(clknode->ref_cnt > 0, in clk_get_name()
1355 ("Attempt to access unreferenced clock: %s\n", clknode->name)); in clk_get_name()
1404 "assigned-clock-parents", idx, &parent); in clk_set_assigned_parent()
1415 "Cannot set parent %s for clock %s\n", in clk_set_assigned_parent()
1424 clk_set_assigned_rates(device_t dev, clk_t clk, uint32_t freq) in clk_set_assigned_rates() argument
1428 rv = clk_set_freq(clk, freq, CLK_SET_ROUND_DOWN | CLK_SET_ROUND_UP); in clk_set_assigned_rates()
1431 clk_get_name(clk), freq); in clk_set_assigned_rates()
1436 clk_get_name(clk), freq); in clk_set_assigned_rates()
1447 "assigned-clocks", "#clock-cells", &nclocks); in clk_set_assigned()
1452 "cannot parse assigned-clock property\n"); in clk_set_assigned()
1456 nrates = OF_getencprop_alloc_multi(node, "assigned-clock-rates", in clk_set_assigned()
1462 "assigned-clock-parents", "#clock-cells", &nparents) != 0) in clk_set_assigned()
1463 nparents = -1; in clk_set_assigned()
1465 /* First get the clock we are supposed to modify */ in clk_set_assigned()
1466 rv = clk_get_by_ofw_index_prop(dev, 0, "assigned-clocks", in clk_set_assigned()
1471 "cannot get assigned clock at idx %d\n", in clk_set_assigned()
1511 rv = ofw_bus_parse_xref_list_alloc(cnode, prop, "#clock-cells", idx, in clk_get_by_ofw_index_prop()
1531 rv = clkdom->ofw_mapper(clkdom, ncells, cells, &clknode); in clk_get_by_ofw_index_prop()
1561 rv = ofw_bus_find_string_index(cnode, "clock-names", name, &idx); in clk_get_by_ofw_name()
1567 /* --------------------------------------------------------------------------
1569 * Support functions for parsing various clock related OFW things.
1573 * Get "clock-output-names" and (optional) "clock-indices" lists.
1586 if (!OF_hasprop(node, "clock-output-names")) in clk_parse_ofw_out_names()
1588 rv = ofw_bus_string_list_to_array(node, "clock-output-names", in clk_parse_ofw_out_names()
1594 if (!OF_hasprop(node, "clock-indices")) in clk_parse_ofw_out_names()
1596 rv = OF_getencprop_alloc_multi(node, "clock-indices", sizeof (uint32_t), in clk_parse_ofw_out_names()
1599 device_printf(dev, " Size of 'clock-output-names' and " in clk_parse_ofw_out_names()
1600 "'clock-indices' differs\n"); in clk_parse_ofw_out_names()
1609 * Get output clock name for single output clock node.
1619 if (!OF_hasprop(node, "clock-output-names")) { in clk_parse_ofw_clk_name()
1626 rv = ofw_bus_string_list_to_array(node, "clock-output-names", in clk_parse_ofw_clk_name()
1630 device_printf(dev, "Malformed 'clock-output-names' property\n"); in clk_parse_ofw_clk_name()
1652 TAILQ_FOREACH(clknode, &clkdom->clknode_list, clkdom_link) { in clkdom_sysctl()
1653 sbuf_printf(sb, "%s ", clknode->name); in clkdom_sysctl()
1669 uint64_t freq; in clknode_sysctl() local
1681 if (clknode->parent) in clknode_sysctl()
1682 sbuf_printf(sb, "%s", clknode->parent->name); in clknode_sysctl()
1686 for (i = 0; i < clknode->parent_cnt; i++) in clknode_sysctl()
1690 TAILQ_FOREACH(children, &(clknode->children), sibling_link) { in clknode_sysctl()
1691 sbuf_printf(sb, "%s ", children->name); in clknode_sysctl()
1695 ret = clknode_get_freq(clknode, &freq); in clknode_sysctl()
1697 sbuf_printf(sb, "%ju ", (uintmax_t)freq); in clknode_sysctl()