aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2007-02-16 13:01:29 -0500
committerPaul Mackerras <paulus@samba.org>2007-02-16 18:21:25 -0500
commit29cfe6f4fb7d187f65564764a0ecf2caf9d8ed58 (patch)
treeacd07e68e6c426d7fc21606acd27bf21c06df0aa /arch/powerpc/sysdev
parenta32525449b30dfbae804f6b05cde041f35f5a811 (diff)
[POWERPC] add of_get_mac_address and update fsl_soc.c to use it
Add function of_get_mac_address(), which obtains the best MAC address to use from the device tree by checking various properties in order. The order is: 'mac-address', then 'local-mac-address', then 'address'. It skips properties that contain invalid MAC addresses, which were probably not initialized by U-Boot. Update gfar_of_init() and fs_enet_of_init() in fsl_soc.c to call of_get_mac_address(). Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 34161bc5a02f..d20f02927f72 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -233,14 +233,7 @@ static int __init gfar_of_init(void)
233 goto err; 233 goto err;
234 } 234 }
235 235
236 mac_addr = get_property(np, "local-mac-address", NULL); 236 mac_addr = of_get_mac_address(np);
237 if (mac_addr == NULL)
238 mac_addr = get_property(np, "mac-address", NULL);
239 if (mac_addr == NULL) {
240 /* Obsolete */
241 mac_addr = get_property(np, "address", NULL);
242 }
243
244 if (mac_addr) 237 if (mac_addr)
245 memcpy(gfar_data.mac_addr, mac_addr, 6); 238 memcpy(gfar_data.mac_addr, mac_addr, 6);
246 239
@@ -646,8 +639,9 @@ static int __init fs_enet_of_init(void)
646 goto unreg; 639 goto unreg;
647 } 640 }
648 641
649 mac_addr = get_property(np, "mac-address", NULL); 642 mac_addr = of_get_mac_address(np);
650 memcpy(fs_enet_data.macaddr, mac_addr, 6); 643 if (mac_addr)
644 memcpy(fs_enet_data.macaddr, mac_addr, 6);
651 645
652 ph = get_property(np, "phy-handle", NULL); 646 ph = get_property(np, "phy-handle", NULL);
653 phy = of_find_node_by_phandle(*ph); 647 phy = of_find_node_by_phandle(*ph);
@@ -931,8 +925,9 @@ static int __init fs_enet_of_init(void)
931 goto err; 925 goto err;
932 r[0].name = enet_regs; 926 r[0].name = enet_regs;
933 927
934 mac_addr = (void *)get_property(np, "mac-address", NULL); 928 mac_addr = of_get_mac_address(np);
935 memcpy(fs_enet_data.macaddr, mac_addr, 6); 929 if (mac_addr)
930 memcpy(fs_enet_data.macaddr, mac_addr, 6);
936 931
937 ph = (phandle *) get_property(np, "phy-handle", NULL); 932 ph = (phandle *) get_property(np, "phy-handle", NULL);
938 if (ph != NULL) 933 if (ph != NULL)