1 /* SPDX-License-Identifier: GPL-2.0+ */
5 * Definitions for talking to the Open Firmware PROM on
6 * Power Macintosh and other computers.
8 * Copyright (C) 1996-2005 Paul Mackerras.
10 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
11 * Updates for SPARC64 by David S. Miller
12 * Derived from PowerPC and Sparc prom.h files by Stephen Rothwell, IBM Corp.
14 #include <linux/types.h>
15 #include <linux/bitops.h>
16 #include <linux/cleanup.h>
17 #include <linux/errno.h>
18 #include <linux/kobject.h>
19 #include <linux/mod_devicetable.h>
20 #include <linux/property.h>
21 #include <linux/list.h>
23 #include <asm/byteorder.h>
32 struct property
*next
;
33 #if defined(CONFIG_OF_DYNAMIC) || defined(CONFIG_SPARC)
36 #if defined(CONFIG_OF_PROMTREE)
37 unsigned int unique_id
;
39 #if defined(CONFIG_OF_KOBJ)
40 struct bin_attribute attr
;
44 #if defined(CONFIG_SPARC)
45 struct of_irq_controller
;
51 const char *full_name
;
52 struct fwnode_handle fwnode
;
54 struct property
*properties
;
55 struct property
*deadprops
; /* removed properties */
56 struct device_node
*parent
;
57 struct device_node
*child
;
58 struct device_node
*sibling
;
59 #if defined(CONFIG_OF_KOBJ)
64 #if defined(CONFIG_SPARC)
65 unsigned int unique_id
;
66 struct of_irq_controller
*irq_trans
;
70 #define MAX_PHANDLE_ARGS 16
71 struct of_phandle_args
{
72 struct device_node
*np
;
74 uint32_t args
[MAX_PHANDLE_ARGS
];
77 struct of_phandle_iterator
{
78 /* Common iterator information */
79 const char *cells_name
;
81 const struct device_node
*parent
;
83 /* List size information */
84 const __be32
*list_end
;
85 const __be32
*phandle_end
;
87 /* Current position state */
91 struct device_node
*node
;
94 struct of_reconfig_data
{
95 struct device_node
*dn
;
96 struct property
*prop
;
97 struct property
*old_prop
;
100 extern const struct kobj_type of_node_ktype
;
101 extern const struct fwnode_operations of_fwnode_ops
;
104 * of_node_init - initialize a devicetree node
105 * @node: Pointer to device node that has been created by kzalloc()
107 * On return the device_node refcount is set to one. Use of_node_put()
108 * on @node when done to free the memory allocated for it. If the node
109 * is NOT a dynamic node the memory will not be freed. The decision of
110 * whether to free the memory will be done by node->release(), which is
113 static inline void of_node_init(struct device_node
*node
)
115 #if defined(CONFIG_OF_KOBJ)
116 kobject_init(&node
->kobj
, &of_node_ktype
);
118 fwnode_init(&node
->fwnode
, &of_fwnode_ops
);
121 #if defined(CONFIG_OF_KOBJ)
122 #define of_node_kobj(n) (&(n)->kobj)
124 #define of_node_kobj(n) NULL
127 #ifdef CONFIG_OF_DYNAMIC
128 extern struct device_node
*of_node_get(struct device_node
*node
);
129 extern void of_node_put(struct device_node
*node
);
130 #else /* CONFIG_OF_DYNAMIC */
131 /* Dummy ref counting routines - to be implemented later */
132 static inline struct device_node
*of_node_get(struct device_node
*node
)
136 static inline void of_node_put(struct device_node
*node
) { }
137 #endif /* !CONFIG_OF_DYNAMIC */
138 DEFINE_FREE(device_node
, struct device_node
*, if (_T
) of_node_put(_T
))
140 /* Pointer for first entry in chain of all nodes. */
141 extern struct device_node
*of_root
;
142 extern struct device_node
*of_chosen
;
143 extern struct device_node
*of_aliases
;
144 extern struct device_node
*of_stdout
;
147 * struct device_node flag descriptions
148 * (need to be visible even when !CONFIG_OF)
150 #define OF_DYNAMIC 1 /* (and properties) allocated via kmalloc */
151 #define OF_DETACHED 2 /* detached from the device tree */
152 #define OF_POPULATED 3 /* device already created */
153 #define OF_POPULATED_BUS 4 /* platform bus created for children */
154 #define OF_OVERLAY 5 /* allocated for an overlay */
155 #define OF_OVERLAY_FREE_CSET 6 /* in overlay cset being freed */
157 #define OF_BAD_ADDR ((u64)-1)
160 void of_core_init(void);
162 static inline bool is_of_node(const struct fwnode_handle
*fwnode
)
164 return !IS_ERR_OR_NULL(fwnode
) && fwnode
->ops
== &of_fwnode_ops
;
167 #define to_of_node(__fwnode) \
169 typeof(__fwnode) __to_of_node_fwnode = (__fwnode); \
171 is_of_node(__to_of_node_fwnode) ? \
172 container_of(__to_of_node_fwnode, \
173 struct device_node, fwnode) : \
177 #define of_fwnode_handle(node) \
179 typeof(node) __of_fwnode_handle_node = (node); \
181 __of_fwnode_handle_node ? \
182 &__of_fwnode_handle_node->fwnode : NULL; \
185 static inline bool of_node_is_root(const struct device_node
*node
)
187 return node
&& (node
->parent
== NULL
);
190 static inline int of_node_check_flag(const struct device_node
*n
, unsigned long flag
)
192 return test_bit(flag
, &n
->_flags
);
195 static inline int of_node_test_and_set_flag(struct device_node
*n
,
198 return test_and_set_bit(flag
, &n
->_flags
);
201 static inline void of_node_set_flag(struct device_node
*n
, unsigned long flag
)
203 set_bit(flag
, &n
->_flags
);
206 static inline void of_node_clear_flag(struct device_node
*n
, unsigned long flag
)
208 clear_bit(flag
, &n
->_flags
);
211 #if defined(CONFIG_OF_DYNAMIC) || defined(CONFIG_SPARC)
212 static inline int of_property_check_flag(const struct property
*p
, unsigned long flag
)
214 return test_bit(flag
, &p
->_flags
);
217 static inline void of_property_set_flag(struct property
*p
, unsigned long flag
)
219 set_bit(flag
, &p
->_flags
);
222 static inline void of_property_clear_flag(struct property
*p
, unsigned long flag
)
224 clear_bit(flag
, &p
->_flags
);
228 extern struct device_node
*__of_find_all_nodes(struct device_node
*prev
);
229 extern struct device_node
*of_find_all_nodes(struct device_node
*prev
);
232 * OF address retrieval & translation
235 /* Helper to read a big number; size is in cells (not bytes) */
236 static inline u64
of_read_number(const __be32
*cell
, int size
)
239 for (; size
--; cell
++)
240 r
= (r
<< 32) | be32_to_cpu(*cell
);
244 /* Like of_read_number, but we want an unsigned long result */
245 static inline unsigned long of_read_ulong(const __be32
*cell
, int size
)
247 /* toss away upper bits if unsigned long is smaller than u64 */
248 return of_read_number(cell
, size
);
251 #if defined(CONFIG_SPARC)
252 #include <asm/prom.h>
255 #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
256 #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
258 extern bool of_node_name_eq(const struct device_node
*np
, const char *name
);
259 extern bool of_node_name_prefix(const struct device_node
*np
, const char *prefix
);
261 static inline const char *of_node_full_name(const struct device_node
*np
)
263 return np
? np
->full_name
: "<no-node>";
266 #define for_each_of_allnodes_from(from, dn) \
267 for (dn = __of_find_all_nodes(from); dn; dn = __of_find_all_nodes(dn))
268 #define for_each_of_allnodes(dn) for_each_of_allnodes_from(NULL, dn)
269 extern struct device_node
*of_find_node_by_name(struct device_node
*from
,
271 extern struct device_node
*of_find_node_by_type(struct device_node
*from
,
273 extern struct device_node
*of_find_compatible_node(struct device_node
*from
,
274 const char *type
, const char *compat
);
275 extern struct device_node
*of_find_matching_node_and_match(
276 struct device_node
*from
,
277 const struct of_device_id
*matches
,
278 const struct of_device_id
**match
);
280 extern struct device_node
*of_find_node_opts_by_path(const char *path
,
282 static inline struct device_node
*of_find_node_by_path(const char *path
)
284 return of_find_node_opts_by_path(path
, NULL
);
287 extern struct device_node
*of_find_node_by_phandle(phandle handle
);
288 extern struct device_node
*of_get_parent(const struct device_node
*node
);
289 extern struct device_node
*of_get_next_parent(struct device_node
*node
);
290 extern struct device_node
*of_get_next_child(const struct device_node
*node
,
291 struct device_node
*prev
);
292 extern struct device_node
*of_get_next_available_child(
293 const struct device_node
*node
, struct device_node
*prev
);
294 extern struct device_node
*of_get_next_reserved_child(
295 const struct device_node
*node
, struct device_node
*prev
);
297 extern struct device_node
*of_get_compatible_child(const struct device_node
*parent
,
298 const char *compatible
);
299 extern struct device_node
*of_get_child_by_name(const struct device_node
*node
,
303 extern struct device_node
*of_find_next_cache_node(const struct device_node
*);
304 extern int of_find_last_cache_level(unsigned int cpu
);
305 extern struct device_node
*of_find_node_with_property(
306 struct device_node
*from
, const char *prop_name
);
308 extern struct property
*of_find_property(const struct device_node
*np
,
311 extern int of_property_count_elems_of_size(const struct device_node
*np
,
312 const char *propname
, int elem_size
);
313 extern int of_property_read_u32_index(const struct device_node
*np
,
314 const char *propname
,
315 u32 index
, u32
*out_value
);
316 extern int of_property_read_u64_index(const struct device_node
*np
,
317 const char *propname
,
318 u32 index
, u64
*out_value
);
319 extern int of_property_read_variable_u8_array(const struct device_node
*np
,
320 const char *propname
, u8
*out_values
,
321 size_t sz_min
, size_t sz_max
);
322 extern int of_property_read_variable_u16_array(const struct device_node
*np
,
323 const char *propname
, u16
*out_values
,
324 size_t sz_min
, size_t sz_max
);
325 extern int of_property_read_variable_u32_array(const struct device_node
*np
,
326 const char *propname
,
330 extern int of_property_read_u64(const struct device_node
*np
,
331 const char *propname
, u64
*out_value
);
332 extern int of_property_read_variable_u64_array(const struct device_node
*np
,
333 const char *propname
,
338 extern int of_property_read_string(const struct device_node
*np
,
339 const char *propname
,
340 const char **out_string
);
341 extern int of_property_match_string(const struct device_node
*np
,
342 const char *propname
,
344 extern int of_property_read_string_helper(const struct device_node
*np
,
345 const char *propname
,
346 const char **out_strs
, size_t sz
, int index
);
347 extern int of_device_is_compatible(const struct device_node
*device
,
349 extern int of_device_compatible_match(const struct device_node
*device
,
350 const char *const *compat
);
351 extern bool of_device_is_available(const struct device_node
*device
);
352 extern bool of_device_is_big_endian(const struct device_node
*device
);
353 extern const void *of_get_property(const struct device_node
*node
,
356 extern struct device_node
*of_get_cpu_node(int cpu
, unsigned int *thread
);
357 extern struct device_node
*of_cpu_device_node_get(int cpu
);
358 extern int of_cpu_node_to_id(struct device_node
*np
);
359 extern struct device_node
*of_get_next_cpu_node(struct device_node
*prev
);
360 extern struct device_node
*of_get_cpu_state_node(const struct device_node
*cpu_node
,
362 extern u64
of_get_cpu_hwid(struct device_node
*cpun
, unsigned int thread
);
364 extern int of_n_addr_cells(struct device_node
*np
);
365 extern int of_n_size_cells(struct device_node
*np
);
366 extern const struct of_device_id
*of_match_node(
367 const struct of_device_id
*matches
, const struct device_node
*node
);
368 extern const void *of_device_get_match_data(const struct device
*dev
);
369 extern int of_alias_from_compatible(const struct device_node
*node
, char *alias
,
371 extern void of_print_phandle_args(const char *msg
, const struct of_phandle_args
*args
);
372 extern int __of_parse_phandle_with_args(const struct device_node
*np
,
373 const char *list_name
, const char *cells_name
, int cell_count
,
374 int index
, struct of_phandle_args
*out_args
);
375 extern int of_parse_phandle_with_args_map(const struct device_node
*np
,
376 const char *list_name
, const char *stem_name
, int index
,
377 struct of_phandle_args
*out_args
);
378 extern int of_count_phandle_with_args(const struct device_node
*np
,
379 const char *list_name
, const char *cells_name
);
381 /* module functions */
382 extern ssize_t
of_modalias(const struct device_node
*np
, char *str
, ssize_t len
);
383 extern int of_request_module(const struct device_node
*np
);
385 /* phandle iterator functions */
386 extern int of_phandle_iterator_init(struct of_phandle_iterator
*it
,
387 const struct device_node
*np
,
388 const char *list_name
,
389 const char *cells_name
,
392 extern int of_phandle_iterator_next(struct of_phandle_iterator
*it
);
393 extern int of_phandle_iterator_args(struct of_phandle_iterator
*it
,
397 extern void of_alias_scan(void * (*dt_alloc
)(u64 size
, u64 align
));
398 extern int of_alias_get_id(const struct device_node
*np
, const char *stem
);
399 extern int of_alias_get_highest_id(const char *stem
);
401 bool of_machine_compatible_match(const char *const *compats
);
404 * of_machine_is_compatible - Test root of device tree for a given compatible value
405 * @compat: compatible string to look for in root node's compatible property.
407 * Return: true if the root node has the given value in its compatible property.
409 static inline bool of_machine_is_compatible(const char *compat
)
411 const char *compats
[] = { compat
, NULL
};
413 return of_machine_compatible_match(compats
);
416 extern int of_add_property(struct device_node
*np
, struct property
*prop
);
417 extern int of_remove_property(struct device_node
*np
, struct property
*prop
);
418 extern int of_update_property(struct device_node
*np
, struct property
*newprop
);
420 /* For updating the device tree at runtime */
421 #define OF_RECONFIG_ATTACH_NODE 0x0001
422 #define OF_RECONFIG_DETACH_NODE 0x0002
423 #define OF_RECONFIG_ADD_PROPERTY 0x0003
424 #define OF_RECONFIG_REMOVE_PROPERTY 0x0004
425 #define OF_RECONFIG_UPDATE_PROPERTY 0x0005
427 extern int of_attach_node(struct device_node
*);
428 extern int of_detach_node(struct device_node
*);
430 #define of_match_ptr(_ptr) (_ptr)
435 * of_property_for_each_u32(np, "propname", u)
436 * printk("U32 value: %x\n", u);
438 const __be32
*of_prop_next_u32(const struct property
*prop
, const __be32
*cur
,
441 * struct property *prop;
444 * of_property_for_each_string(np, "propname", prop, s)
445 * printk("String value: %s\n", s);
447 const char *of_prop_next_string(const struct property
*prop
, const char *cur
);
449 bool of_console_check(const struct device_node
*dn
, char *name
, int index
);
451 int of_map_id(const struct device_node
*np
, u32 id
,
452 const char *map_name
, const char *map_mask_name
,
453 struct device_node
**target
, u32
*id_out
);
455 phys_addr_t
of_dma_get_max_cpu_address(struct device_node
*np
);
458 void *of_kexec_alloc_and_setup_fdt(const struct kimage
*image
,
459 unsigned long initrd_load_addr
,
460 unsigned long initrd_len
,
461 const char *cmdline
, size_t extra_fdt_size
);
462 #else /* CONFIG_OF */
464 static inline void of_core_init(void)
468 static inline bool is_of_node(const struct fwnode_handle
*fwnode
)
473 static inline struct device_node
*to_of_node(const struct fwnode_handle
*fwnode
)
478 static inline bool of_node_name_eq(const struct device_node
*np
, const char *name
)
483 static inline bool of_node_name_prefix(const struct device_node
*np
, const char *prefix
)
488 static inline const char* of_node_full_name(const struct device_node
*np
)
493 static inline struct device_node
*of_find_node_by_name(struct device_node
*from
,
499 static inline struct device_node
*of_find_node_by_type(struct device_node
*from
,
505 static inline struct device_node
*of_find_matching_node_and_match(
506 struct device_node
*from
,
507 const struct of_device_id
*matches
,
508 const struct of_device_id
**match
)
513 static inline struct device_node
*of_find_node_by_path(const char *path
)
518 static inline struct device_node
*of_find_node_opts_by_path(const char *path
,
524 static inline struct device_node
*of_find_node_by_phandle(phandle handle
)
529 static inline struct device_node
*of_get_parent(const struct device_node
*node
)
534 static inline struct device_node
*of_get_next_parent(struct device_node
*node
)
539 static inline struct device_node
*of_get_next_child(
540 const struct device_node
*node
, struct device_node
*prev
)
545 static inline struct device_node
*of_get_next_available_child(
546 const struct device_node
*node
, struct device_node
*prev
)
551 static inline struct device_node
*of_get_next_reserved_child(
552 const struct device_node
*node
, struct device_node
*prev
)
557 static inline struct device_node
*of_find_node_with_property(
558 struct device_node
*from
, const char *prop_name
)
563 #define of_fwnode_handle(node) NULL
565 static inline struct device_node
*of_get_compatible_child(const struct device_node
*parent
,
566 const char *compatible
)
571 static inline struct device_node
*of_get_child_by_name(
572 const struct device_node
*node
,
578 static inline int of_device_is_compatible(const struct device_node
*device
,
584 static inline int of_device_compatible_match(const struct device_node
*device
,
585 const char *const *compat
)
590 static inline bool of_device_is_available(const struct device_node
*device
)
595 static inline bool of_device_is_big_endian(const struct device_node
*device
)
600 static inline struct property
*of_find_property(const struct device_node
*np
,
607 static inline struct device_node
*of_find_compatible_node(
608 struct device_node
*from
,
615 static inline int of_property_count_elems_of_size(const struct device_node
*np
,
616 const char *propname
, int elem_size
)
621 static inline int of_property_read_u32_index(const struct device_node
*np
,
622 const char *propname
, u32 index
, u32
*out_value
)
627 static inline int of_property_read_u64_index(const struct device_node
*np
,
628 const char *propname
, u32 index
, u64
*out_value
)
633 static inline const void *of_get_property(const struct device_node
*node
,
640 static inline struct device_node
*of_get_cpu_node(int cpu
,
641 unsigned int *thread
)
646 static inline struct device_node
*of_cpu_device_node_get(int cpu
)
651 static inline int of_cpu_node_to_id(struct device_node
*np
)
656 static inline struct device_node
*of_get_next_cpu_node(struct device_node
*prev
)
661 static inline struct device_node
*of_get_cpu_state_node(struct device_node
*cpu_node
,
667 static inline int of_n_addr_cells(struct device_node
*np
)
672 static inline int of_n_size_cells(struct device_node
*np
)
677 static inline int of_property_read_variable_u8_array(const struct device_node
*np
,
678 const char *propname
, u8
*out_values
,
679 size_t sz_min
, size_t sz_max
)
684 static inline int of_property_read_variable_u16_array(const struct device_node
*np
,
685 const char *propname
, u16
*out_values
,
686 size_t sz_min
, size_t sz_max
)
691 static inline int of_property_read_variable_u32_array(const struct device_node
*np
,
692 const char *propname
,
700 static inline int of_property_read_u64(const struct device_node
*np
,
701 const char *propname
, u64
*out_value
)
706 static inline int of_property_read_variable_u64_array(const struct device_node
*np
,
707 const char *propname
,
715 static inline int of_property_read_string(const struct device_node
*np
,
716 const char *propname
,
717 const char **out_string
)
722 static inline int of_property_match_string(const struct device_node
*np
,
723 const char *propname
,
729 static inline int of_property_read_string_helper(const struct device_node
*np
,
730 const char *propname
,
731 const char **out_strs
, size_t sz
, int index
)
736 static inline int __of_parse_phandle_with_args(const struct device_node
*np
,
737 const char *list_name
,
738 const char *cells_name
,
741 struct of_phandle_args
*out_args
)
746 static inline int of_parse_phandle_with_args_map(const struct device_node
*np
,
747 const char *list_name
,
748 const char *stem_name
,
750 struct of_phandle_args
*out_args
)
755 static inline int of_count_phandle_with_args(const struct device_node
*np
,
756 const char *list_name
,
757 const char *cells_name
)
762 static inline ssize_t
of_modalias(const struct device_node
*np
, char *str
,
768 static inline int of_request_module(const struct device_node
*np
)
773 static inline int of_phandle_iterator_init(struct of_phandle_iterator
*it
,
774 const struct device_node
*np
,
775 const char *list_name
,
776 const char *cells_name
,
782 static inline int of_phandle_iterator_next(struct of_phandle_iterator
*it
)
787 static inline int of_phandle_iterator_args(struct of_phandle_iterator
*it
,
794 static inline int of_alias_get_id(struct device_node
*np
, const char *stem
)
799 static inline int of_alias_get_highest_id(const char *stem
)
804 static inline int of_machine_is_compatible(const char *compat
)
809 static inline int of_add_property(struct device_node
*np
, struct property
*prop
)
814 static inline int of_remove_property(struct device_node
*np
, struct property
*prop
)
819 static inline bool of_machine_compatible_match(const char *const *compats
)
824 static inline bool of_console_check(const struct device_node
*dn
, const char *name
, int index
)
829 static inline const __be32
*of_prop_next_u32(const struct property
*prop
,
830 const __be32
*cur
, u32
*pu
)
835 static inline const char *of_prop_next_string(const struct property
*prop
,
841 static inline int of_node_check_flag(struct device_node
*n
, unsigned long flag
)
846 static inline int of_node_test_and_set_flag(struct device_node
*n
,
852 static inline void of_node_set_flag(struct device_node
*n
, unsigned long flag
)
856 static inline void of_node_clear_flag(struct device_node
*n
, unsigned long flag
)
860 static inline int of_property_check_flag(const struct property
*p
,
866 static inline void of_property_set_flag(struct property
*p
, unsigned long flag
)
870 static inline void of_property_clear_flag(struct property
*p
, unsigned long flag
)
874 static inline int of_map_id(const struct device_node
*np
, u32 id
,
875 const char *map_name
, const char *map_mask_name
,
876 struct device_node
**target
, u32
*id_out
)
881 static inline phys_addr_t
of_dma_get_max_cpu_address(struct device_node
*np
)
883 return PHYS_ADDR_MAX
;
886 static inline const void *of_device_get_match_data(const struct device
*dev
)
891 #define of_match_ptr(_ptr) NULL
892 #define of_match_node(_matches, _node) NULL
893 #endif /* CONFIG_OF */
895 /* Default string compare functions, Allow arch asm/prom.h to override */
896 #if !defined(of_compat_cmp)
897 #define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2))
898 #define of_prop_cmp(s1, s2) strcmp((s1), (s2))
899 #define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
902 static inline int of_prop_val_eq(const struct property
*p1
, const struct property
*p2
)
904 return p1
->length
== p2
->length
&&
905 !memcmp(p1
->value
, p2
->value
, (size_t)p1
->length
);
908 #define for_each_property_of_node(dn, pp) \
909 for (pp = dn->properties; pp != NULL; pp = pp->next)
911 #if defined(CONFIG_OF) && defined(CONFIG_NUMA)
912 extern int of_node_to_nid(struct device_node
*np
);
914 static inline int of_node_to_nid(struct device_node
*device
)
920 #ifdef CONFIG_OF_NUMA
921 extern int of_numa_init(void);
923 static inline int of_numa_init(void)
929 static inline struct device_node
*of_find_matching_node(
930 struct device_node
*from
,
931 const struct of_device_id
*matches
)
933 return of_find_matching_node_and_match(from
, matches
, NULL
);
936 static inline const char *of_node_get_device_type(const struct device_node
*np
)
938 return of_get_property(np
, "device_type", NULL
);
941 static inline bool of_node_is_type(const struct device_node
*np
, const char *type
)
943 const char *match
= of_node_get_device_type(np
);
945 return np
&& match
&& type
&& !strcmp(match
, type
);
949 * of_parse_phandle - Resolve a phandle property to a device_node pointer
950 * @np: Pointer to device node holding phandle property
951 * @phandle_name: Name of property holding a phandle value
952 * @index: For properties holding a table of phandles, this is the index into
955 * Return: The device_node pointer with refcount incremented. Use
956 * of_node_put() on it when done.
958 static inline struct device_node
*of_parse_phandle(const struct device_node
*np
,
959 const char *phandle_name
,
962 struct of_phandle_args args
;
964 if (__of_parse_phandle_with_args(np
, phandle_name
, NULL
, 0,
972 * of_parse_phandle_with_args() - Find a node pointed by phandle in a list
973 * @np: pointer to a device tree node containing a list
974 * @list_name: property name that contains a list
975 * @cells_name: property name that specifies phandles' arguments count
976 * @index: index of a phandle to parse out
977 * @out_args: optional pointer to output arguments structure (will be filled)
979 * This function is useful to parse lists of phandles and their arguments.
980 * Returns 0 on success and fills out_args, on error returns appropriate
983 * Caller is responsible to call of_node_put() on the returned out_args->np
997 * list = <&phandle1 1 2 &phandle2 3>;
1000 * To get a device_node of the ``node2`` node you may call this:
1001 * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
1003 static inline int of_parse_phandle_with_args(const struct device_node
*np
,
1004 const char *list_name
,
1005 const char *cells_name
,
1007 struct of_phandle_args
*out_args
)
1009 int cell_count
= -1;
1011 /* If cells_name is NULL we assume a cell count of 0 */
1015 return __of_parse_phandle_with_args(np
, list_name
, cells_name
,
1016 cell_count
, index
, out_args
);
1020 * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list
1021 * @np: pointer to a device tree node containing a list
1022 * @list_name: property name that contains a list
1023 * @cell_count: number of argument cells following the phandle
1024 * @index: index of a phandle to parse out
1025 * @out_args: optional pointer to output arguments structure (will be filled)
1027 * This function is useful to parse lists of phandles and their arguments.
1028 * Returns 0 on success and fills out_args, on error returns appropriate
1031 * Caller is responsible to call of_node_put() on the returned out_args->np
1043 * list = <&phandle1 0 2 &phandle2 2 3>;
1046 * To get a device_node of the ``node2`` node you may call this:
1047 * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args);
1049 static inline int of_parse_phandle_with_fixed_args(const struct device_node
*np
,
1050 const char *list_name
,
1053 struct of_phandle_args
*out_args
)
1055 return __of_parse_phandle_with_args(np
, list_name
, NULL
, cell_count
,
1060 * of_parse_phandle_with_optional_args() - Find a node pointed by phandle in a list
1061 * @np: pointer to a device tree node containing a list
1062 * @list_name: property name that contains a list
1063 * @cells_name: property name that specifies phandles' arguments count
1064 * @index: index of a phandle to parse out
1065 * @out_args: optional pointer to output arguments structure (will be filled)
1067 * Same as of_parse_phandle_with_args() except that if the cells_name property
1068 * is not found, cell_count of 0 is assumed.
1070 * This is used to useful, if you have a phandle which didn't have arguments
1071 * before and thus doesn't have a '#*-cells' property but is now migrated to
1072 * having arguments while retaining backwards compatibility.
1074 static inline int of_parse_phandle_with_optional_args(const struct device_node
*np
,
1075 const char *list_name
,
1076 const char *cells_name
,
1078 struct of_phandle_args
*out_args
)
1080 return __of_parse_phandle_with_args(np
, list_name
, cells_name
,
1081 0, index
, out_args
);
1085 * of_phandle_args_equal() - Compare two of_phandle_args
1086 * @a1: First of_phandle_args to compare
1087 * @a2: Second of_phandle_args to compare
1089 * Return: True if a1 and a2 are the same (same node pointer, same phandle
1090 * args), false otherwise.
1092 static inline bool of_phandle_args_equal(const struct of_phandle_args
*a1
,
1093 const struct of_phandle_args
*a2
)
1095 return a1
->np
== a2
->np
&&
1096 a1
->args_count
== a2
->args_count
&&
1097 !memcmp(a1
->args
, a2
->args
, sizeof(a1
->args
[0]) * a1
->args_count
);
1101 * of_property_count_u8_elems - Count the number of u8 elements in a property
1103 * @np: device node from which the property value is to be read.
1104 * @propname: name of the property to be searched.
1106 * Search for a property in a device node and count the number of u8 elements
1109 * Return: The number of elements on sucess, -EINVAL if the property does
1110 * not exist or its length does not match a multiple of u8 and -ENODATA if the
1111 * property does not have a value.
1113 static inline int of_property_count_u8_elems(const struct device_node
*np
,
1114 const char *propname
)
1116 return of_property_count_elems_of_size(np
, propname
, sizeof(u8
));
1120 * of_property_count_u16_elems - Count the number of u16 elements in a property
1122 * @np: device node from which the property value is to be read.
1123 * @propname: name of the property to be searched.
1125 * Search for a property in a device node and count the number of u16 elements
1128 * Return: The number of elements on sucess, -EINVAL if the property does
1129 * not exist or its length does not match a multiple of u16 and -ENODATA if the
1130 * property does not have a value.
1132 static inline int of_property_count_u16_elems(const struct device_node
*np
,
1133 const char *propname
)
1135 return of_property_count_elems_of_size(np
, propname
, sizeof(u16
));
1139 * of_property_count_u32_elems - Count the number of u32 elements in a property
1141 * @np: device node from which the property value is to be read.
1142 * @propname: name of the property to be searched.
1144 * Search for a property in a device node and count the number of u32 elements
1147 * Return: The number of elements on sucess, -EINVAL if the property does
1148 * not exist or its length does not match a multiple of u32 and -ENODATA if the
1149 * property does not have a value.
1151 static inline int of_property_count_u32_elems(const struct device_node
*np
,
1152 const char *propname
)
1154 return of_property_count_elems_of_size(np
, propname
, sizeof(u32
));
1158 * of_property_count_u64_elems - Count the number of u64 elements in a property
1160 * @np: device node from which the property value is to be read.
1161 * @propname: name of the property to be searched.
1163 * Search for a property in a device node and count the number of u64 elements
1166 * Return: The number of elements on sucess, -EINVAL if the property does
1167 * not exist or its length does not match a multiple of u64 and -ENODATA if the
1168 * property does not have a value.
1170 static inline int of_property_count_u64_elems(const struct device_node
*np
,
1171 const char *propname
)
1173 return of_property_count_elems_of_size(np
, propname
, sizeof(u64
));
1177 * of_property_read_string_array() - Read an array of strings from a multiple
1179 * @np: device node from which the property value is to be read.
1180 * @propname: name of the property to be searched.
1181 * @out_strs: output array of string pointers.
1182 * @sz: number of array elements to read.
1184 * Search for a property in a device tree node and retrieve a list of
1185 * terminated string values (pointer to data, not a copy) in that property.
1187 * Return: If @out_strs is NULL, the number of strings in the property is returned.
1189 static inline int of_property_read_string_array(const struct device_node
*np
,
1190 const char *propname
, const char **out_strs
,
1193 return of_property_read_string_helper(np
, propname
, out_strs
, sz
, 0);
1197 * of_property_count_strings() - Find and return the number of strings from a
1198 * multiple strings property.
1199 * @np: device node from which the property value is to be read.
1200 * @propname: name of the property to be searched.
1202 * Search for a property in a device tree node and retrieve the number of null
1203 * terminated string contain in it.
1205 * Return: The number of strings on success, -EINVAL if the property does not
1206 * exist, -ENODATA if property does not have a value, and -EILSEQ if the string
1207 * is not null-terminated within the length of the property data.
1209 static inline int of_property_count_strings(const struct device_node
*np
,
1210 const char *propname
)
1212 return of_property_read_string_helper(np
, propname
, NULL
, 0, 0);
1216 * of_property_read_string_index() - Find and read a string from a multiple
1218 * @np: device node from which the property value is to be read.
1219 * @propname: name of the property to be searched.
1220 * @index: index of the string in the list of strings
1221 * @output: pointer to null terminated return string, modified only if
1222 * return value is 0.
1224 * Search for a property in a device tree node and retrieve a null
1225 * terminated string value (pointer to data, not a copy) in the list of strings
1226 * contained in that property.
1228 * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if
1229 * property does not have a value, and -EILSEQ if the string is not
1230 * null-terminated within the length of the property data.
1232 * The out_string pointer is modified only if a valid string can be decoded.
1234 static inline int of_property_read_string_index(const struct device_node
*np
,
1235 const char *propname
,
1236 int index
, const char **output
)
1238 int rc
= of_property_read_string_helper(np
, propname
, output
, 1, index
);
1239 return rc
< 0 ? rc
: 0;
1243 * of_property_read_bool - Find a property
1244 * @np: device node from which the property value is to be read.
1245 * @propname: name of the property to be searched.
1247 * Search for a boolean property in a device node. Usage on non-boolean
1248 * property types is deprecated.
1250 * Return: true if the property exists false otherwise.
1252 static inline bool of_property_read_bool(const struct device_node
*np
,
1253 const char *propname
)
1255 const struct property
*prop
= of_find_property(np
, propname
, NULL
);
1257 return prop
? true : false;
1261 * of_property_present - Test if a property is present in a node
1262 * @np: device node to search for the property.
1263 * @propname: name of the property to be searched.
1265 * Test for a property present in a device node.
1267 * Return: true if the property exists false otherwise.
1269 static inline bool of_property_present(const struct device_node
*np
, const char *propname
)
1271 return of_property_read_bool(np
, propname
);
1275 * of_property_read_u8_array - Find and read an array of u8 from a property.
1277 * @np: device node from which the property value is to be read.
1278 * @propname: name of the property to be searched.
1279 * @out_values: pointer to return value, modified only if return value is 0.
1280 * @sz: number of array elements to read
1282 * Search for a property in a device node and read 8-bit value(s) from
1285 * dts entry of array should be like:
1286 * ``property = /bits/ 8 <0x50 0x60 0x70>;``
1288 * Return: 0 on success, -EINVAL if the property does not exist,
1289 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1290 * property data isn't large enough.
1292 * The out_values is modified only if a valid u8 value can be decoded.
1294 static inline int of_property_read_u8_array(const struct device_node
*np
,
1295 const char *propname
,
1296 u8
*out_values
, size_t sz
)
1298 int ret
= of_property_read_variable_u8_array(np
, propname
, out_values
,
1307 * of_property_read_u16_array - Find and read an array of u16 from a property.
1309 * @np: device node from which the property value is to be read.
1310 * @propname: name of the property to be searched.
1311 * @out_values: pointer to return value, modified only if return value is 0.
1312 * @sz: number of array elements to read
1314 * Search for a property in a device node and read 16-bit value(s) from
1317 * dts entry of array should be like:
1318 * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
1320 * Return: 0 on success, -EINVAL if the property does not exist,
1321 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1322 * property data isn't large enough.
1324 * The out_values is modified only if a valid u16 value can be decoded.
1326 static inline int of_property_read_u16_array(const struct device_node
*np
,
1327 const char *propname
,
1328 u16
*out_values
, size_t sz
)
1330 int ret
= of_property_read_variable_u16_array(np
, propname
, out_values
,
1339 * of_property_read_u32_array - Find and read an array of 32 bit integers
1342 * @np: device node from which the property value is to be read.
1343 * @propname: name of the property to be searched.
1344 * @out_values: pointer to return value, modified only if return value is 0.
1345 * @sz: number of array elements to read
1347 * Search for a property in a device node and read 32-bit value(s) from
1350 * Return: 0 on success, -EINVAL if the property does not exist,
1351 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1352 * property data isn't large enough.
1354 * The out_values is modified only if a valid u32 value can be decoded.
1356 static inline int of_property_read_u32_array(const struct device_node
*np
,
1357 const char *propname
,
1358 u32
*out_values
, size_t sz
)
1360 int ret
= of_property_read_variable_u32_array(np
, propname
, out_values
,
1369 * of_property_read_u64_array - Find and read an array of 64 bit integers
1372 * @np: device node from which the property value is to be read.
1373 * @propname: name of the property to be searched.
1374 * @out_values: pointer to return value, modified only if return value is 0.
1375 * @sz: number of array elements to read
1377 * Search for a property in a device node and read 64-bit value(s) from
1380 * Return: 0 on success, -EINVAL if the property does not exist,
1381 * -ENODATA if property does not have a value, and -EOVERFLOW if the
1382 * property data isn't large enough.
1384 * The out_values is modified only if a valid u64 value can be decoded.
1386 static inline int of_property_read_u64_array(const struct device_node
*np
,
1387 const char *propname
,
1388 u64
*out_values
, size_t sz
)
1390 int ret
= of_property_read_variable_u64_array(np
, propname
, out_values
,
1398 static inline int of_property_read_u8(const struct device_node
*np
,
1399 const char *propname
,
1402 return of_property_read_u8_array(np
, propname
, out_value
, 1);
1405 static inline int of_property_read_u16(const struct device_node
*np
,
1406 const char *propname
,
1409 return of_property_read_u16_array(np
, propname
, out_value
, 1);
1412 static inline int of_property_read_u32(const struct device_node
*np
,
1413 const char *propname
,
1416 return of_property_read_u32_array(np
, propname
, out_value
, 1);
1419 static inline int of_property_read_s32(const struct device_node
*np
,
1420 const char *propname
,
1423 return of_property_read_u32(np
, propname
, (u32
*) out_value
);
1426 #define of_for_each_phandle(it, err, np, ln, cn, cc) \
1427 for (of_phandle_iterator_init((it), (np), (ln), (cn), (cc)), \
1428 err = of_phandle_iterator_next(it); \
1430 err = of_phandle_iterator_next(it))
1432 #define of_property_for_each_u32(np, propname, u) \
1433 for (struct {const struct property *prop; const __be32 *item; } _it = \
1434 {of_find_property(np, propname, NULL), \
1435 of_prop_next_u32(_it.prop, NULL, &u)}; \
1437 _it.item = of_prop_next_u32(_it.prop, _it.item, &u))
1439 #define of_property_for_each_string(np, propname, prop, s) \
1440 for (prop = of_find_property(np, propname, NULL), \
1441 s = of_prop_next_string(prop, NULL); \
1443 s = of_prop_next_string(prop, s))
1445 #define for_each_node_by_name(dn, name) \
1446 for (dn = of_find_node_by_name(NULL, name); dn; \
1447 dn = of_find_node_by_name(dn, name))
1448 #define for_each_node_by_type(dn, type) \
1449 for (dn = of_find_node_by_type(NULL, type); dn; \
1450 dn = of_find_node_by_type(dn, type))
1451 #define for_each_compatible_node(dn, type, compatible) \
1452 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
1453 dn = of_find_compatible_node(dn, type, compatible))
1454 #define for_each_matching_node(dn, matches) \
1455 for (dn = of_find_matching_node(NULL, matches); dn; \
1456 dn = of_find_matching_node(dn, matches))
1457 #define for_each_matching_node_and_match(dn, matches, match) \
1458 for (dn = of_find_matching_node_and_match(NULL, matches, match); \
1459 dn; dn = of_find_matching_node_and_match(dn, matches, match))
1461 #define for_each_child_of_node(parent, child) \
1462 for (child = of_get_next_child(parent, NULL); child != NULL; \
1463 child = of_get_next_child(parent, child))
1465 #define for_each_child_of_node_scoped(parent, child) \
1466 for (struct device_node *child __free(device_node) = \
1467 of_get_next_child(parent, NULL); \
1469 child = of_get_next_child(parent, child))
1471 #define for_each_available_child_of_node(parent, child) \
1472 for (child = of_get_next_available_child(parent, NULL); child != NULL; \
1473 child = of_get_next_available_child(parent, child))
1474 #define for_each_reserved_child_of_node(parent, child) \
1475 for (child = of_get_next_reserved_child(parent, NULL); child != NULL; \
1476 child = of_get_next_reserved_child(parent, child))
1478 #define for_each_available_child_of_node_scoped(parent, child) \
1479 for (struct device_node *child __free(device_node) = \
1480 of_get_next_available_child(parent, NULL); \
1482 child = of_get_next_available_child(parent, child))
1484 #define for_each_of_cpu_node(cpu) \
1485 for (cpu = of_get_next_cpu_node(NULL); cpu != NULL; \
1486 cpu = of_get_next_cpu_node(cpu))
1488 #define for_each_node_with_property(dn, prop_name) \
1489 for (dn = of_find_node_with_property(NULL, prop_name); dn; \
1490 dn = of_find_node_with_property(dn, prop_name))
1492 static inline int of_get_child_count(const struct device_node
*np
)
1494 struct device_node
*child
;
1497 for_each_child_of_node(np
, child
)
1503 static inline int of_get_available_child_count(const struct device_node
*np
)
1505 struct device_node
*child
;
1508 for_each_available_child_of_node(np
, child
)
1514 #define _OF_DECLARE_STUB(table, name, compat, fn, fn_type) \
1515 static const struct of_device_id __of_table_##name \
1516 __attribute__((unused)) \
1517 = { .compatible = compat, \
1518 .data = (fn == (fn_type)NULL) ? fn : fn }
1520 #if defined(CONFIG_OF) && !defined(MODULE)
1521 #define _OF_DECLARE(table, name, compat, fn, fn_type) \
1522 static const struct of_device_id __of_table_##name \
1523 __used __section("__" #table "_of_table") \
1524 __aligned(__alignof__(struct of_device_id)) \
1525 = { .compatible = compat, \
1526 .data = (fn == (fn_type)NULL) ? fn : fn }
1528 #define _OF_DECLARE(table, name, compat, fn, fn_type) \
1529 _OF_DECLARE_STUB(table, name, compat, fn, fn_type)
1532 typedef int (*of_init_fn_2
)(struct device_node
*, struct device_node
*);
1533 typedef int (*of_init_fn_1_ret
)(struct device_node
*);
1534 typedef void (*of_init_fn_1
)(struct device_node
*);
1536 #define OF_DECLARE_1(table, name, compat, fn) \
1537 _OF_DECLARE(table, name, compat, fn, of_init_fn_1)
1538 #define OF_DECLARE_1_RET(table, name, compat, fn) \
1539 _OF_DECLARE(table, name, compat, fn, of_init_fn_1_ret)
1540 #define OF_DECLARE_2(table, name, compat, fn) \
1541 _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
1544 * struct of_changeset_entry - Holds a changeset entry
1546 * @node: list_head for the log list
1547 * @action: notifier action
1548 * @np: pointer to the device node affected
1549 * @prop: pointer to the property affected
1550 * @old_prop: hold a pointer to the original property
1552 * Every modification of the device tree during a changeset
1553 * is held in a list of of_changeset_entry structures.
1554 * That way we can recover from a partial application, or we can
1555 * revert the changeset
1557 struct of_changeset_entry
{
1558 struct list_head node
;
1559 unsigned long action
;
1560 struct device_node
*np
;
1561 struct property
*prop
;
1562 struct property
*old_prop
;
1566 * struct of_changeset - changeset tracker structure
1568 * @entries: list_head for the changeset entries
1570 * changesets are a convenient way to apply bulk changes to the
1571 * live tree. In case of an error, changes are rolled-back.
1572 * changesets live on after initial application, and if not
1573 * destroyed after use, they can be reverted in one single call.
1575 struct of_changeset
{
1576 struct list_head entries
;
1579 enum of_reconfig_change
{
1580 OF_RECONFIG_NO_CHANGE
= 0,
1581 OF_RECONFIG_CHANGE_ADD
,
1582 OF_RECONFIG_CHANGE_REMOVE
,
1585 struct notifier_block
;
1587 #ifdef CONFIG_OF_DYNAMIC
1588 extern int of_reconfig_notifier_register(struct notifier_block
*);
1589 extern int of_reconfig_notifier_unregister(struct notifier_block
*);
1590 extern int of_reconfig_notify(unsigned long, struct of_reconfig_data
*rd
);
1591 extern int of_reconfig_get_state_change(unsigned long action
,
1592 struct of_reconfig_data
*arg
);
1594 extern void of_changeset_init(struct of_changeset
*ocs
);
1595 extern void of_changeset_destroy(struct of_changeset
*ocs
);
1596 extern int of_changeset_apply(struct of_changeset
*ocs
);
1597 extern int of_changeset_revert(struct of_changeset
*ocs
);
1598 extern int of_changeset_action(struct of_changeset
*ocs
,
1599 unsigned long action
, struct device_node
*np
,
1600 struct property
*prop
);
1602 static inline int of_changeset_attach_node(struct of_changeset
*ocs
,
1603 struct device_node
*np
)
1605 return of_changeset_action(ocs
, OF_RECONFIG_ATTACH_NODE
, np
, NULL
);
1608 static inline int of_changeset_detach_node(struct of_changeset
*ocs
,
1609 struct device_node
*np
)
1611 return of_changeset_action(ocs
, OF_RECONFIG_DETACH_NODE
, np
, NULL
);
1614 static inline int of_changeset_add_property(struct of_changeset
*ocs
,
1615 struct device_node
*np
, struct property
*prop
)
1617 return of_changeset_action(ocs
, OF_RECONFIG_ADD_PROPERTY
, np
, prop
);
1620 static inline int of_changeset_remove_property(struct of_changeset
*ocs
,
1621 struct device_node
*np
, struct property
*prop
)
1623 return of_changeset_action(ocs
, OF_RECONFIG_REMOVE_PROPERTY
, np
, prop
);
1626 static inline int of_changeset_update_property(struct of_changeset
*ocs
,
1627 struct device_node
*np
, struct property
*prop
)
1629 return of_changeset_action(ocs
, OF_RECONFIG_UPDATE_PROPERTY
, np
, prop
);
1632 struct device_node
*of_changeset_create_node(struct of_changeset
*ocs
,
1633 struct device_node
*parent
,
1634 const char *full_name
);
1635 int of_changeset_add_prop_string(struct of_changeset
*ocs
,
1636 struct device_node
*np
,
1637 const char *prop_name
, const char *str
);
1638 int of_changeset_add_prop_string_array(struct of_changeset
*ocs
,
1639 struct device_node
*np
,
1640 const char *prop_name
,
1641 const char * const *str_array
, size_t sz
);
1642 int of_changeset_add_prop_u32_array(struct of_changeset
*ocs
,
1643 struct device_node
*np
,
1644 const char *prop_name
,
1645 const u32
*array
, size_t sz
);
1646 static inline int of_changeset_add_prop_u32(struct of_changeset
*ocs
,
1647 struct device_node
*np
,
1648 const char *prop_name
,
1651 return of_changeset_add_prop_u32_array(ocs
, np
, prop_name
, &val
, 1);
1654 int of_changeset_add_prop_bool(struct of_changeset
*ocs
, struct device_node
*np
,
1655 const char *prop_name
);
1657 #else /* CONFIG_OF_DYNAMIC */
1658 static inline int of_reconfig_notifier_register(struct notifier_block
*nb
)
1662 static inline int of_reconfig_notifier_unregister(struct notifier_block
*nb
)
1666 static inline int of_reconfig_notify(unsigned long action
,
1667 struct of_reconfig_data
*arg
)
1671 static inline int of_reconfig_get_state_change(unsigned long action
,
1672 struct of_reconfig_data
*arg
)
1676 #endif /* CONFIG_OF_DYNAMIC */
1679 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
1680 * @np: Pointer to the given device_node
1682 * Return: true if present false otherwise
1684 static inline bool of_device_is_system_power_controller(const struct device_node
*np
)
1686 return of_property_read_bool(np
, "system-power-controller");
1690 * of_have_populated_dt() - Has DT been populated by bootloader
1692 * Return: True if a DTB has been populated by the bootloader and it isn't the
1693 * empty builtin one. False otherwise.
1695 static inline bool of_have_populated_dt(void)
1698 return of_property_present(of_root
, "compatible");
1708 enum of_overlay_notify_action
{
1709 OF_OVERLAY_INIT
= 0, /* kzalloc() of ovcs sets this value */
1710 OF_OVERLAY_PRE_APPLY
,
1711 OF_OVERLAY_POST_APPLY
,
1712 OF_OVERLAY_PRE_REMOVE
,
1713 OF_OVERLAY_POST_REMOVE
,
1716 static inline const char *of_overlay_action_name(enum of_overlay_notify_action action
)
1718 static const char *const of_overlay_action_name
[] = {
1726 return of_overlay_action_name
[action
];
1729 struct of_overlay_notify_data
{
1730 struct device_node
*overlay
;
1731 struct device_node
*target
;
1734 #ifdef CONFIG_OF_OVERLAY
1736 int of_overlay_fdt_apply(const void *overlay_fdt
, u32 overlay_fdt_size
,
1737 int *ovcs_id
, const struct device_node
*target_base
);
1738 int of_overlay_remove(int *ovcs_id
);
1739 int of_overlay_remove_all(void);
1741 int of_overlay_notifier_register(struct notifier_block
*nb
);
1742 int of_overlay_notifier_unregister(struct notifier_block
*nb
);
1746 static inline int of_overlay_fdt_apply(const void *overlay_fdt
, u32 overlay_fdt_size
,
1747 int *ovcs_id
, const struct device_node
*target_base
)
1752 static inline int of_overlay_remove(int *ovcs_id
)
1757 static inline int of_overlay_remove_all(void)
1762 static inline int of_overlay_notifier_register(struct notifier_block
*nb
)
1767 static inline int of_overlay_notifier_unregister(struct notifier_block
*nb
)
1774 #endif /* _LINUX_OF_H */