blob: 2551e5f0dcf8916f5898b2babdd0e03e16e36bba [file] [log] [blame]
Simon Glassf11c7ab2017-05-18 20:09:03 -06001/*
2 * Function to read values from the device tree node attached to a udevice.
3 *
4 * Copyright (c) 2017 Google, Inc
5 * Written by Simon Glass <sjg@chromium.org>
6 *
7 * SPDX-License-Identifier: GPL-2.0+
8 */
9
10#ifndef _DM_READ_H
11#define _DM_READ_H
12
13#include <dm/fdtaddr.h>
14#include <dm/ofnode.h>
15#include <dm/uclass.h>
16
Simon Glassa4481012017-06-12 06:21:29 -060017struct resource;
18
Simon Glassf11c7ab2017-05-18 20:09:03 -060019#if CONFIG_IS_ENABLED(OF_LIVE)
20static inline const struct device_node *dev_np(struct udevice *dev)
21{
22 return ofnode_to_np(dev->node);
23}
24#else
25static inline const struct device_node *dev_np(struct udevice *dev)
26{
27 return NULL;
28}
29#endif
30
31/**
32 * dev_ofnode() - get the DT node reference associated with a udevice
33 *
34 * @dev: device to check
35 * @return reference of the the device's DT node
36 */
37static inline ofnode dev_ofnode(struct udevice *dev)
38{
39 return dev->node;
40}
41
42static inline bool dev_of_valid(struct udevice *dev)
43{
44 return ofnode_valid(dev_ofnode(dev));
45}
46
Simon Glass47a0fd32017-05-18 20:09:04 -060047#ifndef CONFIG_DM_DEV_READ_INLINE
48/**
49 * dev_read_u32_default() - read a 32-bit integer from a device's DT property
50 *
51 * @dev: device to read DT property from
52 * @propname: name of the property to read from
53 * @def: default value to return if the property has no value
54 * @return property value, or @def if not found
55 */
56int dev_read_u32_default(struct udevice *dev, const char *propname, int def);
Simon Glassf11c7ab2017-05-18 20:09:03 -060057
58/**
59 * dev_read_string() - Read a string from a device's DT property
60 *
61 * @dev: device to read DT property from
62 * @propname: name of the property to read
63 * @return string from property value, or NULL if there is no such property
64 */
Simon Glass47a0fd32017-05-18 20:09:04 -060065const char *dev_read_string(struct udevice *dev, const char *propname);
Simon Glassf11c7ab2017-05-18 20:09:03 -060066
67/**
68 * dev_read_bool() - read a boolean value from a device's DT property
69 *
70 * @dev: device to read DT property from
71 * @propname: name of property to read
72 * @return true if property is present (meaning true), false if not present
73 */
Simon Glass47a0fd32017-05-18 20:09:04 -060074bool dev_read_bool(struct udevice *dev, const char *propname);
Simon Glassf11c7ab2017-05-18 20:09:03 -060075
76/**
77 * dev_read_subnode() - find a named subnode of a device
78 *
79 * @dev: device whose DT node contains the subnode
80 * @subnode_name: name of subnode to find
81 * @return reference to subnode (which can be invalid if there is no such
82 * subnode)
83 */
Simon Glass47a0fd32017-05-18 20:09:04 -060084ofnode dev_read_subnode(struct udevice *dev, const char *subbnode_name);
Simon Glassf11c7ab2017-05-18 20:09:03 -060085
86/**
87 * dev_read_size() - read the size of a property
88 *
89 * @dev: device to check
90 * @propname: property to check
91 * @return size of property if present, or -EINVAL if not
92 */
Simon Glass47a0fd32017-05-18 20:09:04 -060093int dev_read_size(struct udevice *dev, const char *propname);
Simon Glassf11c7ab2017-05-18 20:09:03 -060094
95/**
96 * dev_read_addr_index() - Get the indexed reg property of a device
97 *
98 * @dev: Device to read from
99 * @index: the 'reg' property can hold a list of <addr, size> pairs
100 * and @index is used to select which one is required
101 *
102 * @return address or FDT_ADDR_T_NONE if not found
103 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600104fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600105
106/**
107 * dev_read_addr() - Get the reg property of a device
108 *
109 * @dev: Device to read from
110 *
111 * @return address or FDT_ADDR_T_NONE if not found
112 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600113fdt_addr_t dev_read_addr(struct udevice *dev);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600114
115/**
Philipp Tomsichc131c8b2017-09-11 22:04:12 +0200116 * dev_read_addr_ptr() - Get the reg property of a device
117 * as a pointer
118 *
119 * @dev: Device to read from
120 *
121 * @return pointer or NULL if not found
122 */
123void *dev_read_addr_ptr(struct udevice *dev);
124
125/**
Simon Glassf11c7ab2017-05-18 20:09:03 -0600126 * dev_read_addr_size() - get address and size from a device property
127 *
128 * This does no address translation. It simply reads an property that contains
129 * an address and a size value, one after the other.
130 *
131 * @dev: Device to read from
132 * @propname: property to read
133 * @sizep: place to put size value (on success)
134 * @return address value, or FDT_ADDR_T_NONE on error
135 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600136fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *propname,
137 fdt_size_t *sizep);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600138
139/**
140 * dev_read_name() - get the name of a device's node
141 *
142 * @node: valid node to look up
143 * @return name of node
144 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600145const char *dev_read_name(struct udevice *dev);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600146
147/**
148 * dev_read_stringlist_search() - find string in a string list and return index
149 *
150 * Note that it is possible for this function to succeed on property values
151 * that are not NUL-terminated. That's because the function will stop after
152 * finding the first occurrence of @string. This can for example happen with
153 * small-valued cell properties, such as #address-cells, when searching for
154 * the empty string.
155 *
156 * @dev: device to check
157 * @propname: name of the property containing the string list
158 * @string: string to look up in the string list
159 *
160 * @return:
161 * the index of the string in the list of strings
162 * -ENODATA if the property is not found
163 * -EINVAL on some other error
164 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600165int dev_read_stringlist_search(struct udevice *dev, const char *property,
166 const char *string);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600167
168/**
Jean-Jacques Hiblotb5a144a2017-09-21 17:03:09 +0200169 * dev_read_string_index() - obtain an indexed string from a string list
170 *
171 * @dev: device to examine
172 * @propname: name of the property containing the string list
173 * @index: index of the string to return
174 * @out: return location for the string
175 *
176 * @return:
177 * length of string, if found or -ve error value if not found
178 */
179int dev_read_string_index(struct udevice *dev, const char *propname, int index,
180 const char **outp);
181
182/**
183 * dev_read_string_count() - find the number of strings in a string list
184 *
185 * @dev: device to examine
186 * @propname: name of the property containing the string list
187 * @return:
188 * number of strings in the list, or -ve error value if not found
189 */
190int dev_read_string_count(struct udevice *dev, const char *propname);
191/**
Simon Glassf11c7ab2017-05-18 20:09:03 -0600192 * dev_read_phandle_with_args() - Find a node pointed by phandle in a list
193 *
194 * This function is useful to parse lists of phandles and their arguments.
195 * Returns 0 on success and fills out_args, on error returns appropriate
196 * errno value.
197 *
198 * Caller is responsible to call of_node_put() on the returned out_args->np
199 * pointer.
200 *
201 * Example:
202 *
203 * phandle1: node1 {
204 * #list-cells = <2>;
205 * }
206 *
207 * phandle2: node2 {
208 * #list-cells = <1>;
209 * }
210 *
211 * node3 {
212 * list = <&phandle1 1 2 &phandle2 3>;
213 * }
214 *
215 * To get a device_node of the `node2' node you may call this:
216 * dev_read_phandle_with_args(dev, "list", "#list-cells", 0, 1, &args);
217 *
218 * @dev: device whose node containing a list
219 * @list_name: property name that contains a list
220 * @cells_name: property name that specifies phandles' arguments count
221 * @cells_count: Cell count to use if @cells_name is NULL
222 * @index: index of a phandle to parse out
223 * @out_args: optional pointer to output arguments structure (will be filled)
224 * @return 0 on success (with @out_args filled out if not NULL), -ENOENT if
225 * @list_name does not exist, -EINVAL if a phandle was not found,
226 * @cells_name could not be found, the arguments were truncated or there
227 * were too many arguments.
228 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600229int dev_read_phandle_with_args(struct udevice *dev, const char *list_name,
230 const char *cells_name, int cell_count,
231 int index,
232 struct ofnode_phandle_args *out_args);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600233
234/**
Patrice Chotard642346a2017-07-18 11:57:08 +0200235 * dev_count_phandle_with_args() - Return phandle number in a list
236 *
237 * This function is usefull to get phandle number contained in a property list.
238 * For example, this allows to allocate the right amount of memory to keep
239 * clock's reference contained into the "clocks" property.
240 *
241 *
242 * @dev: device whose node containing a list
243 * @list_name: property name that contains a list
244 * @cells_name: property name that specifies phandles' arguments count
245 * @Returns number of phandle found on success, on error returns appropriate
246 * errno value.
247 */
248
249int dev_count_phandle_with_args(struct udevice *dev, const char *list_name,
250 const char *cells_name);
251
252/**
Simon Glassf11c7ab2017-05-18 20:09:03 -0600253 * dev_read_addr_cells() - Get the number of address cells for a device's node
254 *
255 * This walks back up the tree to find the closest #address-cells property
256 * which controls the given node.
257 *
258 * @dev: devioe to check
259 * @return number of address cells this node uses
260 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600261int dev_read_addr_cells(struct udevice *dev);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600262
263/**
264 * dev_read_size_cells() - Get the number of size cells for a device's node
265 *
266 * This walks back up the tree to find the closest #size-cells property
267 * which controls the given node.
268 *
269 * @dev: devioe to check
270 * @return number of size cells this node uses
271 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600272int dev_read_size_cells(struct udevice *dev);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600273
274/**
Simon Glass878d68c2017-06-12 06:21:31 -0600275 * dev_read_addr_cells() - Get the address cells property in a node
276 *
277 * This function matches fdt_address_cells().
278 *
279 * @dev: devioe to check
280 * @return number of address cells this node uses
281 */
282int dev_read_simple_addr_cells(struct udevice *dev);
283
284/**
285 * dev_read_size_cells() - Get the size cells property in a node
286 *
287 * This function matches fdt_size_cells().
288 *
289 * @dev: devioe to check
290 * @return number of size cells this node uses
291 */
292int dev_read_simple_size_cells(struct udevice *dev);
293
294/**
Simon Glassf11c7ab2017-05-18 20:09:03 -0600295 * dev_read_phandle() - Get the phandle from a device
296 *
297 * @dev: device to check
298 * @return phandle (1 or greater), or 0 if no phandle or other error
299 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600300int dev_read_phandle(struct udevice *dev);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600301
302/**
303 * dev_read_prop()- - read a property from a device's node
304 *
305 * @dev: device to check
306 * @propname: property to read
307 * @lenp: place to put length on success
308 * @return pointer to property, or NULL if not found
309 */
Masahiro Yamadafd736212017-07-17 12:18:39 +0900310const void *dev_read_prop(struct udevice *dev, const char *propname, int *lenp);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600311
312/**
313 * dev_read_alias_seq() - Get the alias sequence number of a node
314 *
315 * This works out whether a node is pointed to by an alias, and if so, the
316 * sequence number of that alias. Aliases are of the form <base><num> where
317 * <num> is the sequence number. For example spi2 would be sequence number 2.
318 *
319 * @dev: device to look up
320 * @devnump: set to the sequence number if one is found
321 * @return 0 if a sequence was found, -ve if not
322 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600323int dev_read_alias_seq(struct udevice *dev, int *devnump);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600324
325/**
326 * dev_read_u32_array() - Find and read an array of 32 bit integers
327 *
328 * Search for a property in a device node and read 32-bit value(s) from
329 * it.
330 *
331 * The out_values is modified only if a valid u32 value can be decoded.
332 *
333 * @dev: device to look up
334 * @propname: name of the property to read
335 * @out_values: pointer to return value, modified only if return value is 0
336 * @sz: number of array elements to read
337 * @return 0 on success, -EINVAL if the property does not exist, -ENODATA if
338 * property does not have a value, and -EOVERFLOW if the property data isn't
339 * large enough.
340 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600341int dev_read_u32_array(struct udevice *dev, const char *propname,
342 u32 *out_values, size_t sz);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600343
344/**
345 * dev_read_first_subnode() - find the first subnode of a device's node
346 *
347 * @dev: device to look up
348 * @return reference to the first subnode (which can be invalid if the device's
349 * node has no subnodes)
350 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600351ofnode dev_read_first_subnode(struct udevice *dev);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600352
353/**
354 * ofnode_next_subnode() - find the next sibling of a subnode
355 *
356 * @node: valid reference to previous node (sibling)
357 * @return reference to the next subnode (which can be invalid if the node
358 * has no more siblings)
359 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600360ofnode dev_read_next_subnode(ofnode node);
Simon Glassf11c7ab2017-05-18 20:09:03 -0600361
362/**
363 * dev_read_u8_array_ptr() - find an 8-bit array
364 *
365 * Look up a device's node property and return a pointer to its contents as a
366 * byte array of given length. The property must have at least enough data
367 * for the array (count bytes). It may have more, but this will be ignored.
368 * The data is not copied.
369 *
370 * @dev: device to look up
371 * @propname: name of property to find
372 * @sz: number of array elements
373 * @return pointer to byte array if found, or NULL if the property is not
374 * found or there is not enough data
375 */
Simon Glass47a0fd32017-05-18 20:09:04 -0600376const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, const char *propname,
377 size_t sz);
378
Simon Glassf7d6fcf2017-06-12 06:21:30 -0600379/**
380 * dev_read_enabled() - check whether a node is enabled
381 *
382 * This looks for a 'status' property. If this exists, then returns 1 if
383 * the status is 'ok' and 0 otherwise. If there is no status property,
384 * it returns 1 on the assumption that anything mentioned should be enabled
385 * by default.
386 *
387 * @dev: device to examine
388 * @return integer value 0 (not enabled) or 1 (enabled)
389 */
390int dev_read_enabled(struct udevice *dev);
391
Simon Glassdcf98852017-07-25 08:29:55 -0600392/**
393 * dev_read_resource() - obtain an indexed resource from a device.
394 *
Masahiro Yamada7b8b47b2017-08-26 01:12:30 +0900395 * @dev: device to examine
Simon Glassdcf98852017-07-25 08:29:55 -0600396 * @index index of the resource to retrieve (0 = first)
397 * @res returns the resource
398 * @return 0 if ok, negative on error
399 */
400int dev_read_resource(struct udevice *dev, uint index, struct resource *res);
401
Masahiro Yamada7b8b47b2017-08-26 01:12:30 +0900402/**
403 * dev_read_resource_byname() - obtain a named resource from a device.
404 *
405 * @dev: device to examine
406 * @name: name of the resource to retrieve
407 * @res: returns the resource
408 * @return 0 if ok, negative on error
409 */
410int dev_read_resource_byname(struct udevice *dev, const char *name,
411 struct resource *res);
412
Mario Six147c6072018-01-15 11:07:19 +0100413/**
414 * dev_translate_address() - Tranlate a device-tree address
415 *
416 * Translate an address from the device-tree into a CPU physical address. This
417 * function walks up the tree and applies the various bus mappings along the
418 * way.
419 *
420 * @dev: device giving the context in which to translate the address
421 * @in_addr: pointer to the address to translate
422 * @return the translated address; OF_BAD_ADDR on error
423 */
424u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr);
Simon Glass47a0fd32017-05-18 20:09:04 -0600425#else /* CONFIG_DM_DEV_READ_INLINE is enabled */
426
427static inline int dev_read_u32_default(struct udevice *dev,
428 const char *propname, int def)
429{
430 return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
431}
432
433static inline const char *dev_read_string(struct udevice *dev,
434 const char *propname)
435{
436 return ofnode_read_string(dev_ofnode(dev), propname);
437}
438
439static inline bool dev_read_bool(struct udevice *dev, const char *propname)
440{
441 return ofnode_read_bool(dev_ofnode(dev), propname);
442}
443
444static inline ofnode dev_read_subnode(struct udevice *dev,
445 const char *subbnode_name)
446{
447 return ofnode_find_subnode(dev_ofnode(dev), subbnode_name);
448}
449
450static inline int dev_read_size(struct udevice *dev, const char *propname)
451{
452 return ofnode_read_size(dev_ofnode(dev), propname);
453}
454
455static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)
456{
457 return devfdt_get_addr_index(dev, index);
458}
459
460static inline fdt_addr_t dev_read_addr(struct udevice *dev)
461{
462 return devfdt_get_addr(dev);
463}
464
Philipp Tomsichc131c8b2017-09-11 22:04:12 +0200465static inline void *dev_read_addr_ptr(struct udevice *dev)
466{
467 return devfdt_get_addr_ptr(dev);
468}
469
Simon Glass47a0fd32017-05-18 20:09:04 -0600470static inline fdt_addr_t dev_read_addr_size(struct udevice *dev,
471 const char *propname,
472 fdt_size_t *sizep)
473{
474 return ofnode_get_addr_size(dev_ofnode(dev), propname, sizep);
475}
476
477static inline const char *dev_read_name(struct udevice *dev)
478{
479 return ofnode_get_name(dev_ofnode(dev));
480}
481
482static inline int dev_read_stringlist_search(struct udevice *dev,
483 const char *propname,
484 const char *string)
485{
486 return ofnode_stringlist_search(dev_ofnode(dev), propname, string);
487}
488
Jean-Jacques Hiblotb5a144a2017-09-21 17:03:09 +0200489static inline int dev_read_string_index(struct udevice *dev,
490 const char *propname, int index,
491 const char **outp)
492{
493 return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
494}
495
496static inline int dev_read_string_count(struct udevice *dev,
497 const char *propname)
498{
499 return ofnode_read_string_count(dev_ofnode(dev), propname);
500}
501
Simon Glass47a0fd32017-05-18 20:09:04 -0600502static inline int dev_read_phandle_with_args(struct udevice *dev,
503 const char *list_name, const char *cells_name, int cell_count,
504 int index, struct ofnode_phandle_args *out_args)
505{
506 return ofnode_parse_phandle_with_args(dev_ofnode(dev), list_name,
507 cells_name, cell_count, index,
508 out_args);
509}
510
Patrice Chotard642346a2017-07-18 11:57:08 +0200511static inline int dev_count_phandle_with_args(struct udevice *dev,
512 const char *list_name, const char *cells_name)
513{
514 return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
515 cells_name);
516}
517
Simon Glass47a0fd32017-05-18 20:09:04 -0600518static inline int dev_read_addr_cells(struct udevice *dev)
519{
Simon Glass878d68c2017-06-12 06:21:31 -0600520 /* NOTE: this call should walk up the parent stack */
Simon Glass47a0fd32017-05-18 20:09:04 -0600521 return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev));
522}
523
524static inline int dev_read_size_cells(struct udevice *dev)
525{
Simon Glass878d68c2017-06-12 06:21:31 -0600526 /* NOTE: this call should walk up the parent stack */
527 return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev));
528}
529
530static inline int dev_read_simple_addr_cells(struct udevice *dev)
531{
532 return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev));
533}
534
535static inline int dev_read_simple_size_cells(struct udevice *dev)
536{
Simon Glass47a0fd32017-05-18 20:09:04 -0600537 return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev));
538}
539
540static inline int dev_read_phandle(struct udevice *dev)
541{
542 return fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev));
543}
544
Masahiro Yamadafd736212017-07-17 12:18:39 +0900545static inline const void *dev_read_prop(struct udevice *dev,
546 const char *propname, int *lenp)
Simon Glass47a0fd32017-05-18 20:09:04 -0600547{
Masahiro Yamada61e51ba2017-06-22 16:54:05 +0900548 return ofnode_get_property(dev_ofnode(dev), propname, lenp);
Simon Glass47a0fd32017-05-18 20:09:04 -0600549}
550
551static inline int dev_read_alias_seq(struct udevice *dev, int *devnump)
552{
553 return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name,
554 dev_of_offset(dev), devnump);
555}
556
557static inline int dev_read_u32_array(struct udevice *dev, const char *propname,
558 u32 *out_values, size_t sz)
559{
560 return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz);
561}
562
563static inline ofnode dev_read_first_subnode(struct udevice *dev)
564{
565 return ofnode_first_subnode(dev_ofnode(dev));
566}
567
568static inline ofnode dev_read_next_subnode(ofnode node)
569{
570 return ofnode_next_subnode(node);
571}
572
Simon Glassf11c7ab2017-05-18 20:09:03 -0600573static inline const uint8_t *dev_read_u8_array_ptr(struct udevice *dev,
574 const char *propname, size_t sz)
575{
576 return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz);
577}
578
Simon Glassf7d6fcf2017-06-12 06:21:30 -0600579static inline int dev_read_enabled(struct udevice *dev)
580{
581 return fdtdec_get_is_enabled(gd->fdt_blob, dev_of_offset(dev));
582}
583
Simon Glassdcf98852017-07-25 08:29:55 -0600584static inline int dev_read_resource(struct udevice *dev, uint index,
585 struct resource *res)
586{
587 return ofnode_read_resource(dev_ofnode(dev), index, res);
588}
589
Masahiro Yamada7b8b47b2017-08-26 01:12:30 +0900590static inline int dev_read_resource_byname(struct udevice *dev,
591 const char *name,
592 struct resource *res)
593{
594 return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
595}
596
Mario Six147c6072018-01-15 11:07:19 +0100597static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
598{
599 return ofnode_translate_address(dev_ofnode(dev), in_addr);
600}
601
Simon Glassf11c7ab2017-05-18 20:09:03 -0600602#endif /* CONFIG_DM_DEV_READ_INLINE */
603
604/**
605 * dev_for_each_subnode() - Helper function to iterate through subnodes
606 *
607 * This creates a for() loop which works through the subnodes in a device's
608 * device-tree node.
609 *
610 * @subnode: ofnode holding the current subnode
611 * @dev: device to use for interation (struct udevice *)
612 */
613#define dev_for_each_subnode(subnode, dev) \
614 for (subnode = dev_read_first_subnode(dev); \
615 ofnode_valid(subnode); \
616 subnode = ofnode_next_subnode(subnode))
617
618#endif