Merge branch 'for-linus' of git://git.kernel.dk/linux-block
[firefly-linux-kernel-4.4.55.git] / drivers / of / fdt.c
index 3a896c9aeb7464ccf9ba067e27d601316fc1c879..cde35c5d0191bd5950c7953d5b8e88a2d139306f 100644 (file)
@@ -108,6 +108,25 @@ int of_fdt_is_compatible(const void *blob,
        return 0;
 }
 
+/**
+ * of_fdt_is_big_endian - Return true if given node needs BE MMIO accesses
+ * @blob: A device tree blob
+ * @node: node to test
+ *
+ * Returns true if the node has a "big-endian" property, or if the kernel
+ * was compiled for BE *and* the node has a "native-endian" property.
+ * Returns false otherwise.
+ */
+bool of_fdt_is_big_endian(const void *blob, unsigned long node)
+{
+       if (fdt_getprop(blob, node, "big-endian", NULL))
+               return true;
+       if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) &&
+           fdt_getprop(blob, node, "native-endian", NULL))
+               return true;
+       return false;
+}
+
 /**
  * of_fdt_match - Return true if node matches a list of compatible values
  */
@@ -172,7 +191,7 @@ static void * unflatten_dt_node(void *blob,
        if (!pathp)
                return mem;
 
-       allocl = l++;
+       allocl = ++l;
 
        /* version 0x10 has a more compact unit name here instead of the full
         * path. we accumulate the full path size using "fpsize", we'll rebuild
@@ -879,8 +898,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
 
        endp = reg + (l / sizeof(__be32));
 
-       pr_debug("memory scan node %s, reg size %d, data: %x %x %x %x,\n",
-           uname, l, reg[0], reg[1], reg[2], reg[3]);
+       pr_debug("memory scan node %s, reg size %d,\n", uname, l);
 
        while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
                u64 base, size;