Lines Matching refs:node
18 int ofnode_read_u32(ofnode node, const char *propname, u32 *outp) in ofnode_read_u32() argument
20 assert(ofnode_valid(node)); in ofnode_read_u32()
23 if (ofnode_is_np(node)) { in ofnode_read_u32()
24 return of_read_u32(ofnode_to_np(node), propname, outp); in ofnode_read_u32()
29 cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), in ofnode_read_u32()
42 int ofnode_read_u32_default(ofnode node, const char *propname, u32 def) in ofnode_read_u32_default() argument
44 assert(ofnode_valid(node)); in ofnode_read_u32_default()
45 ofnode_read_u32(node, propname, &def); in ofnode_read_u32_default()
50 int ofnode_read_s32_default(ofnode node, const char *propname, s32 def) in ofnode_read_s32_default() argument
52 assert(ofnode_valid(node)); in ofnode_read_s32_default()
53 ofnode_read_u32(node, propname, (u32 *)&def); in ofnode_read_s32_default()
58 bool ofnode_read_bool(ofnode node, const char *propname) in ofnode_read_bool() argument
62 assert(ofnode_valid(node)); in ofnode_read_bool()
65 prop = ofnode_get_property(node, propname, NULL); in ofnode_read_bool()
72 const char *ofnode_read_string(ofnode node, const char *propname) in ofnode_read_string() argument
77 assert(ofnode_valid(node)); in ofnode_read_string()
80 if (ofnode_is_np(node)) { in ofnode_read_string()
82 ofnode_to_np(node), propname, NULL); in ofnode_read_string()
89 str = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), in ofnode_read_string()
105 ofnode ofnode_find_subnode(ofnode node, const char *subnode_name) in ofnode_find_subnode() argument
109 assert(ofnode_valid(node)); in ofnode_find_subnode()
112 if (ofnode_is_np(node)) { in ofnode_find_subnode()
113 const struct device_node *np = ofnode_to_np(node); in ofnode_find_subnode()
122 ofnode_to_offset(node), subnode_name); in ofnode_find_subnode()
131 int ofnode_read_u32_array(ofnode node, const char *propname, in ofnode_read_u32_array() argument
134 assert(ofnode_valid(node)); in ofnode_read_u32_array()
137 if (ofnode_is_np(node)) { in ofnode_read_u32_array()
138 return of_read_u32_array(ofnode_to_np(node), propname, in ofnode_read_u32_array()
142 ofnode_to_offset(node), propname, in ofnode_read_u32_array()
147 ofnode ofnode_first_subnode(ofnode node) in ofnode_first_subnode() argument
149 assert(ofnode_valid(node)); in ofnode_first_subnode()
150 if (ofnode_is_np(node)) in ofnode_first_subnode()
151 return np_to_ofnode(node.np->child); in ofnode_first_subnode()
154 fdt_first_subnode(gd->fdt_blob, ofnode_to_offset(node))); in ofnode_first_subnode()
157 ofnode ofnode_next_subnode(ofnode node) in ofnode_next_subnode() argument
159 assert(ofnode_valid(node)); in ofnode_next_subnode()
160 if (ofnode_is_np(node)) in ofnode_next_subnode()
161 return np_to_ofnode(node.np->sibling); in ofnode_next_subnode()
164 fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node))); in ofnode_next_subnode()
167 ofnode ofnode_get_parent(ofnode node) in ofnode_get_parent() argument
171 assert(ofnode_valid(node)); in ofnode_get_parent()
172 if (ofnode_is_np(node)) in ofnode_get_parent()
173 parent = np_to_ofnode(of_get_parent(ofnode_to_np(node))); in ofnode_get_parent()
176 ofnode_to_offset(node)); in ofnode_get_parent()
181 const char *ofnode_get_name(ofnode node) in ofnode_get_name() argument
183 assert(ofnode_valid(node)); in ofnode_get_name()
184 if (ofnode_is_np(node)) in ofnode_get_name()
185 return strrchr(node.np->full_name, '/') + 1; in ofnode_get_name()
187 return fdt_get_name(gd->fdt_blob, ofnode_to_offset(node), NULL); in ofnode_get_name()
192 ofnode node; in ofnode_get_by_phandle() local
195 node = np_to_ofnode(of_find_node_by_phandle(phandle)); in ofnode_get_by_phandle()
197 node.of_offset = fdt_node_offset_by_phandle(gd->fdt_blob, in ofnode_get_by_phandle()
200 return node; in ofnode_get_by_phandle()
203 int ofnode_read_size(ofnode node, const char *propname) in ofnode_read_size() argument
207 if (ofnode_is_np(node)) { in ofnode_read_size()
209 ofnode_to_np(node), propname, NULL); in ofnode_read_size()
214 if (fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname, in ofnode_read_size()
222 fdt_addr_t ofnode_get_addr_index(ofnode node, int index) in ofnode_get_addr_index() argument
224 if (ofnode_is_np(node)) { in ofnode_get_addr_index()
231 prop_val = of_get_address(ofnode_to_np(node), index, &size, in ofnode_get_addr_index()
236 ns = of_n_size_cells(ofnode_to_np(node)); in ofnode_get_addr_index()
239 return of_translate_address(ofnode_to_np(node), prop_val); in ofnode_get_addr_index()
241 na = of_n_addr_cells(ofnode_to_np(node)); in ofnode_get_addr_index()
246 ofnode_to_offset(node)); in ofnode_get_addr_index()
252 fdt_addr_t ofnode_get_addr(ofnode node) in ofnode_get_addr() argument
254 return ofnode_get_addr_index(node, 0); in ofnode_get_addr()
257 int ofnode_stringlist_search(ofnode node, const char *property, in ofnode_stringlist_search() argument
260 if (ofnode_is_np(node)) { in ofnode_stringlist_search()
261 return of_property_match_string(ofnode_to_np(node), in ofnode_stringlist_search()
267 ofnode_to_offset(node), property, in ofnode_stringlist_search()
278 int ofnode_read_string_index(ofnode node, const char *property, int index, in ofnode_read_string_index() argument
281 if (ofnode_is_np(node)) { in ofnode_read_string_index()
282 return of_property_read_string_index(ofnode_to_np(node), in ofnode_read_string_index()
287 *outp = fdt_stringlist_get(gd->fdt_blob, ofnode_to_offset(node), in ofnode_read_string_index()
295 int ofnode_read_string_count(ofnode node, const char *property) in ofnode_read_string_count() argument
297 if (ofnode_is_np(node)) { in ofnode_read_string_count()
298 return of_property_count_strings(ofnode_to_np(node), property); in ofnode_read_string_count()
301 ofnode_to_offset(node), property); in ofnode_read_string_count()
309 out->node = offset_to_ofnode(in->node); in ofnode_from_fdtdec_phandle_args()
318 out->node = np_to_ofnode(in->np); in ofnode_from_of_phandle_args()
323 int ofnode_parse_phandle_with_args(ofnode node, const char *list_name, in ofnode_parse_phandle_with_args() argument
328 if (ofnode_is_np(node)) { in ofnode_parse_phandle_with_args()
332 ret = of_parse_phandle_with_args(ofnode_to_np(node), in ofnode_parse_phandle_with_args()
343 ofnode_to_offset(node), in ofnode_parse_phandle_with_args()
354 int ofnode_count_phandle_with_args(ofnode node, const char *list_name, in ofnode_count_phandle_with_args() argument
357 if (ofnode_is_np(node)) in ofnode_count_phandle_with_args()
358 return of_count_phandle_with_args(ofnode_to_np(node), in ofnode_count_phandle_with_args()
362 ofnode_to_offset(node), list_name, cells_name, in ofnode_count_phandle_with_args()
394 static int decode_timing_property(ofnode node, const char *name, in decode_timing_property() argument
399 length = ofnode_read_size(node, name); in decode_timing_property()
402 ofnode_get_name(node), name); in decode_timing_property()
407 result->typ = ofnode_read_u32_default(node, name, 0); in decode_timing_property()
411 ret = ofnode_read_u32_array(node, name, &result->min, 3); in decode_timing_property()
421 ofnode timings, node; in ofnode_decode_display_timing() local
430 ofnode_for_each_subnode(node, timings) { in ofnode_decode_display_timing()
435 if (!ofnode_valid(node)) in ofnode_decode_display_timing()
440 ret |= decode_timing_property(node, "hback-porch", &dt->hback_porch); in ofnode_decode_display_timing()
441 ret |= decode_timing_property(node, "hfront-porch", &dt->hfront_porch); in ofnode_decode_display_timing()
442 ret |= decode_timing_property(node, "hactive", &dt->hactive); in ofnode_decode_display_timing()
443 ret |= decode_timing_property(node, "hsync-len", &dt->hsync_len); in ofnode_decode_display_timing()
444 ret |= decode_timing_property(node, "vback-porch", &dt->vback_porch); in ofnode_decode_display_timing()
445 ret |= decode_timing_property(node, "vfront-porch", &dt->vfront_porch); in ofnode_decode_display_timing()
446 ret |= decode_timing_property(node, "vactive", &dt->vactive); in ofnode_decode_display_timing()
447 ret |= decode_timing_property(node, "vsync-len", &dt->vsync_len); in ofnode_decode_display_timing()
448 ret |= decode_timing_property(node, "clock-frequency", &dt->pixelclock); in ofnode_decode_display_timing()
451 val = ofnode_read_u32_default(node, "vsync-active", -1); in ofnode_decode_display_timing()
456 val = ofnode_read_u32_default(node, "hsync-active", -1); in ofnode_decode_display_timing()
461 val = ofnode_read_u32_default(node, "de-active", -1); in ofnode_decode_display_timing()
466 val = ofnode_read_u32_default(node, "pixelclk-active", -1); in ofnode_decode_display_timing()
472 if (ofnode_read_bool(node, "interlaced")) in ofnode_decode_display_timing()
474 if (ofnode_read_bool(node, "doublescan")) in ofnode_decode_display_timing()
476 if (ofnode_read_bool(node, "doubleclk")) in ofnode_decode_display_timing()
482 const void *ofnode_get_property(ofnode node, const char *propname, int *lenp) in ofnode_get_property() argument
484 if (ofnode_is_np(node)) in ofnode_get_property()
485 return of_get_property(ofnode_to_np(node), propname, lenp); in ofnode_get_property()
487 return fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), in ofnode_get_property()
491 bool ofnode_is_available(ofnode node) in ofnode_is_available() argument
493 if (ofnode_is_np(node)) in ofnode_is_available()
494 return of_device_is_available(ofnode_to_np(node)); in ofnode_is_available()
497 ofnode_to_offset(node)); in ofnode_is_available()
500 fdt_addr_t ofnode_get_addr_size(ofnode node, const char *property, in ofnode_get_addr_size() argument
503 if (ofnode_is_np(node)) { in ofnode_get_addr_size()
506 const struct device_node *np = ofnode_to_np(node); in ofnode_get_addr_size()
517 ofnode_to_offset(node), property, in ofnode_get_addr_size()
522 const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname, in ofnode_read_u8_array_ptr() argument
525 if (ofnode_is_np(node)) { in ofnode_read_u8_array_ptr()
526 const struct device_node *np = ofnode_to_np(node); in ofnode_read_u8_array_ptr()
536 ofnode_to_offset(node), propname, sz); in ofnode_read_u8_array_ptr()
540 int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type, in ofnode_read_pci_addr() argument
555 cell = ofnode_get_property(node, propname, &len); in ofnode_read_pci_addr()
594 int ofnode_read_addr_cells(ofnode node) in ofnode_read_addr_cells() argument
596 if (ofnode_is_np(node)) in ofnode_read_addr_cells()
597 return of_n_addr_cells(ofnode_to_np(node)); in ofnode_read_addr_cells()
599 return fdt_address_cells(gd->fdt_blob, ofnode_to_offset(node)); in ofnode_read_addr_cells()
602 int ofnode_read_size_cells(ofnode node) in ofnode_read_size_cells() argument
604 if (ofnode_is_np(node)) in ofnode_read_size_cells()
605 return of_n_size_cells(ofnode_to_np(node)); in ofnode_read_size_cells()
607 return fdt_size_cells(gd->fdt_blob, ofnode_to_offset(node)); in ofnode_read_size_cells()
610 int ofnode_read_simple_addr_cells(ofnode node) in ofnode_read_simple_addr_cells() argument
612 if (ofnode_is_np(node)) in ofnode_read_simple_addr_cells()
613 return of_simple_addr_cells(ofnode_to_np(node)); in ofnode_read_simple_addr_cells()
615 return fdt_address_cells(gd->fdt_blob, ofnode_to_offset(node)); in ofnode_read_simple_addr_cells()
618 int ofnode_read_simple_size_cells(ofnode node) in ofnode_read_simple_size_cells() argument
620 if (ofnode_is_np(node)) in ofnode_read_simple_size_cells()
621 return of_simple_size_cells(ofnode_to_np(node)); in ofnode_read_simple_size_cells()
623 return fdt_size_cells(gd->fdt_blob, ofnode_to_offset(node)); in ofnode_read_simple_size_cells()
626 bool ofnode_pre_reloc(ofnode node) in ofnode_pre_reloc() argument
628 if (ofnode_read_bool(node, "u-boot,dm-pre-reloc")) in ofnode_pre_reloc()
632 if (ofnode_read_bool(node, "u-boot,dm-tpl")) in ofnode_pre_reloc()
635 if (ofnode_read_bool(node, "u-boot,dm-spl")) in ofnode_pre_reloc()
642 if (ofnode_read_bool(node, "u-boot,dm-spl") || in ofnode_pre_reloc()
643 ofnode_read_bool(node, "u-boot,dm-tpl")) in ofnode_pre_reloc()
650 int ofnode_read_resource(ofnode node, uint index, struct resource *res) in ofnode_read_resource() argument
652 if (ofnode_is_np(node)) { in ofnode_read_resource()
653 return of_address_to_resource(ofnode_to_np(node), index, res); in ofnode_read_resource()
658 ret = fdt_get_resource(gd->fdt_blob, ofnode_to_offset(node), in ofnode_read_resource()
670 int ofnode_read_resource_byname(ofnode node, const char *name, in ofnode_read_resource_byname() argument
675 index = ofnode_stringlist_search(node, "reg-names", name); in ofnode_read_resource_byname()
679 return ofnode_read_resource(node, index, res); in ofnode_read_resource_byname()
682 u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr) in ofnode_translate_address() argument
684 if (ofnode_is_np(node)) in ofnode_translate_address()
685 return of_translate_address(ofnode_to_np(node), in_addr); in ofnode_translate_address()
687 return fdt_translate_address(gd->fdt_blob, ofnode_to_offset(node), in_addr); in ofnode_translate_address()
690 int ofnode_device_is_compatible(ofnode node, const char *compat) in ofnode_device_is_compatible() argument
692 if (ofnode_is_np(node)) in ofnode_device_is_compatible()
693 return of_device_is_compatible(ofnode_to_np(node), compat, in ofnode_device_is_compatible()
697 ofnode_to_offset(node), in ofnode_device_is_compatible()