Patchwork [U-Boot,1/2,v2] fdt: add support for the ePAPR "phandle" property

login
register
mail settings
Submitter Timur Tabi
Date May 6, 2011, 7:56 p.m.
Message ID <1304711797-10549-1-git-send-email-timur@freescale.com>
Download mbox | patch
Permalink /patch/94431/
State Superseded
Headers show

Comments

Timur Tabi - May 6, 2011, 7:56 p.m.
The ePAPR specification says that phandle properties should be called
"phandle", and not "linux,phandle".  To facilitate the migration from
"linux,phandle" to "phandle", we update some functions to support both
properties.

Signed-off-by: Timur Tabi <timur@freescale.com>
---

Upstream libfdt already has the ePAPR changes, so would someone please pull
in those changes?

 common/fdt_support.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Patch

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 496040b..85715ff 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1187,6 +1187,12 @@  int fdt_alloc_phandle(void *blob)
 
 	for (offset = fdt_next_node(blob, -1, NULL); offset >= 0;
 	     offset = fdt_next_node(blob, offset, NULL)) {
+		/* Check the ePAPR-compliant "phandle" property name */
+		val = fdt_getprop(blob, offset, "phandle", &len);
+		if (val)
+			phandle = max(*val, phandle);
+
+		/* Also check the deprecated "linux,phandle" property name */
 		val = fdt_getprop(blob, offset, "linux,phandle", &len);
 		if (val)
 			phandle = max(*val, phandle);