]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/of/base.c
of/irq: Rename "intc_desc" to "of_intc_desc" to fix OF on sh
[karo-tx-linux.git] / drivers / of / base.c
index a1aa0c7dee50c59d51bcf6a672b34f10107be27d..8e39b38ca206214ac7cf462c5f7b2c99078f32ae 100644 (file)
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(of_n_size_cells);
 #ifdef CONFIG_NUMA
 int __weak of_node_to_nid(struct device_node *np)
 {
-       return numa_node_id();
+       return NUMA_NO_NODE;
 }
 #endif
 
@@ -567,6 +567,29 @@ bool of_device_is_available(const struct device_node *device)
 }
 EXPORT_SYMBOL(of_device_is_available);
 
+/**
+ *  of_device_is_big_endian - check if a device has BE registers
+ *
+ *  @device: Node to check for endianness
+ *
+ *  Returns true if the device has a "big-endian" property, or if the kernel
+ *  was compiled for BE *and* the device has a "native-endian" property.
+ *  Returns false otherwise.
+ *
+ *  Callers would nominally use ioread32be/iowrite32be if
+ *  of_device_is_big_endian() == true, or readl/writel otherwise.
+ */
+bool of_device_is_big_endian(const struct device_node *device)
+{
+       if (of_property_read_bool(device, "big-endian"))
+               return true;
+       if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) &&
+           of_property_read_bool(device, "native-endian"))
+               return true;
+       return false;
+}
+EXPORT_SYMBOL(of_device_is_big_endian);
+
 /**
  *     of_get_parent - Get a node's parent if any
  *     @node:  Node to get parent
@@ -640,8 +663,9 @@ static struct device_node *__of_get_next_child(const struct device_node *node,
  *     @node:  parent node
  *     @prev:  previous child of the parent node, or NULL to get first
  *
- *     Returns a node pointer with refcount incremented, use
- *     of_node_put() on it when done.
+ *     Returns a node pointer with refcount incremented, use of_node_put() on
+ *     it when done. Returns NULL when prev is the last child. Decrements the
+ *     refcount of prev.
  */
 struct device_node *of_get_next_child(const struct device_node *node,
        struct device_node *prev)