Merge branch 'next/cleanup2' of git://git.linaro.org/people/arnd/arm-soc
[pandora-kernel.git] / include / linux / of.h
index 0085bb0..f01ba8a 100644 (file)
@@ -17,6 +17,7 @@
  */
 #include <linux/types.h>
 #include <linux/bitops.h>
+#include <linux/errno.h>
 #include <linux/kref.h>
 #include <linux/mod_devicetable.h>
 #include <linux/spinlock.h>
@@ -68,6 +69,7 @@ struct device_node {
 /* Pointer for first entry in chain of all nodes. */
 extern struct device_node *allnodes;
 extern struct device_node *of_chosen;
+extern struct device_node *of_aliases;
 extern rwlock_t devtree_lock;
 
 static inline bool of_have_populated_dt(void)
@@ -199,16 +201,26 @@ extern int of_property_read_u32_array(const struct device_node *np,
                                      const char *propname,
                                      u32 *out_values,
                                      size_t sz);
+extern int of_property_read_u64(const struct device_node *np,
+                               const char *propname, u64 *out_value);
 
 extern int of_property_read_string(struct device_node *np,
                                   const char *propname,
                                   const char **out_string);
+extern int of_property_read_string_index(struct device_node *np,
+                                        const char *propname,
+                                        int index, const char **output);
+extern int of_property_count_strings(struct device_node *np,
+                                    const char *propname);
 extern int of_device_is_compatible(const struct device_node *device,
                                   const char *);
 extern int of_device_is_available(const struct device_node *device);
 extern const void *of_get_property(const struct device_node *node,
                                const char *name,
                                int *lenp);
+#define for_each_property(pp, properties) \
+       for (pp = properties; pp != NULL; pp = pp->next)
+
 extern int of_n_addr_cells(struct device_node *np);
 extern int of_n_size_cells(struct device_node *np);
 extern const struct of_device_id *of_match_node(
@@ -221,6 +233,9 @@ extern int of_parse_phandles_with_args(struct device_node *np,
        const char *list_name, const char *cells_name, int index,
        struct device_node **out_node, const void **out_args);
 
+extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
+extern int of_alias_get_id(struct device_node *np, const char *stem);
+
 extern int of_machine_is_compatible(const char *compat);
 
 extern int prom_add_property(struct device_node* np, struct property* prop);
@@ -235,6 +250,7 @@ extern void of_attach_node(struct device_node *);
 extern void of_detach_node(struct device_node *);
 #endif
 
+#define of_match_ptr(_ptr)     (_ptr)
 #else /* CONFIG_OF */
 
 static inline bool of_have_populated_dt(void)
@@ -242,6 +258,22 @@ static inline bool of_have_populated_dt(void)
        return false;
 }
 
+#define for_each_child_of_node(parent, child) \
+       while (0)
+
+static inline int of_device_is_compatible(const struct device_node *device,
+                                         const char *name)
+{
+       return 0;
+}
+
+static inline struct property *of_find_property(const struct device_node *np,
+                                               const char *name,
+                                               int *lenp)
+{
+       return NULL;
+}
+
 static inline int of_property_read_u32_array(const struct device_node *np,
                                             const char *propname,
                                             u32 *out_values, size_t sz)
@@ -256,6 +288,41 @@ static inline int of_property_read_string(struct device_node *np,
        return -ENOSYS;
 }
 
+static inline int of_property_read_string_index(struct device_node *np,
+                                               const char *propname, int index,
+                                               const char **out_string)
+{
+       return -ENOSYS;
+}
+
+static inline int of_property_count_strings(struct device_node *np,
+                                           const char *propname)
+{
+       return -ENOSYS;
+}
+
+static inline const void *of_get_property(const struct device_node *node,
+                               const char *name,
+                               int *lenp)
+{
+       return NULL;
+}
+
+static inline int of_property_read_u64(const struct device_node *np,
+                                      const char *propname, u64 *out_value)
+{
+       return -ENOSYS;
+}
+
+static inline struct device_node *of_parse_phandle(struct device_node *np,
+                                                  const char *phandle_name,
+                                                  int index)
+{
+       return NULL;
+}
+
+#define of_match_ptr(_ptr)     NULL
+#define of_match_node(_matches, _node) NULL
 #endif /* CONFIG_OF */
 
 static inline int of_property_read_u32(const struct device_node *np,