diff options
Diffstat (limited to 'include/linux/of.h')
| -rw-r--r-- | include/linux/of.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index 9180dc5cb00b..5dbe263462a9 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | */ | 17 | */ |
| 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/kref.h> | 21 | #include <linux/kref.h> |
| 21 | #include <linux/mod_devicetable.h> | 22 | #include <linux/mod_devicetable.h> |
| 22 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
| @@ -68,6 +69,7 @@ struct device_node { | |||
| 68 | /* Pointer for first entry in chain of all nodes. */ | 69 | /* Pointer for first entry in chain of all nodes. */ |
| 69 | extern struct device_node *allnodes; | 70 | extern struct device_node *allnodes; |
| 70 | extern struct device_node *of_chosen; | 71 | extern struct device_node *of_chosen; |
| 72 | extern struct device_node *of_aliases; | ||
| 71 | extern rwlock_t devtree_lock; | 73 | extern rwlock_t devtree_lock; |
| 72 | 74 | ||
| 73 | static inline bool of_have_populated_dt(void) | 75 | static inline bool of_have_populated_dt(void) |
| @@ -199,6 +201,8 @@ extern int of_property_read_u32_array(const struct device_node *np, | |||
| 199 | const char *propname, | 201 | const char *propname, |
| 200 | u32 *out_values, | 202 | u32 *out_values, |
| 201 | size_t sz); | 203 | size_t sz); |
| 204 | extern int of_property_read_u64(const struct device_node *np, | ||
| 205 | const char *propname, u64 *out_value); | ||
| 202 | 206 | ||
| 203 | extern int of_property_read_string(struct device_node *np, | 207 | extern int of_property_read_string(struct device_node *np, |
| 204 | const char *propname, | 208 | const char *propname, |
| @@ -209,6 +213,9 @@ extern int of_device_is_available(const struct device_node *device); | |||
| 209 | extern const void *of_get_property(const struct device_node *node, | 213 | extern const void *of_get_property(const struct device_node *node, |
| 210 | const char *name, | 214 | const char *name, |
| 211 | int *lenp); | 215 | int *lenp); |
| 216 | #define for_each_property(pp, properties) \ | ||
| 217 | for (pp = properties; pp != NULL; pp = pp->next) | ||
| 218 | |||
| 212 | extern int of_n_addr_cells(struct device_node *np); | 219 | extern int of_n_addr_cells(struct device_node *np); |
| 213 | extern int of_n_size_cells(struct device_node *np); | 220 | extern int of_n_size_cells(struct device_node *np); |
| 214 | extern const struct of_device_id *of_match_node( | 221 | extern const struct of_device_id *of_match_node( |
| @@ -221,6 +228,9 @@ extern int of_parse_phandles_with_args(struct device_node *np, | |||
| 221 | const char *list_name, const char *cells_name, int index, | 228 | const char *list_name, const char *cells_name, int index, |
| 222 | struct device_node **out_node, const void **out_args); | 229 | struct device_node **out_node, const void **out_args); |
| 223 | 230 | ||
| 231 | extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); | ||
| 232 | extern int of_alias_get_id(struct device_node *np, const char *stem); | ||
| 233 | |||
| 224 | extern int of_machine_is_compatible(const char *compat); | 234 | extern int of_machine_is_compatible(const char *compat); |
| 225 | 235 | ||
| 226 | extern int prom_add_property(struct device_node* np, struct property* prop); | 236 | extern int prom_add_property(struct device_node* np, struct property* prop); |
| @@ -235,6 +245,7 @@ extern void of_attach_node(struct device_node *); | |||
| 235 | extern void of_detach_node(struct device_node *); | 245 | extern void of_detach_node(struct device_node *); |
| 236 | #endif | 246 | #endif |
| 237 | 247 | ||
| 248 | #define of_match_ptr(_ptr) (_ptr) | ||
| 238 | #else /* CONFIG_OF */ | 249 | #else /* CONFIG_OF */ |
| 239 | 250 | ||
| 240 | static inline bool of_have_populated_dt(void) | 251 | static inline bool of_have_populated_dt(void) |
| @@ -242,6 +253,22 @@ static inline bool of_have_populated_dt(void) | |||
| 242 | return false; | 253 | return false; |
| 243 | } | 254 | } |
| 244 | 255 | ||
| 256 | #define for_each_child_of_node(parent, child) \ | ||
| 257 | while (0) | ||
| 258 | |||
| 259 | static inline int of_device_is_compatible(const struct device_node *device, | ||
| 260 | const char *name) | ||
| 261 | { | ||
| 262 | return 0; | ||
| 263 | } | ||
| 264 | |||
| 265 | static inline struct property *of_find_property(const struct device_node *np, | ||
| 266 | const char *name, | ||
| 267 | int *lenp) | ||
| 268 | { | ||
| 269 | return NULL; | ||
| 270 | } | ||
| 271 | |||
| 245 | static inline int of_property_read_u32_array(const struct device_node *np, | 272 | static inline int of_property_read_u32_array(const struct device_node *np, |
| 246 | const char *propname, | 273 | const char *propname, |
| 247 | u32 *out_values, size_t sz) | 274 | u32 *out_values, size_t sz) |
| @@ -263,6 +290,21 @@ static inline const void *of_get_property(const struct device_node *node, | |||
| 263 | return NULL; | 290 | return NULL; |
| 264 | } | 291 | } |
| 265 | 292 | ||
| 293 | static inline int of_property_read_u64(const struct device_node *np, | ||
| 294 | const char *propname, u64 *out_value) | ||
| 295 | { | ||
| 296 | return -ENOSYS; | ||
| 297 | } | ||
| 298 | |||
| 299 | static inline struct device_node *of_parse_phandle(struct device_node *np, | ||
| 300 | const char *phandle_name, | ||
| 301 | int index) | ||
| 302 | { | ||
| 303 | return NULL; | ||
| 304 | } | ||
| 305 | |||
| 306 | #define of_match_ptr(_ptr) NULL | ||
| 307 | #define of_match_node(_matches, _node) NULL | ||
| 266 | #endif /* CONFIG_OF */ | 308 | #endif /* CONFIG_OF */ |
| 267 | 309 | ||
| 268 | static inline int of_property_read_u32(const struct device_node *np, | 310 | static inline int of_property_read_u32(const struct device_node *np, |
