diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-02 17:27:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-02 17:27:15 -0400 |
commit | b9f2b21a32906a47c220b5167b88869f2c90f1c4 (patch) | |
tree | 96416cec877f9c1f2ee0f0ccdee64e38cc8e0683 /include/linux/of.h | |
parent | 70f6c087573eeb406252ff8d98f511eb5f71496e (diff) | |
parent | a0e7398357f297dd22d043fb2d5aa1c44d61ca10 (diff) |
Merge tag 'dt-for-linus' of git://git.secretlab.ca/git/linux
Pull devicetree changes from Grant Likely:
"Updates to devicetree core code. This branch contains the following
notable changes:
- add reserved memory binding
- make struct device_node a kobject and remove legacy
/proc/device-tree
- ePAPR conformance fixes
- update in-kernel DTC copy to version v1.4.0
- preparatory changes for dynamic device tree overlays
- minor bug fixes and documentation changes
The most significant change in this branch is the conversion of struct
device_node to be a kobject that is exposed via sysfs and removal of
the old /proc/device-tree code. This simplifies the device tree
handling code and tightens up the lifecycle on device tree nodes.
[updated: added fix for dangling select PROC_DEVICETREE]"
* tag 'dt-for-linus' of git://git.secretlab.ca/git/linux: (29 commits)
dt: Remove dangling "select PROC_DEVICETREE"
of: Add support for ePAPR "stdout-path" property
of: device_node kobject lifecycle fixes
of: only scan for reserved mem when fdt present
powerpc: add support for reserved memory defined by device tree
arm64: add support for reserved memory defined by device tree
of: add missing major vendors
of: add vendor prefix for SMSC
of: remove /proc/device-tree
of/selftest: Add self tests for manipulation of properties
of: Make device nodes kobjects so they show up in sysfs
arm: add support for reserved memory defined by device tree
drivers: of: add support for custom reserved memory drivers
drivers: of: add initialization code for dynamic reserved memory
drivers: of: add initialization code for static reserved memory
of: document bindings for reserved-memory nodes
Revert "of: fix of_update_property()"
kbuild: dtbs_install: new make target
ARM: mvebu: Allows to get the SoC ID even without PCI enabled
of: Allows to use the PCI translator without the PCI core
...
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 83d1ac80c91e..919bf211877d 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/kref.h> | 21 | #include <linux/kobject.h> |
22 | #include <linux/mod_devicetable.h> | 22 | #include <linux/mod_devicetable.h> |
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/topology.h> | 24 | #include <linux/topology.h> |
@@ -37,6 +37,7 @@ struct property { | |||
37 | struct property *next; | 37 | struct property *next; |
38 | unsigned long _flags; | 38 | unsigned long _flags; |
39 | unsigned int unique_id; | 39 | unsigned int unique_id; |
40 | struct bin_attribute attr; | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | #if defined(CONFIG_SPARC) | 43 | #if defined(CONFIG_SPARC) |
@@ -56,8 +57,7 @@ struct device_node { | |||
56 | struct device_node *sibling; | 57 | struct device_node *sibling; |
57 | struct device_node *next; /* next device of same type */ | 58 | struct device_node *next; /* next device of same type */ |
58 | struct device_node *allnext; /* next in list of all nodes */ | 59 | struct device_node *allnext; /* next in list of all nodes */ |
59 | struct proc_dir_entry *pde; /* this node's proc directory */ | 60 | struct kobject kobj; |
60 | struct kref kref; | ||
61 | unsigned long _flags; | 61 | unsigned long _flags; |
62 | void *data; | 62 | void *data; |
63 | #if defined(CONFIG_SPARC) | 63 | #if defined(CONFIG_SPARC) |
@@ -67,13 +67,34 @@ struct device_node { | |||
67 | #endif | 67 | #endif |
68 | }; | 68 | }; |
69 | 69 | ||
70 | #define MAX_PHANDLE_ARGS 8 | 70 | #define MAX_PHANDLE_ARGS 16 |
71 | struct of_phandle_args { | 71 | struct of_phandle_args { |
72 | struct device_node *np; | 72 | struct device_node *np; |
73 | int args_count; | 73 | int args_count; |
74 | uint32_t args[MAX_PHANDLE_ARGS]; | 74 | uint32_t args[MAX_PHANDLE_ARGS]; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | extern int of_node_add(struct device_node *node); | ||
78 | |||
79 | /* initialize a node */ | ||
80 | extern struct kobj_type of_node_ktype; | ||
81 | static inline void of_node_init(struct device_node *node) | ||
82 | { | ||
83 | kobject_init(&node->kobj, &of_node_ktype); | ||
84 | } | ||
85 | |||
86 | /* true when node is initialized */ | ||
87 | static inline int of_node_is_initialized(struct device_node *node) | ||
88 | { | ||
89 | return node && node->kobj.state_initialized; | ||
90 | } | ||
91 | |||
92 | /* true when node is attached (i.e. present on sysfs) */ | ||
93 | static inline int of_node_is_attached(struct device_node *node) | ||
94 | { | ||
95 | return node && node->kobj.state_in_sysfs; | ||
96 | } | ||
97 | |||
77 | #ifdef CONFIG_OF_DYNAMIC | 98 | #ifdef CONFIG_OF_DYNAMIC |
78 | extern struct device_node *of_node_get(struct device_node *node); | 99 | extern struct device_node *of_node_get(struct device_node *node); |
79 | extern void of_node_put(struct device_node *node); | 100 | extern void of_node_put(struct device_node *node); |
@@ -114,6 +135,26 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag) | |||
114 | set_bit(flag, &n->_flags); | 135 | set_bit(flag, &n->_flags); |
115 | } | 136 | } |
116 | 137 | ||
138 | static inline void of_node_clear_flag(struct device_node *n, unsigned long flag) | ||
139 | { | ||
140 | clear_bit(flag, &n->_flags); | ||
141 | } | ||
142 | |||
143 | static inline int of_property_check_flag(struct property *p, unsigned long flag) | ||
144 | { | ||
145 | return test_bit(flag, &p->_flags); | ||
146 | } | ||
147 | |||
148 | static inline void of_property_set_flag(struct property *p, unsigned long flag) | ||
149 | { | ||
150 | set_bit(flag, &p->_flags); | ||
151 | } | ||
152 | |||
153 | static inline void of_property_clear_flag(struct property *p, unsigned long flag) | ||
154 | { | ||
155 | clear_bit(flag, &p->_flags); | ||
156 | } | ||
157 | |||
117 | extern struct device_node *of_find_all_nodes(struct device_node *prev); | 158 | extern struct device_node *of_find_all_nodes(struct device_node *prev); |
118 | 159 | ||
119 | /* | 160 | /* |
@@ -167,6 +208,8 @@ static inline const char *of_node_full_name(const struct device_node *np) | |||
167 | return np ? np->full_name : "<no-node>"; | 208 | return np ? np->full_name : "<no-node>"; |
168 | } | 209 | } |
169 | 210 | ||
211 | #define for_each_of_allnodes(dn) \ | ||
212 | for (dn = of_allnodes; dn; dn = dn->allnext) | ||
170 | extern struct device_node *of_find_node_by_name(struct device_node *from, | 213 | extern struct device_node *of_find_node_by_name(struct device_node *from, |
171 | const char *name); | 214 | const char *name); |
172 | extern struct device_node *of_find_node_by_type(struct device_node *from, | 215 | extern struct device_node *of_find_node_by_type(struct device_node *from, |
@@ -709,14 +752,4 @@ static inline int of_get_available_child_count(const struct device_node *np) | |||
709 | return num; | 752 | return num; |
710 | } | 753 | } |
711 | 754 | ||
712 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) | ||
713 | extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); | ||
714 | extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); | ||
715 | extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, | ||
716 | struct property *prop); | ||
717 | extern void proc_device_tree_update_prop(struct proc_dir_entry *pde, | ||
718 | struct property *newprop, | ||
719 | struct property *oldprop); | ||
720 | #endif | ||
721 | |||
722 | #endif /* _LINUX_OF_H */ | 755 | #endif /* _LINUX_OF_H */ |