dm: core: Fix up ofnode_get_addr_index() for 64-bit values
authorSimon Glass <sjg@chromium.org>
Tue, 25 Jul 2017 14:29:56 +0000 (08:29 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 28 Jul 2017 18:02:47 +0000 (12:02 -0600)
At present this function only supports 32-bit (single-cell) values. Update
it to support two-cell values also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
drivers/core/ofnode.c

index e4b2a85f19ccc69c4a0ca965d7b449bc0e13d9a4..c3fb0ae7b9124188d2f1d0e9b5a28300fa282027 100644 (file)
@@ -199,13 +199,14 @@ fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
                const __be32 *prop_val;
                uint flags;
                u64 size;
+               int na;
 
-               prop_val = of_get_address(
-                       (struct device_node *)ofnode_to_np(node), index,
-                       &size, &flags);
+               prop_val = of_get_address(ofnode_to_np(node), index, &size,
+                                         &flags);
                if (!prop_val)
                        return FDT_ADDR_T_NONE;
-               return  be32_to_cpup(prop_val);
+               na = of_n_addr_cells(ofnode_to_np(node));
+               return of_read_number(prop_val, na);
        } else {
                return fdt_get_base_address(gd->fdt_blob,
                                            ofnode_to_offset(node));