diff options
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r-- | drivers/of/fdt.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 3a896c9aeb74..cde35c5d0191 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -109,6 +109,25 @@ int of_fdt_is_compatible(const void *blob, } /** + * 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 */ int of_fdt_match(const void *blob, unsigned long node, @@ -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; |