aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-03-29 04:36:44 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 04:54:48 -0400
commit457e1a8afbcf5deffa501f2e9829526c18ed55b5 (patch)
treef1ed037f0fdbe3ab34a848d63e7c78bb28a9a4bc /drivers
parentdadb830dac401c4b1420ee2fd6c7559871b43319 (diff)
[SUNGEM]: Consolidate powerpc and sparc MAC probing code.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sungem.c31
-rw-r--r--drivers/net/sungem.h2
2 files changed, 7 insertions, 26 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 4fa3e49f9358..07f38907884b 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -66,9 +66,7 @@
66 66
67#ifdef CONFIG_SPARC 67#ifdef CONFIG_SPARC
68#include <asm/idprom.h> 68#include <asm/idprom.h>
69#include <asm/openprom.h> 69#include <asm/prom.h>
70#include <asm/oplib.h>
71#include <asm/pbm.h>
72#endif 70#endif
73 71
74#ifdef CONFIG_PPC_PMAC 72#ifdef CONFIG_PPC_PMAC
@@ -2906,34 +2904,17 @@ static int __devinit gem_get_device_address(struct gem *gp)
2906{ 2904{
2907#if defined(CONFIG_SPARC) || defined(CONFIG_PPC_PMAC) 2905#if defined(CONFIG_SPARC) || defined(CONFIG_PPC_PMAC)
2908 struct net_device *dev = gp->dev; 2906 struct net_device *dev = gp->dev;
2909#endif
2910
2911#if defined(CONFIG_SPARC)
2912 struct pci_dev *pdev = gp->pdev;
2913 struct pcidev_cookie *pcp = pdev->sysdata;
2914 int use_idprom = 1;
2915
2916 if (pcp != NULL) {
2917 const unsigned char *addr;
2918 int len;
2919
2920 addr = of_get_property(pcp->prom_node, "local-mac-address",
2921 &len);
2922 if (addr && len == 6) {
2923 use_idprom = 0;
2924 memcpy(dev->dev_addr, addr, 6);
2925 }
2926 }
2927 if (use_idprom)
2928 memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
2929#elif defined(CONFIG_PPC_PMAC)
2930 const unsigned char *addr; 2907 const unsigned char *addr;
2931 2908
2932 addr = get_property(gp->of_node, "local-mac-address", NULL); 2909 addr = get_property(gp->of_node, "local-mac-address", NULL);
2933 if (addr == NULL) { 2910 if (addr == NULL) {
2911#ifdef CONFIG_SPARC
2912 addr = idprom->id_ethaddr;
2913#else
2934 printk("\n"); 2914 printk("\n");
2935 printk(KERN_ERR "%s: can't get mac-address\n", dev->name); 2915 printk(KERN_ERR "%s: can't get mac-address\n", dev->name);
2936 return -1; 2916 return -1;
2917#endif
2937 } 2918 }
2938 memcpy(dev->dev_addr, addr, 6); 2919 memcpy(dev->dev_addr, addr, 6);
2939#else 2920#else
@@ -3091,7 +3072,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3091 /* On Apple, we want a reference to the Open Firmware device-tree 3072 /* On Apple, we want a reference to the Open Firmware device-tree
3092 * node. We use it for clock control. 3073 * node. We use it for clock control.
3093 */ 3074 */
3094#ifdef CONFIG_PPC_PMAC 3075#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC)
3095 gp->of_node = pci_device_to_OF_node(pdev); 3076 gp->of_node = pci_device_to_OF_node(pdev);
3096#endif 3077#endif
3097 3078
diff --git a/drivers/net/sungem.h b/drivers/net/sungem.h
index a70067c85cc9..58cf87c5751e 100644
--- a/drivers/net/sungem.h
+++ b/drivers/net/sungem.h
@@ -1025,7 +1025,7 @@ struct gem {
1025 1025
1026 struct pci_dev *pdev; 1026 struct pci_dev *pdev;
1027 struct net_device *dev; 1027 struct net_device *dev;
1028#ifdef CONFIG_PPC_PMAC 1028#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC)
1029 struct device_node *of_node; 1029 struct device_node *of_node;
1030#endif 1030#endif
1031}; 1031};