summaryrefslogtreecommitdiffstats
path: root/drivers/of/fdt.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2010-02-01 21:34:15 -0700
committerGrant Likely <grant.likely@secretlab.ca>2010-02-09 08:34:10 -0700
commit04b954a673dd02f585a2769c4945a43880faa989 (patch)
treea786421a31b92b9496bcf8937ce4e4ee592c8955 /drivers/of/fdt.c
parent087f79c48c090a2c0cd9ee45231d63290d2036d2 (diff)
of/flattree: Make the kernel accept ePAPR style phandle information
Currently when processing flattened device trees, the kernel expects the phandle in a property called "linux,phandle". The ePAPR spec - not being Linux specific - instead requires phandles to be encoded in a property named simply "phandle". This patch makes the kernel accept either form when unflattening the device tree. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r--drivers/of/fdt.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 18d282fefe5..b51f797d9d9 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -310,10 +310,19 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
pp = unflatten_dt_alloc(&mem, sizeof(struct property),
__alignof__(struct property));
if (allnextpp) {
- if (strcmp(pname, "linux,phandle") == 0) {
+ /* We accept flattened tree phandles either in
+ * ePAPR-style "phandle" properties, or the
+ * legacy "linux,phandle" properties. If both
+ * appear and have different values, things
+ * will get weird. Don't do that. */
+ if ((strcmp(pname, "phandle") == 0) ||
+ (strcmp(pname, "linux,phandle") == 0)) {
if (np->phandle == 0)
np->phandle = *((u32 *)*p);
}
+ /* And we process the "ibm,phandle" property
+ * used in pSeries dynamic device tree
+ * stuff */
if (strcmp(pname, "ibm,phandle") == 0)
np->phandle = *((u32 *)*p);
pp->name = pname;