Lines Matching refs:np
65 struct device_node *np; member
70 int of_n_addr_cells(const struct device_node *np) in of_n_addr_cells() argument
75 if (np->parent) in of_n_addr_cells()
76 np = np->parent; in of_n_addr_cells()
77 ip = of_get_property(np, "#address-cells", NULL); in of_n_addr_cells()
80 } while (np->parent); in of_n_addr_cells()
86 int of_n_size_cells(const struct device_node *np) in of_n_size_cells() argument
91 if (np->parent) in of_n_size_cells()
92 np = np->parent; in of_n_size_cells()
93 ip = of_get_property(np, "#size-cells", NULL); in of_n_size_cells()
96 } while (np->parent); in of_n_size_cells()
102 int of_simple_addr_cells(const struct device_node *np) in of_simple_addr_cells() argument
106 ip = of_get_property(np, "#address-cells", NULL); in of_simple_addr_cells()
114 int of_simple_size_cells(const struct device_node *np) in of_simple_size_cells() argument
118 ip = of_get_property(np, "#size-cells", NULL); in of_simple_size_cells()
126 struct property *of_find_property(const struct device_node *np, in of_find_property() argument
131 if (!np) in of_find_property()
134 for (pp = np->properties; pp; pp = pp->next) { in of_find_property()
149 struct device_node *np; in of_find_all_nodes() local
152 np = gd->of_root; in of_find_all_nodes()
154 np = prev->child; in of_find_all_nodes()
160 np = prev; in of_find_all_nodes()
161 while (np->parent && !np->sibling) in of_find_all_nodes()
162 np = np->parent; in of_find_all_nodes()
163 np = np->sibling; /* Might be null at the end of the tree */ in of_find_all_nodes()
166 return np; in of_find_all_nodes()
169 const void *of_get_property(const struct device_node *np, const char *name, in of_get_property() argument
172 struct property *pp = of_find_property(np, name, lenp); in of_get_property()
177 const struct property *of_get_first_property(const struct device_node *np) in of_get_first_property() argument
179 if (!np) in of_get_first_property()
182 return np->properties; in of_get_first_property()
185 const struct property *of_get_next_property(const struct device_node *np, in of_get_next_property() argument
188 if (!np) in of_get_next_property()
194 const void *of_get_property_by_prop(const struct device_node *np, in of_get_property_by_prop() argument
199 if (!np || !property) in of_get_property_by_prop()
287 const struct device_node *np; in of_get_parent() local
292 np = of_node_get(node->parent); in of_get_parent()
294 return (struct device_node *)np; in of_get_parent()
349 struct device_node *np = NULL; in of_find_node_opts_by_path() local
375 np = of_find_node_by_path(pp->value); in of_find_node_opts_by_path()
379 if (!np) in of_find_node_opts_by_path()
385 if (!np) in of_find_node_opts_by_path()
386 np = of_node_get(gd->of_root); in of_find_node_opts_by_path()
387 while (np && *path == '/') { in of_find_node_opts_by_path()
388 struct device_node *tmp = np; in of_find_node_opts_by_path()
391 np = __of_find_node_by_path(np, path); in of_find_node_opts_by_path()
398 return np; in of_find_node_opts_by_path()
404 struct device_node *np; in of_find_compatible_node() local
406 for_each_of_allnodes_from(from, np) in of_find_compatible_node()
407 if (of_device_is_compatible(np, compatible, type, NULL) && in of_find_compatible_node()
408 of_node_get(np)) in of_find_compatible_node()
412 return np; in of_find_compatible_node()
430 struct device_node *np; in of_find_node_by_prop_value() local
432 for_each_of_allnodes_from(from, np) { in of_find_node_by_prop_value()
433 if (of_device_has_prop_value(np, propname, propval, proplen) && in of_find_node_by_prop_value()
434 of_node_get(np)) in of_find_node_by_prop_value()
439 return np; in of_find_node_by_prop_value()
444 struct device_node *np; in of_find_node_by_phandle() local
449 for_each_of_allnodes(np) in of_find_node_by_phandle()
450 if (np->phandle == handle) in of_find_node_by_phandle()
452 (void)of_node_get(np); in of_find_node_by_phandle()
454 return np; in of_find_node_by_phandle()
470 static void *of_find_property_value_of_size(const struct device_node *np, in of_find_property_value_of_size() argument
473 struct property *prop = of_find_property(np, propname, NULL); in of_find_property_value_of_size()
485 int of_read_u32(const struct device_node *np, const char *propname, u32 *outp) in of_read_u32() argument
487 return of_read_u32_index(np, propname, 0, outp); in of_read_u32()
490 int of_read_u32_array(const struct device_node *np, const char *propname, in of_read_u32_array() argument
496 val = of_find_property_value_of_size(np, propname, in of_read_u32_array()
509 int of_read_u32_index(const struct device_node *np, const char *propname, in of_read_u32_index() argument
515 if (!np) in of_read_u32_index()
518 val = of_find_property_value_of_size(np, propname, in of_read_u32_index()
531 int of_read_u64(const struct device_node *np, const char *propname, u64 *outp) in of_read_u64() argument
536 if (!np) in of_read_u64()
538 val = of_find_property_value_of_size(np, propname, sizeof(*outp)); in of_read_u64()
551 int of_property_match_string(const struct device_node *np, const char *propname, in of_property_match_string() argument
554 const struct property *prop = of_find_property(np, propname, NULL); in of_property_match_string()
589 int of_property_read_string_helper(const struct device_node *np, in of_property_read_string_helper() argument
593 const struct property *prop = of_find_property(np, propname, NULL); in of_property_read_string_helper()
615 static int __of_parse_phandle_with_args(const struct device_node *np, in __of_parse_phandle_with_args() argument
629 list = of_get_property(np, list_name, &size); in __of_parse_phandle_with_args()
658 np->full_name); in __of_parse_phandle_with_args()
666 np->full_name, cells_name, in __of_parse_phandle_with_args()
680 np->full_name); in __of_parse_phandle_with_args()
700 out_args->np = node; in __of_parse_phandle_with_args()
732 struct device_node *of_parse_phandle(const struct device_node *np, in of_parse_phandle() argument
740 if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, index, in of_parse_phandle()
744 return args.np; in of_parse_phandle()
747 int of_parse_phandle_with_args(const struct device_node *np, in of_parse_phandle_with_args() argument
755 return __of_parse_phandle_with_args(np, list_name, cells_name, in of_parse_phandle_with_args()
759 int of_count_phandle_with_args(const struct device_node *np, in of_count_phandle_with_args() argument
763 return __of_parse_phandle_with_args(np, list_name, cells_name, in of_count_phandle_with_args()
767 static void of_alias_add(struct alias_prop *ap, struct device_node *np, in of_alias_add() argument
770 ap->np = np; in of_alias_add()
776 ap->alias, ap->stem, ap->id, of_node_full_name(np)); in of_alias_add()
803 struct device_node *np; in of_alias_scan() local
814 np = of_find_node_by_path(pp->value); in of_alias_scan()
815 if (!np) in of_alias_scan()
835 of_alias_add(ap, np, id, start, len); in of_alias_scan()
841 int of_alias_get_id(const struct device_node *np, const char *stem) in of_alias_get_id() argument
851 if (np == app->np) { in of_alias_get_id()