Size cell and address cell should be read from the parent node
and should not assume with data structures as an example
TI DRA7xx SoC is enabled as 64bit as there is LPAE support
but the addresses specified in DT are all 32 bit sizes. So
changing the code to read from parent node instead of
calculations.

Signed-off-by: Mugunthan V N <mugunthan...@ti.com>
---
 lib/fdtdec.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 70acc29..8a5fb8c 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -88,15 +88,20 @@ fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int 
node,
        const fdt32_t *prop_addr, *prop_size, *prop_after_size;
        int len;
        fdt_addr_t addr;
+       int parent;
 
        debug("%s: %s: ", __func__, prop_name);
 
-       if (na > (sizeof(fdt_addr_t) / sizeof(fdt32_t))) {
+       parent = fdt_parent_offset(blob, node);
+
+       na = fdt_address_cells(blob, parent);
+       if (na < 1) {
                debug("(na too large for fdt_addr_t type)\n");
                return FDT_ADDR_T_NONE;
        }
 
-       if (ns > (sizeof(fdt_size_t) / sizeof(fdt32_t))) {
+       ns = fdt_size_cells(blob, parent);
+       if (ns < 0) {
                debug("(ns too large for fdt_size_t type)\n");
                return FDT_ADDR_T_NONE;
        }
-- 
2.8.1.101.g72d917a

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to