aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-03-29 04:38:42 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 04:54:53 -0400
commit49b6e95ff6d05722bcf7a52b00454566ce0c44eb (patch)
tree375ebafb01d540fa6eccf8ee7ff4c9891fa73295 /drivers/net/tg3.c
parent6f85a8597d1d0d8ceeec5a82881c6ddf5cfb45e5 (diff)
[TG3]: Use pci_device_to_OF_node() on sparc.
And use CONFIG_SPARC instead of CONFIG_SPARC64 as the test. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 45b4e018b5e0..6aef1e95d39a 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -46,10 +46,9 @@
46#include <asm/byteorder.h> 46#include <asm/byteorder.h>
47#include <asm/uaccess.h> 47#include <asm/uaccess.h>
48 48
49#ifdef CONFIG_SPARC64 49#ifdef CONFIG_SPARC
50#include <asm/idprom.h> 50#include <asm/idprom.h>
51#include <asm/oplib.h> 51#include <asm/prom.h>
52#include <asm/pbm.h>
53#endif 52#endif
54 53
55#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 54#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
@@ -10988,24 +10987,20 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10988 return err; 10987 return err;
10989} 10988}
10990 10989
10991#ifdef CONFIG_SPARC64 10990#ifdef CONFIG_SPARC
10992static int __devinit tg3_get_macaddr_sparc(struct tg3 *tp) 10991static int __devinit tg3_get_macaddr_sparc(struct tg3 *tp)
10993{ 10992{
10994 struct net_device *dev = tp->dev; 10993 struct net_device *dev = tp->dev;
10995 struct pci_dev *pdev = tp->pdev; 10994 struct pci_dev *pdev = tp->pdev;
10996 struct pcidev_cookie *pcp = pdev->sysdata; 10995 struct device_node *dp = pci_device_to_OF_node(pdev);
10997 10996 unsigned char *addr;
10998 if (pcp != NULL) { 10997 int len;
10999 const unsigned char *addr; 10998
11000 int len; 10999 addr = of_get_property(dp, "local-mac-address", &len);
11001 11000 if (addr && len == 6) {
11002 addr = of_get_property(pcp->prom_node, "local-mac-address", 11001 memcpy(dev->dev_addr, addr, 6);
11003 &len); 11002 memcpy(dev->perm_addr, dev->dev_addr, 6);
11004 if (addr && len == 6) { 11003 return 0;
11005 memcpy(dev->dev_addr, addr, 6);
11006 memcpy(dev->perm_addr, dev->dev_addr, 6);
11007 return 0;
11008 }
11009 } 11004 }
11010 return -ENODEV; 11005 return -ENODEV;
11011} 11006}
@@ -11026,7 +11021,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
11026 u32 hi, lo, mac_offset; 11021 u32 hi, lo, mac_offset;
11027 int addr_ok = 0; 11022 int addr_ok = 0;
11028 11023
11029#ifdef CONFIG_SPARC64 11024#ifdef CONFIG_SPARC
11030 if (!tg3_get_macaddr_sparc(tp)) 11025 if (!tg3_get_macaddr_sparc(tp))
11031 return 0; 11026 return 0;
11032#endif 11027#endif