1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Function to read values from the device tree node attached to a udevice.
5 * Copyright (c) 2017 Google, Inc
6 * Written by Simon Glass <sjg@chromium.org>
12 #include <dm/fdtaddr.h>
13 #include <dm/ofnode.h>
14 #include <dm/uclass.h>
18 #if CONFIG_IS_ENABLED(OF_LIVE)
19 static inline const struct device_node *dev_np(struct udevice *dev)
21 return ofnode_to_np(dev->node);
24 static inline const struct device_node *dev_np(struct udevice *dev)
31 * dev_ofnode() - get the DT node reference associated with a udevice
33 * @dev: device to check
34 * @return reference of the the device's DT node
36 static inline ofnode dev_ofnode(struct udevice *dev)
41 static inline bool dev_of_valid(struct udevice *dev)
43 return ofnode_valid(dev_ofnode(dev));
46 #ifndef CONFIG_DM_DEV_READ_INLINE
49 * dev_read_u32() - read a 32-bit integer from a device's DT property
51 * @dev: device to read DT property from
52 * @propname: name of the property to read from
53 * @outp: place to put value (if found)
54 * @return 0 if OK, -ve on error
56 int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp);
59 * dev_read_u32_default() - read a 32-bit integer from a device's DT property
61 * @dev: device to read DT property from
62 * @propname: name of the property to read from
63 * @def: default value to return if the property has no value
64 * @return property value, or @def if not found
66 int dev_read_u32_default(struct udevice *dev, const char *propname, int def);
69 * dev_read_s32() - read a signed 32-bit integer from a device's DT property
71 * @dev: device to read DT property from
72 * @propname: name of the property to read from
73 * @outp: place to put value (if found)
74 * @return 0 if OK, -ve on error
76 int dev_read_s32(struct udevice *dev, const char *propname, s32 *outp);
79 * dev_read_s32_default() - read a signed 32-bit int from a device's DT property
81 * @dev: device to read DT property from
82 * @propname: name of the property to read from
83 * @def: default value to return if the property has no value
84 * @return property value, or @def if not found
86 int dev_read_s32_default(struct udevice *dev, const char *propname, int def);
89 * dev_read_u32u() - read a 32-bit integer from a device's DT property
91 * This version uses a standard uint type.
93 * @dev: device to read DT property from
94 * @propname: name of the property to read from
95 * @outp: place to put value (if found)
96 * @return 0 if OK, -ve on error
98 int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp);
101 * dev_read_u64() - read a 64-bit integer from a device's DT property
103 * @dev: device to read DT property from
104 * @propname: name of the property to read from
105 * @outp: place to put value (if found)
106 * @return 0 if OK, -ve on error
108 int dev_read_u64(struct udevice *dev, const char *propname, u64 *outp);
111 * dev_read_u64_default() - read a 64-bit integer from a device's DT property
113 * @dev: device to read DT property from
114 * @propname: name of the property to read from
115 * @def: default value to return if the property has no value
116 * @return property value, or @def if not found
118 u64 dev_read_u64_default(struct udevice *dev, const char *propname, u64 def);
121 * dev_read_string() - Read a string from a device's DT property
123 * @dev: device to read DT property from
124 * @propname: name of the property to read
125 * @return string from property value, or NULL if there is no such property
127 const char *dev_read_string(struct udevice *dev, const char *propname);
130 * dev_read_bool() - read a boolean value from a device's DT property
132 * @dev: device to read DT property from
133 * @propname: name of property to read
134 * @return true if property is present (meaning true), false if not present
136 bool dev_read_bool(struct udevice *dev, const char *propname);
139 * dev_read_subnode() - find a named subnode of a device
141 * @dev: device whose DT node contains the subnode
142 * @subnode_name: name of subnode to find
143 * @return reference to subnode (which can be invalid if there is no such
146 ofnode dev_read_subnode(struct udevice *dev, const char *subbnode_name);
149 * dev_read_size() - read the size of a property
151 * @dev: device to check
152 * @propname: property to check
153 * @return size of property if present, or -EINVAL if not
155 int dev_read_size(struct udevice *dev, const char *propname);
158 * dev_read_addr_index() - Get the indexed reg property of a device
160 * @dev: Device to read from
161 * @index: the 'reg' property can hold a list of <addr, size> pairs
162 * and @index is used to select which one is required
164 * @return address or FDT_ADDR_T_NONE if not found
166 fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
169 * dev_read_addr_size_index() - Get the indexed reg property of a device
171 * @dev: Device to read from
172 * @index: the 'reg' property can hold a list of <addr, size> pairs
173 * and @index is used to select which one is required
174 * @size: place to put size value (on success)
176 * @return address or FDT_ADDR_T_NONE if not found
178 fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index,
182 * dev_remap_addr_index() - Get the indexed reg property of a device
183 * as a memory-mapped I/O pointer
185 * @dev: Device to read from
186 * @index: the 'reg' property can hold a list of <addr, size> pairs
187 * and @index is used to select which one is required
189 * @return pointer or NULL if not found
191 void *dev_remap_addr_index(struct udevice *dev, int index);
194 * dev_read_addr_name() - Get the reg property of a device, indexed by name
196 * @dev: Device to read from
197 * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
198 * 'reg-names' property providing named-based identification. @index
199 * indicates the value to search for in 'reg-names'.
201 * @return address or FDT_ADDR_T_NONE if not found
203 fdt_addr_t dev_read_addr_name(struct udevice *dev, const char* name);
206 * dev_read_addr_size_name() - Get the reg property of a device, indexed by name
208 * @dev: Device to read from
209 * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
210 * 'reg-names' property providing named-based identification. @index
211 * indicates the value to search for in 'reg-names'.
212 * @size: place to put size value (on success)
214 * @return address or FDT_ADDR_T_NONE if not found
216 fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name,
220 * dev_remap_addr_name() - Get the reg property of a device, indexed by name,
221 * as a memory-mapped I/O pointer
223 * @dev: Device to read from
224 * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
225 * 'reg-names' property providing named-based identification. @index
226 * indicates the value to search for in 'reg-names'.
228 * @return pointer or NULL if not found
230 void *dev_remap_addr_name(struct udevice *dev, const char* name);
233 * dev_read_addr() - Get the reg property of a device
235 * @dev: Device to read from
237 * @return address or FDT_ADDR_T_NONE if not found
239 fdt_addr_t dev_read_addr(struct udevice *dev);
242 * dev_read_addr_ptr() - Get the reg property of a device
245 * @dev: Device to read from
247 * @return pointer or NULL if not found
249 void *dev_read_addr_ptr(struct udevice *dev);
252 * dev_read_addr_pci() - Read an address and handle PCI address translation
254 * At present U-Boot does not have address translation logic for PCI in the
255 * livetree implementation (of_addr.c). This special function supports this for
256 * the flat tree implementation.
258 * This function should be removed (and code should use dev_read() instead)
261 * 1. PCI address translation is added; and either
262 * 2. everything uses livetree where PCI translation is used (which is feasible
263 * in SPL and U-Boot proper) or PCI address translation is added to
264 * fdtdec_get_addr() and friends.
266 * @dev: Device to read from
267 * @return address or FDT_ADDR_T_NONE if not found
269 fdt_addr_t dev_read_addr_pci(struct udevice *dev);
272 * dev_remap_addr() - Get the reg property of a device as a
273 * memory-mapped I/O pointer
275 * @dev: Device to read from
277 * @return pointer or NULL if not found
279 void *dev_remap_addr(struct udevice *dev);
282 * dev_read_addr_size() - get address and size from a device property
284 * This does no address translation. It simply reads an property that contains
285 * an address and a size value, one after the other.
287 * @dev: Device to read from
288 * @propname: property to read
289 * @sizep: place to put size value (on success)
290 * @return address value, or FDT_ADDR_T_NONE on error
292 fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *propname,
296 * dev_read_name() - get the name of a device's node
298 * @dev: Device to read from
299 * @return name of node
301 const char *dev_read_name(struct udevice *dev);
304 * dev_read_stringlist_search() - find string in a string list and return index
306 * Note that it is possible for this function to succeed on property values
307 * that are not NUL-terminated. That's because the function will stop after
308 * finding the first occurrence of @string. This can for example happen with
309 * small-valued cell properties, such as #address-cells, when searching for
312 * @dev: device to check
313 * @propname: name of the property containing the string list
314 * @string: string to look up in the string list
317 * the index of the string in the list of strings
318 * -ENODATA if the property is not found
319 * -EINVAL on some other error
321 int dev_read_stringlist_search(struct udevice *dev, const char *property,
325 * dev_read_string_index() - obtain an indexed string from a string list
327 * @dev: device to examine
328 * @propname: name of the property containing the string list
329 * @index: index of the string to return
330 * @out: return location for the string
333 * length of string, if found or -ve error value if not found
335 int dev_read_string_index(struct udevice *dev, const char *propname, int index,
339 * dev_read_string_count() - find the number of strings in a string list
341 * @dev: device to examine
342 * @propname: name of the property containing the string list
344 * number of strings in the list, or -ve error value if not found
346 int dev_read_string_count(struct udevice *dev, const char *propname);
348 * dev_read_phandle_with_args() - Find a node pointed by phandle in a list
350 * This function is useful to parse lists of phandles and their arguments.
351 * Returns 0 on success and fills out_args, on error returns appropriate
354 * Caller is responsible to call of_node_put() on the returned out_args->np
368 * list = <&phandle1 1 2 &phandle2 3>;
371 * To get a device_node of the `node2' node you may call this:
372 * dev_read_phandle_with_args(dev, "list", "#list-cells", 0, 1, &args);
374 * @dev: device whose node containing a list
375 * @list_name: property name that contains a list
376 * @cells_name: property name that specifies phandles' arguments count
377 * @cells_count: Cell count to use if @cells_name is NULL
378 * @index: index of a phandle to parse out
379 * @out_args: optional pointer to output arguments structure (will be filled)
380 * @return 0 on success (with @out_args filled out if not NULL), -ENOENT if
381 * @list_name does not exist, -EINVAL if a phandle was not found,
382 * @cells_name could not be found, the arguments were truncated or there
383 * were too many arguments.
385 int dev_read_phandle_with_args(struct udevice *dev, const char *list_name,
386 const char *cells_name, int cell_count,
388 struct ofnode_phandle_args *out_args);
391 * dev_count_phandle_with_args() - Return phandle number in a list
393 * This function is usefull to get phandle number contained in a property list.
394 * For example, this allows to allocate the right amount of memory to keep
395 * clock's reference contained into the "clocks" property.
398 * @dev: device whose node containing a list
399 * @list_name: property name that contains a list
400 * @cells_name: property name that specifies phandles' arguments count
401 * @Returns number of phandle found on success, on error returns appropriate
405 int dev_count_phandle_with_args(struct udevice *dev, const char *list_name,
406 const char *cells_name);
409 * dev_read_addr_cells() - Get the number of address cells for a device's node
411 * This walks back up the tree to find the closest #address-cells property
412 * which controls the given node.
414 * @dev: device to check
415 * @return number of address cells this node uses
417 int dev_read_addr_cells(struct udevice *dev);
420 * dev_read_size_cells() - Get the number of size cells for a device's node
422 * This walks back up the tree to find the closest #size-cells property
423 * which controls the given node.
425 * @dev: device to check
426 * @return number of size cells this node uses
428 int dev_read_size_cells(struct udevice *dev);
431 * dev_read_addr_cells() - Get the address cells property in a node
433 * This function matches fdt_address_cells().
435 * @dev: device to check
436 * @return number of address cells this node uses
438 int dev_read_simple_addr_cells(struct udevice *dev);
441 * dev_read_size_cells() - Get the size cells property in a node
443 * This function matches fdt_size_cells().
445 * @dev: device to check
446 * @return number of size cells this node uses
448 int dev_read_simple_size_cells(struct udevice *dev);
451 * dev_read_phandle() - Get the phandle from a device
453 * @dev: device to check
454 * @return phandle (1 or greater), or 0 if no phandle or other error
456 int dev_read_phandle(struct udevice *dev);
459 * dev_read_prop()- - read a property from a device's node
461 * @dev: device to check
462 * @propname: property to read
463 * @lenp: place to put length on success
464 * @return pointer to property, or NULL if not found
466 const void *dev_read_prop(struct udevice *dev, const char *propname, int *lenp);
469 * dev_read_alias_seq() - Get the alias sequence number of a node
471 * This works out whether a node is pointed to by an alias, and if so, the
472 * sequence number of that alias. Aliases are of the form <base><num> where
473 * <num> is the sequence number. For example spi2 would be sequence number 2.
475 * @dev: device to look up
476 * @devnump: set to the sequence number if one is found
477 * @return 0 if a sequence was found, -ve if not
479 int dev_read_alias_seq(struct udevice *dev, int *devnump);
482 * dev_read_u32_array() - Find and read an array of 32 bit integers
484 * Search for a property in a device node and read 32-bit value(s) from
487 * The out_values is modified only if a valid u32 value can be decoded.
489 * @dev: device to look up
490 * @propname: name of the property to read
491 * @out_values: pointer to return value, modified only if return value is 0
492 * @sz: number of array elements to read
493 * @return 0 on success, -EINVAL if the property does not exist, -ENODATA if
494 * property does not have a value, and -EOVERFLOW if the property data isn't
497 int dev_read_u32_array(struct udevice *dev, const char *propname,
498 u32 *out_values, size_t sz);
501 * dev_read_first_subnode() - find the first subnode of a device's node
503 * @dev: device to look up
504 * @return reference to the first subnode (which can be invalid if the device's
505 * node has no subnodes)
507 ofnode dev_read_first_subnode(struct udevice *dev);
510 * ofnode_next_subnode() - find the next sibling of a subnode
512 * @node: valid reference to previous node (sibling)
513 * @return reference to the next subnode (which can be invalid if the node
514 * has no more siblings)
516 ofnode dev_read_next_subnode(ofnode node);
519 * dev_read_u8_array_ptr() - find an 8-bit array
521 * Look up a device's node property and return a pointer to its contents as a
522 * byte array of given length. The property must have at least enough data
523 * for the array (count bytes). It may have more, but this will be ignored.
524 * The data is not copied.
526 * @dev: device to look up
527 * @propname: name of property to find
528 * @sz: number of array elements
529 * @return pointer to byte array if found, or NULL if the property is not
530 * found or there is not enough data
532 const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, const char *propname,
536 * dev_read_enabled() - check whether a node is enabled
538 * This looks for a 'status' property. If this exists, then returns 1 if
539 * the status is 'ok' and 0 otherwise. If there is no status property,
540 * it returns 1 on the assumption that anything mentioned should be enabled
543 * @dev: device to examine
544 * @return integer value 0 (not enabled) or 1 (enabled)
546 int dev_read_enabled(struct udevice *dev);
549 * dev_read_resource() - obtain an indexed resource from a device.
551 * @dev: device to examine
552 * @index index of the resource to retrieve (0 = first)
553 * @res returns the resource
554 * @return 0 if ok, negative on error
556 int dev_read_resource(struct udevice *dev, uint index, struct resource *res);
559 * dev_read_resource_byname() - obtain a named resource from a device.
561 * @dev: device to examine
562 * @name: name of the resource to retrieve
563 * @res: returns the resource
564 * @return 0 if ok, negative on error
566 int dev_read_resource_byname(struct udevice *dev, const char *name,
567 struct resource *res);
570 * dev_translate_address() - Translate a device-tree address
572 * Translate an address from the device-tree into a CPU physical address. This
573 * function walks up the tree and applies the various bus mappings along the
576 * @dev: device giving the context in which to translate the address
577 * @in_addr: pointer to the address to translate
578 * @return the translated address; OF_BAD_ADDR on error
580 u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr);
583 * dev_translate_dma_address() - Translate a device-tree DMA address
585 * Translate a DMA address from the device-tree into a CPU physical address.
586 * This function walks up the tree and applies the various bus mappings along
589 * @dev: device giving the context in which to translate the DMA address
590 * @in_addr: pointer to the DMA address to translate
591 * @return the translated DMA address; OF_BAD_ADDR on error
593 u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr);
596 * dev_read_alias_highest_id - Get highest alias id for the given stem
597 * @stem: Alias stem to be examined
599 * The function travels the lookup table to get the highest alias id for the
601 * @return alias ID, if found, else -1
603 int dev_read_alias_highest_id(const char *stem);
605 #else /* CONFIG_DM_DEV_READ_INLINE is enabled */
607 static inline int dev_read_u32(struct udevice *dev,
608 const char *propname, u32 *outp)
610 return ofnode_read_u32(dev_ofnode(dev), propname, outp);
613 static inline int dev_read_u32_default(struct udevice *dev,
614 const char *propname, int def)
616 return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
619 static inline int dev_read_s32(struct udevice *dev,
620 const char *propname, s32 *outp)
622 return ofnode_read_s32(dev_ofnode(dev), propname, outp);
625 static inline int dev_read_s32_default(struct udevice *dev,
626 const char *propname, int def)
628 return ofnode_read_s32_default(dev_ofnode(dev), propname, def);
631 static inline int dev_read_u32u(struct udevice *dev,
632 const char *propname, uint *outp)
637 ret = ofnode_read_u32(dev_ofnode(dev), propname, &val);
645 static inline int dev_read_u64(struct udevice *dev,
646 const char *propname, u64 *outp)
648 return ofnode_read_u64(dev_ofnode(dev), propname, outp);
651 static inline u64 dev_read_u64_default(struct udevice *dev,
652 const char *propname, u64 def)
654 return ofnode_read_u64_default(dev_ofnode(dev), propname, def);
657 static inline const char *dev_read_string(struct udevice *dev,
658 const char *propname)
660 return ofnode_read_string(dev_ofnode(dev), propname);
663 static inline bool dev_read_bool(struct udevice *dev, const char *propname)
665 return ofnode_read_bool(dev_ofnode(dev), propname);
668 static inline ofnode dev_read_subnode(struct udevice *dev,
669 const char *subbnode_name)
671 return ofnode_find_subnode(dev_ofnode(dev), subbnode_name);
674 static inline int dev_read_size(struct udevice *dev, const char *propname)
676 return ofnode_read_size(dev_ofnode(dev), propname);
679 static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)
681 return devfdt_get_addr_index(dev, index);
684 static inline fdt_addr_t dev_read_addr_size_index(struct udevice *dev,
688 return devfdt_get_addr_size_index(dev, index, size);
691 static inline fdt_addr_t dev_read_addr_name(struct udevice *dev,
694 return devfdt_get_addr_name(dev, name);
697 static inline fdt_addr_t dev_read_addr_size_name(struct udevice *dev,
701 return devfdt_get_addr_size_name(dev, name, size);
704 static inline fdt_addr_t dev_read_addr(struct udevice *dev)
706 return devfdt_get_addr(dev);
709 static inline void *dev_read_addr_ptr(struct udevice *dev)
711 return devfdt_get_addr_ptr(dev);
714 static inline fdt_addr_t dev_read_addr_pci(struct udevice *dev)
716 return devfdt_get_addr_pci(dev);
719 static inline void *dev_remap_addr(struct udevice *dev)
721 return devfdt_remap_addr(dev);
724 static inline void *dev_remap_addr_index(struct udevice *dev, int index)
726 return devfdt_remap_addr_index(dev, index);
729 static inline void *dev_remap_addr_name(struct udevice *dev, const char *name)
731 return devfdt_remap_addr_name(dev, name);
734 static inline fdt_addr_t dev_read_addr_size(struct udevice *dev,
735 const char *propname,
738 return ofnode_get_addr_size(dev_ofnode(dev), propname, sizep);
741 static inline const char *dev_read_name(struct udevice *dev)
743 return ofnode_get_name(dev_ofnode(dev));
746 static inline int dev_read_stringlist_search(struct udevice *dev,
747 const char *propname,
750 return ofnode_stringlist_search(dev_ofnode(dev), propname, string);
753 static inline int dev_read_string_index(struct udevice *dev,
754 const char *propname, int index,
757 return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
760 static inline int dev_read_string_count(struct udevice *dev,
761 const char *propname)
763 return ofnode_read_string_count(dev_ofnode(dev), propname);
766 static inline int dev_read_phandle_with_args(struct udevice *dev,
767 const char *list_name, const char *cells_name, int cell_count,
768 int index, struct ofnode_phandle_args *out_args)
770 return ofnode_parse_phandle_with_args(dev_ofnode(dev), list_name,
771 cells_name, cell_count, index,
775 static inline int dev_count_phandle_with_args(struct udevice *dev,
776 const char *list_name, const char *cells_name)
778 return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
782 static inline int dev_read_addr_cells(struct udevice *dev)
784 /* NOTE: this call should walk up the parent stack */
785 return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev));
788 static inline int dev_read_size_cells(struct udevice *dev)
790 /* NOTE: this call should walk up the parent stack */
791 return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev));
794 static inline int dev_read_simple_addr_cells(struct udevice *dev)
796 return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev));
799 static inline int dev_read_simple_size_cells(struct udevice *dev)
801 return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev));
804 static inline int dev_read_phandle(struct udevice *dev)
806 return fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev));
809 static inline const void *dev_read_prop(struct udevice *dev,
810 const char *propname, int *lenp)
812 return ofnode_get_property(dev_ofnode(dev), propname, lenp);
815 static inline int dev_read_alias_seq(struct udevice *dev, int *devnump)
817 return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name,
818 dev_of_offset(dev), devnump);
821 static inline int dev_read_u32_array(struct udevice *dev, const char *propname,
822 u32 *out_values, size_t sz)
824 return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz);
827 static inline ofnode dev_read_first_subnode(struct udevice *dev)
829 return ofnode_first_subnode(dev_ofnode(dev));
832 static inline ofnode dev_read_next_subnode(ofnode node)
834 return ofnode_next_subnode(node);
837 static inline const uint8_t *dev_read_u8_array_ptr(struct udevice *dev,
838 const char *propname, size_t sz)
840 return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz);
843 static inline int dev_read_enabled(struct udevice *dev)
845 return fdtdec_get_is_enabled(gd->fdt_blob, dev_of_offset(dev));
848 static inline int dev_read_resource(struct udevice *dev, uint index,
849 struct resource *res)
851 return ofnode_read_resource(dev_ofnode(dev), index, res);
854 static inline int dev_read_resource_byname(struct udevice *dev,
856 struct resource *res)
858 return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
861 static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
863 return ofnode_translate_address(dev_ofnode(dev), in_addr);
866 static inline u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr)
868 return ofnode_translate_dma_address(dev_ofnode(dev), in_addr);
871 static inline int dev_read_alias_highest_id(const char *stem)
873 return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
876 #endif /* CONFIG_DM_DEV_READ_INLINE */
879 * dev_for_each_subnode() - Helper function to iterate through subnodes
881 * This creates a for() loop which works through the subnodes in a device's
884 * @subnode: ofnode holding the current subnode
885 * @dev: device to use for interation (struct udevice *)
887 #define dev_for_each_subnode(subnode, dev) \
888 for (subnode = dev_read_first_subnode(dev); \
889 ofnode_valid(subnode); \
890 subnode = ofnode_next_subnode(subnode))