mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of: fix reproducible node name for legacy vs. new partition binding
@ 2018-10-17  8:47 Sascha Hauer
  2018-10-17 11:07 ` Schenk, Gavin
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2018-10-17  8:47 UTC (permalink / raw)
  To: Barebox List

the of_reproducible_name mechanism is used to find a partition node
from the barebox devicetree in the Linux devicetree. Unfortunately
we have two different partition bindings. In the legacy one the partition
nodes are directly under the hardware devicenode whereas in the new
binding the partitions are under an additional partitions subnode.
This means we get two different (not so) reproducible names when
the barebox devicetree uses the legacy binding and the Linux devicetree
uses the new binding (or the other way round). To get the same
name then for these cases we drop the partitions subnode from the
reproducible name.

This makes the partition fixup in barebox-state work when the barebox
devicetree uses another binding than the Linux devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 drivers/of/base.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index fc01a99ef2..f9b1c3c4cb 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2274,6 +2274,18 @@ char *of_get_reproducible_name(struct device_node *node)
 		return basprintf("[0x%llx]", addr);
 	}
 
+	/*
+	 * Special workaround for the of partition binding. In the old binding
+	 * the partitions are directly under the hardware devicenode whereas in
+	 * the new binding the partitions are in an extra subnode with
+	 * "fixed-partitions" compatible. We skip this extra subnode from the
+	 * reproducible name to get the same name for both bindings.
+	 */
+	if (node->parent &&
+	    of_device_is_compatible(node->parent, "fixed-partitions")) {
+		node = node->parent;
+	}
+
 	na = of_n_addr_cells(node);
 
 	offset = of_read_number(reg, na);
-- 
2.19.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-18  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17  8:47 [PATCH] of: fix reproducible node name for legacy vs. new partition binding Sascha Hauer
2018-10-17 11:07 ` Schenk, Gavin
2018-10-18  7:23   ` s.hauer
2018-10-18  9:07     ` Schenk, Gavin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox