Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[firefly-linux-kernel-4.4.55.git] / include / linux / of.h
index d5f666290f6b40363a07306e5d60f793ff1a88d9..e7facd8fbce87a35aa25ccd1d2af5121dbba71a0 100644 (file)
@@ -79,6 +79,46 @@ set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
        dn->pde = de;
 }
 
+extern struct device_node *of_find_all_nodes(struct device_node *prev);
+
+#if defined(CONFIG_SPARC)
+/* Dummy ref counting routines - to be implemented later */
+static inline struct device_node *of_node_get(struct device_node *node)
+{
+       return node;
+}
+static inline void of_node_put(struct device_node *node)
+{
+}
+
+#else
+extern struct device_node *of_node_get(struct device_node *node);
+extern void of_node_put(struct device_node *node);
+#endif
+
+/*
+ * OF address retreival & translation
+ */
+
+/* Helper to read a big number; size is in cells (not bytes) */
+static inline u64 of_read_number(const u32 *cell, int size)
+{
+       u64 r = 0;
+       while (size--)
+               r = (r << 32) | *(cell++);
+       return r;
+}
+
+/* Like of_read_number, but we want an unsigned long result */
+#ifdef CONFIG_PPC32
+static inline unsigned long of_read_ulong(const u32 *cell, int size)
+{
+       return cell[size-1];
+}
+#else
+#define of_read_ulong(cell, size)      of_read_number(cell, size)
+#endif
+
 #include <asm/prom.h>
 
 /* flag descriptions */