]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
ARM64: zynqmp: Read address and size cells from parent
authorMichal Simek <michal.simek@xilinx.com>
Wed, 16 Mar 2016 16:20:21 +0000 (17:20 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 29 Mar 2016 14:28:23 +0000 (16:28 +0200)
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 <michal.simek@xilinx.com>
board/xilinx/zynqmp/zynqmp.c

index 0f3b57e9e17d30db96e9b2e3225aaccd1f0e3d7a..e53472cee37a8996830286031229a96ddb6f9bc8 100644 (file)
@@ -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;