From: Michal Simek Date: Wed, 16 Mar 2016 16:20:21 +0000 (+0100) Subject: ARM64: zynqmp: Read address and size cells from parent X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=23231d9bddd4bfc235f3b8963a635798d5a0644d;p=thirdparty%2Fu-boot.git ARM64: zynqmp: Read address and size cells from parent Based on these two rules: * #address-cells and #size-cells describe the format of addresses for children of this node, not this node itself. So if you're looking to parse 'reg' for this node, you *always* need to look at the parent, not just as a fallback. * #address-cells and #size-cells are *not* inherited. If they're missing in a node, then the format for its children's addresses is 2 cell addresses and 2 cell sizes, it is *not* correct to look at the next parent up for these properties. fdt_get_reg has to find parent node and read address and size cells from parent node not from actual node. Signed-off-by: Michal Simek --- diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 0f3b57e9e17..e53472cee37 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -70,8 +70,9 @@ static phys_size_t fdt_get_reg(const void *fdt, int nodeoffset, void *buf, const u32 *cell, int n) { int i = 0, b, banks; - int address_cells = fdt_address_cells(fdt, nodeoffset); - int size_cells = fdt_size_cells(fdt, nodeoffset); + int parent_offset = fdt_parent_offset(fdt, nodeoffset); + int address_cells = fdt_address_cells(fdt, parent_offset); + int size_cells = fdt_size_cells(fdt, parent_offset); char *p = buf; phys_addr_t val; phys_size_t vals;