]> err.no Git - linux-2.6/blobdiff - arch/powerpc/boot/devtree.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6] / arch / powerpc / boot / devtree.c
index e5dfe449731393cb7aec718b4fd169964309def0..5d12336dc3609d9d0cb9df0089f273ffc7fabe77 100644 (file)
@@ -88,6 +88,20 @@ void dt_fixup_clock(const char *path, u32 freq)
        }
 }
 
+void dt_fixup_mac_address_by_alias(const char *alias, const u8 *addr)
+{
+       void *devp = find_node_by_alias(alias);
+
+       if (devp) {
+               printf("%s: local-mac-address <-"
+                      " %02x:%02x:%02x:%02x:%02x:%02x\n\r", alias,
+                      addr[0], addr[1], addr[2],
+                      addr[3], addr[4], addr[5]);
+
+               setprop(devp, "local-mac-address", addr, 6);
+       }
+}
+
 void dt_fixup_mac_address(u32 index, const u8 *addr)
 {
        void *devp = find_node_by_prop_value(NULL, "linux,network-index",
@@ -336,3 +350,23 @@ int dt_is_compatible(void *node, const char *compat)
 
        return 0;
 }
+
+int dt_get_virtual_reg(void *node, void **addr, int nres)
+{
+       unsigned long xaddr;
+       int n;
+
+       n = getprop(node, "virtual-reg", addr, nres * 4);
+       if (n > 0)
+               return n / 4;
+
+       for (n = 0; n < nres; n++) {
+               if (!dt_xlate_reg(node, n, &xaddr, NULL))
+                       break;
+
+               addr[n] = (void *)xaddr;
+       }
+
+       return n;
+}
+