Lines Matching +full:parent +full:- +full:clk
1 /*-
49 #include <dev/clk/clk.h>
57 struct clk;
65 static int clknode_method_init(struct clknode *clk, device_t dev);
66 static int clknode_method_recalc_freq(struct clknode *clk, uint64_t *freq);
67 static int clknode_method_set_freq(struct clknode *clk, uint64_t fin,
69 static int clknode_method_set_gate(struct clknode *clk, bool enable);
70 static int clknode_method_set_mux(struct clknode *clk, int idx);
87 * Clock node - basic element for modeling SOC clock graph. It holds the clock
99 /* String based parent list. */
100 const char **parent_names; /* Array of parent names */
102 int parent_idx; /* Parent index or -1 */
106 struct clknode *parent; /* Current parent */ member
108 /* Parent/child relationship links. */
110 TAILQ_ENTRY(clknode) sibling_link; /* Our entry in parent's list */
131 struct clk { struct
138 * Clock domain - a group of clocks provided by one clock device.
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.
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))
223 clknode_method_set_gate(struct clknode *clk, bool enable) in clknode_method_set_gate() argument
230 clknode_method_set_mux(struct clknode *clk, int idx) in clknode_method_set_mux() argument
241 * Duplicate an array of parent names.
262 panic("Clock parent names array have empty string"); in strdup_list()
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()
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 /* -------------------------------------------------------------------------- */
359 if (entry->dev == dev) in clkdom_get_by_dev()
370 phandle_t *cells, struct clknode **clk) in clknode_default_ofw_map() argument
376 *clk = clknode_find_by_id(clkdom, 1); in clknode_default_ofw_map()
378 *clk = clknode_find_by_id(clkdom, cells[0]); in clknode_default_ofw_map()
382 if (*clk == NULL) in clknode_default_ofw_map()
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()
441 if ((node = ofw_bus_get_node(clkdom->dev)) == -1) { in clkdom_finit()
442 device_printf(clkdom->dev, in clkdom_finit()
453 OF_device_register_xref(OF_xref_from_node(node), clkdom->dev); 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()
482 /* If parent index is not set yet... */ 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()
513 TAILQ_FOREACH(clknode, &clkdom->clknode_list, clkdom_link) { 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()
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()
551 KASSERT(clknode_class->size== 0, 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()
568 } else if (clknode->flags & CLK_NODE_LINKED && in clknode_create()
569 !(def->flags & CLK_NODE_LINKED)) { in clknode_create()
581 KASSERT(clkdom != clknode->clkdom, 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()
616 /* Prepare array for ptrs to parent clocks. */ 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()
647 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, 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()
670 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, in clknode_create()
672 OID_AUTO, "parent", in clknode_create()
676 "The clock parent"); in clknode_create()
677 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, in clknode_create()
684 SYSCTL_ADD_PROC(&clknode->sysctl_ctx, 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()
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()
732 clknode->name); in clknode_finish()
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()
764 /* Insert into children list of new parent. */ 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()
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()
830 if (clknode->parent_cnt == 0) in clknode_set_parent_by_name()
834 * If this node doesnt have mux, then passthrough request to parent. 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()
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()
948 *freq = clknode->freq; 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()
965 printf("Cannot get frequency for clk: %s, error: %d\n", in clknode_get_freq()
966 clknode->name, rv); in clknode_get_freq()
971 clknode->freq = *freq; in clknode_get_freq()
987 if (clknode->freq == *freq) 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()
1016 printf("Cannot set frequency for clk: %s, error: %d\n", 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()
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()
1038 /* Nothing changed, pass request to parent. */ in _clknode_set_freq()
1039 rv = _clknode_set_freq(clknode->parent, freq, flags, in _clknode_set_freq()
1043 printf("Cannot set frequency for clk: %s, end of chain\n", in _clknode_set_freq()
1044 clknode->name); in _clknode_set_freq()
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()
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()
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 /* --------------------------------------------------------------------------
1168 struct clk *clk; in clk_create() local
1172 clk = malloc(sizeof(struct clk), M_CLOCK, M_WAITOK); in clk_create()
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()
1178 return (clk); 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()
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()
1232 clk_get_parent(clk_t clk, clk_t *parent) in clk_get_parent() argument
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()
1253 clk_set_parent_by_clk(clk_t clk, clk_t parent) in clk_set_parent_by_clk() argument
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()
1272 clk_enable(clk_t clk) in clk_enable() argument
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()
1289 clk_disable(clk_t clk) in clk_disable() argument
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()
1308 clk_stop(clk_t clk) in clk_stop() argument
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()
1326 clk_release(clk_t clk) in clk_release() argument
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()
1343 free(clk, M_CLOCK); in clk_release()
1348 clk_get_name(clk_t clk) in clk_get_name() argument
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()
1361 clk_get_by_name(device_t dev, const char *name, clk_t *clk) in clk_get_by_name() argument
1371 *clk = clk_create(clknode, dev); in clk_get_by_name()
1377 clk_get_by_id(device_t dev, struct clkdom *clkdom, intptr_t id, clk_t *clk) in clk_get_by_id() argument
1388 *clk = clk_create(clknode, dev); in clk_get_by_id()
1397 clk_set_assigned_parent(device_t dev, clk_t clk, int idx) in clk_set_assigned_parent() argument
1399 clk_t parent; in clk_set_assigned_parent() local
1404 "assigned-clock-parents", idx, &parent); in clk_set_assigned_parent()
1407 "cannot get parent at idx %d\n", idx); in clk_set_assigned_parent()
1411 pname = clk_get_name(parent); in clk_set_assigned_parent()
1412 rv = clk_set_parent_by_clk(clk, parent); in clk_set_assigned_parent()
1415 "Cannot set parent %s for clock %s\n", in clk_set_assigned_parent()
1416 pname, clk_get_name(clk)); in clk_set_assigned_parent()
1418 device_printf(dev, "Set %s as the parent of %s\n", in clk_set_assigned_parent()
1419 pname, clk_get_name(clk)); in clk_set_assigned_parent()
1420 clk_release(parent); 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()
1442 clk_t clk; in clk_set_assigned() local
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()
1466 rv = clk_get_by_ofw_index_prop(dev, 0, "assigned-clocks", in clk_set_assigned()
1467 i, &clk); in clk_set_assigned()
1476 /* First set it's parent if needed */ in clk_set_assigned()
1478 clk_set_assigned_parent(dev, clk, i); in clk_set_assigned()
1482 clk_set_assigned_rates(dev, clk, rates[i]); in clk_set_assigned()
1484 clk_release(clk); in clk_set_assigned()
1493 clk_get_by_ofw_index_prop(device_t dev, phandle_t cnode, const char *prop, int idx, clk_t *clk) in clk_get_by_ofw_index_prop() argument
1495 phandle_t parent, *cells; in clk_get_by_ofw_index_prop() local
1501 *clk = NULL; in clk_get_by_ofw_index_prop()
1511 rv = ofw_bus_parse_xref_list_alloc(cnode, prop, "#clock-cells", idx, in clk_get_by_ofw_index_prop()
1512 &parent, &ncells, &cells); in clk_get_by_ofw_index_prop()
1517 clockdev = OF_device_from_xref(parent); in clk_get_by_ofw_index_prop()
1531 rv = clkdom->ofw_mapper(clkdom, ncells, cells, &clknode); in clk_get_by_ofw_index_prop()
1533 *clk = clk_create(clknode, dev); in clk_get_by_ofw_index_prop()
1544 clk_get_by_ofw_index(device_t dev, phandle_t cnode, int idx, clk_t *clk) in clk_get_by_ofw_index() argument
1546 return (clk_get_by_ofw_index_prop(dev, cnode, "clocks", idx, clk)); in clk_get_by_ofw_index()
1550 clk_get_by_ofw_name(device_t dev, phandle_t cnode, const char *name, clk_t *clk) in clk_get_by_ofw_name() argument
1561 rv = ofw_bus_find_string_index(cnode, "clock-names", name, &idx); in clk_get_by_ofw_name()
1564 return (clk_get_by_ofw_index(dev, cnode, idx, clk)); in clk_get_by_ofw_name()
1567 /* --------------------------------------------------------------------------
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()
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()
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()