Lines Matching full:node

20  * ofnode - reference to a device tree node
34 * There is no ambiguity as to whether ofnode holds an offset or a node
35 * pointer: when the live tree is active it holds a node pointer, otherwise it
37 * the same value could point to a valid device node or a valid offset. We
46 * @np: Pointer to device node, used for live tree
48 * is not a really a pointer to a node: it is an offset value. See above.
56 ofnode node; member
62 * _ofnode_to_np() - convert an ofnode to a live DT node pointer
66 * @node: Reference containing struct device_node * (possibly invalid)
67 * @return pointer to device node (can be NULL)
69 static inline const struct device_node *ofnode_to_np(ofnode node) in ofnode_to_np() argument
75 return node.np; in ofnode_to_np()
81 * This cannot be called if the reference contains a node pointer.
83 * @node: Reference containing offset (possibly invalid)
86 static inline int ofnode_to_offset(ofnode node) in ofnode_to_offset() argument
92 return node.of_offset; in ofnode_to_offset()
100 static inline bool ofnode_valid(ofnode node) in ofnode_valid() argument
103 return node.np != NULL; in ofnode_valid()
105 return node.of_offset != -1; in ofnode_valid()
116 ofnode node; in offset_to_ofnode() local
119 node.np = NULL; in offset_to_ofnode()
121 node.of_offset = of_offset; in offset_to_ofnode()
123 return node; in offset_to_ofnode()
127 * np_to_ofnode() - convert a node pointer to an ofnode
129 * @np: Live node pointer (can be NULL)
130 * @return reference to the associated node pointer
134 ofnode node; in np_to_ofnode() local
136 node.np = np; in np_to_ofnode()
138 return node; in np_to_ofnode()
142 * ofnode_is_np() - check if a reference is a node pointer
148 * @node: reference to check (possibly invalid)
149 * @return true if the reference is a live node pointer, false if it is a DT
152 static inline bool ofnode_is_np(ofnode node) in ofnode_is_np() argument
159 assert(!ofnode_valid(node) || in ofnode_is_np()
160 (of_live_active() ? _ofnode_to_np(node) in ofnode_is_np()
161 : _ofnode_to_np(node))); in ofnode_is_np()
163 return of_live_active() && ofnode_valid(node); in ofnode_is_np()
180 * This returns an ofnode which points to no node. It works both with the flat
185 ofnode node; in ofnode_null() local
188 node.np = NULL; in ofnode_null()
190 node.of_offset = -1; in ofnode_null()
192 return node; in ofnode_null()
198 * @ref: valid node reference to read property from
203 int ofnode_read_u32(ofnode node, const char *propname, u32 *outp);
208 * @ref: valid node reference to read property from
213 static inline int ofnode_read_s32(ofnode node, const char *propname, in ofnode_read_s32() argument
216 return ofnode_read_u32(node, propname, (u32 *)out_value); in ofnode_read_s32()
222 * @ref: valid node reference to read property from
232 * @ref: valid node reference to read property from
237 int ofnode_read_s32_default(ofnode node, const char *propname, s32 def);
242 * @node: valid node reference to read property from
247 int ofnode_read_u64(ofnode node, const char *propname, u64 *outp);
252 * @ref: valid node reference to read property from
257 int ofnode_read_u64_default(ofnode node, const char *propname, u64 def);
262 * @ref: valid node reference to read property from
266 const char *ofnode_read_string(ofnode node, const char *propname);
271 * @node: valid node reference to read property from
277 * Search for a property in a device node and read 32-bit value(s) from
284 int ofnode_read_u32_array(ofnode node, const char *propname,
290 * @node: valid node reference to read property from
294 bool ofnode_read_bool(ofnode node, const char *propname);
297 * ofnode_find_subnode() - find a named subnode of a parent node
299 * @node: valid reference to parent node
304 ofnode ofnode_find_subnode(ofnode node, const char *subnode_name);
307 * ofnode_first_subnode() - find the first subnode of a parent node
309 * @node: valid reference to a valid parent node
311 * node has no subnodes)
313 ofnode ofnode_first_subnode(ofnode node);
318 * @node: valid reference to previous node (sibling)
319 * @return reference to the next subnode (which can be invalid if the node
322 ofnode ofnode_next_subnode(ofnode node);
327 * @node: valid node to look up
328 * @return ofnode reference of the parent node
330 ofnode ofnode_get_parent(ofnode node);
333 * ofnode_get_name() - get the name of a node
335 * @node: valid node to look up
336 * @return name of node
338 const char *ofnode_get_name(ofnode node);
351 * @node: node to check
355 int ofnode_read_size(ofnode node, const char *propname);
358 * ofnode_get_addr_index() - get an address from a node
360 * This reads the register address from a node
362 * @node: node to read from
366 phys_addr_t ofnode_get_addr_index(ofnode node, int index);
369 * ofnode_get_addr() - get an address from a node
371 * This reads the register address from a node
373 * @node: node to read from
376 phys_addr_t ofnode_get_addr(ofnode node);
387 * @node: node to check
396 int ofnode_stringlist_search(ofnode node, const char *propname,
409 * @node: node to check
417 int ofnode_read_string_index(ofnode node, const char *propname, int index,
423 * @node: node to check
428 int ofnode_read_string_count(ofnode node, const char *property);
431 * ofnode_parse_phandle_with_args() - Find a node pointed by phandle in a list
454 * To get a device_node of the `node2' node you may call this:
457 * @node: device tree node containing a list
468 int ofnode_parse_phandle_with_args(ofnode node, const char *list_name,
480 * @node: device tree node containing a list
487 int ofnode_count_phandle_with_args(ofnode node, const char *list_name,
491 * ofnode_path() - find a node by full path
493 * @path: Full path to node, e.g. "/bus/spi@1"
494 * @return reference to the node found. Use ofnode_valid() to check if it exists
501 * This looks for a property within the /chosen node and returns its value
509 * ofnode_get_chosen_node() - get the chosen node
511 * @return the chosen node if present, else ofnode_null()
519 * Decode display timings from the supplied 'display-timings' node.
523 * @node 'display-timing' node containing the timing subnodes
528 int ofnode_decode_display_timing(ofnode node, int index,
532 * ofnode_get_property()- - get a pointer to the value of a node property
534 * @node: node to read
539 const void *ofnode_get_property(ofnode node, const char *propname, int *lenp);
542 * ofnode_is_available() - check if a node is marked available
544 * @node: node to check
545 * @return true if node's 'status' property is "okay" (or is missing)
547 bool ofnode_is_available(ofnode node);
555 * @node: node to read from
560 phys_addr_t ofnode_get_addr_size(ofnode node, const char *propname,
566 * Look up a property in a node and return a pointer to its contents as a
571 * @node node to examine
577 const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
583 * Look at an address property in a node and return the PCI address which
587 * @node node to examine
595 int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
601 * Look at the compatible property of a device node that represents a PCI
604 * @param node node to examine
609 int ofnode_read_pci_vendev(ofnode node, u16 *vendor, u16 *device);
612 * ofnode_read_addr_cells() - Get the number of address cells for a node
615 * which controls the given node.
617 * @node: Node to check
618 * @return number of address cells this node uses
620 int ofnode_read_addr_cells(ofnode node);
623 * ofnode_read_size_cells() - Get the number of size cells for a node
626 * which controls the given node.
628 * @node: Node to check
629 * @return number of size cells this node uses
631 int ofnode_read_size_cells(ofnode node);
634 * ofnode_read_simple_addr_cells() - Get the address cells property in a node
638 * @np: Node pointer to check
639 * @return value of #address-cells property in this node, or 2 if none
641 int ofnode_read_simple_addr_cells(ofnode node);
644 * ofnode_read_simple_size_cells() - Get the size cells property in a node
648 * @np: Node pointer to check
649 * @return value of #size-cells property in this node, or 2 if none
651 int ofnode_read_simple_size_cells(ofnode node);
654 * ofnode_pre_reloc() - check if a node should be bound before relocation
663 * determine if a node was bound in one of SPL/TPL stages.
672 * @node: node to check
673 * @return true if node is needed in SPL/TL, false otherwise
675 bool ofnode_pre_reloc(ofnode node);
678 * ofnode_read_resource() - Read a resource from a node
680 * Read resource information from a node at the given index
682 * @node: Node to read from
687 int ofnode_read_resource(ofnode node, uint index, struct resource *res);
690 * ofnode_read_resource_byname() - Read a resource from a node by name
692 * Read resource information from a node matching the given name. This uses a
696 * @node: Node to read from
701 int ofnode_read_resource_byname(ofnode node, const char *name,
705 * ofnode_by_compatible() - Find the next compatible node
707 * Find the next node after @from that is compatible with @compat
716 * ofnode_by_prop_value() - Find the next node with given property value
718 * Find the next node after @from that has a @propname with a value
732 * @node: child node (ofnode, lvalue)
733 * @parent: parent node (ofnode)
737 * ofnode node;
739 * ofnode_for_each_subnode(node, parent) {
740 * Use node
744 * Note that this is implemented as a macro and @node is used as
748 #define ofnode_for_each_subnode(node, parent) \ argument
749 for (node = ofnode_first_subnode(parent); \
750 ofnode_valid(node); \
751 node = ofnode_next_subnode(node))
760 * @ofnode: Device tree node giving the context in which to translate the
765 u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr);
768 * ofnode_device_is_compatible() - check if the node is compatible with compat
770 * This allows to check whether the node is comaptible with the compat.
772 * @node: Device tree node for which compatible needs to be verified.
773 * @compat: Compatible string which needs to verified in the given node.
776 int ofnode_device_is_compatible(ofnode node, const char *compat);
784 * @node: The node for whose property should be set
791 int ofnode_write_prop(ofnode node, const char *propname, int len,
800 * @node: The node for whose string property should be set
806 int ofnode_write_string(ofnode node, const char *propname, const char *value);
809 * ofnode_set_enabled() - Enable or disable a device tree node given by its
812 * This function effectively sets the node's "status" property to either "okay"
816 * @node: The node to enable
818 * node
821 int ofnode_set_enabled(ofnode node, bool value);