For the new "fixed-partitions" binding we ignore the partitions
subnode for creating reproducible names and set node to its parent.
To get the number of address cells we must call of_n_addr_cells()
before setting node to its parent though, not afterwards. With the
current behaviour we always get OF_ROOT_NODE_ADDR_CELLS_DEFAULT (=1).
This happens to work then the partitioned device is less than 4GiB
in size. On bigger devices #address-cells = <2> is chosen by the
mtd partition fixup code.

Signed-off-by: Sascha Hauer <[email protected]>
Reported-by: Bastian Krause <[email protected]>
---
 drivers/of/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b082f0c656..318ba72cb0 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2274,6 +2274,8 @@ char *of_get_reproducible_name(struct device_node *node)
                return basprintf("[0x%llx]", addr);
        }
 
+       na = of_n_addr_cells(node);
+
        /*
         * Special workaround for the of partition binding. In the old binding
         * the partitions are directly under the hardware devicenode whereas in
@@ -2286,8 +2288,6 @@ char *of_get_reproducible_name(struct device_node *node)
                node = node->parent;
        }
 
-       na = of_n_addr_cells(node);
-
        offset = of_read_number(reg, na);
 
        str = of_get_reproducible_name(node->parent);
-- 
2.20.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to