aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-06-22 19:18:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-24 02:15:26 -0400
commitde8d28b16f5614aeb12bb69c8f9a38578b8d3ada (patch)
tree152f0930dc099606342e9cc6d9a3892cd9f3f192 /drivers
parent765b5f32730cfd2608291e679060b0391570c8b3 (diff)
[SPARC64]: Convert sparc64 PCI layer to in-kernel device tree.
One thing this change pointed out was that we really should pull the "get 'local-mac-address' property" logic into a helper function all the network drivers can call. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sungem.c19
-rw-r--r--drivers/net/sunhme.c18
-rw-r--r--drivers/net/tg3.c10
-rw-r--r--drivers/net/tulip/tulip_core.c12
-rw-r--r--drivers/sbus/char/openprom.c4
-rw-r--r--drivers/video/aty/atyfb_base.c2
6 files changed, 38 insertions, 27 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 38cd30cb7c75..5248670d29f7 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2880,17 +2880,20 @@ static int __devinit gem_get_device_address(struct gem *gp)
2880#if defined(__sparc__) 2880#if defined(__sparc__)
2881 struct pci_dev *pdev = gp->pdev; 2881 struct pci_dev *pdev = gp->pdev;
2882 struct pcidev_cookie *pcp = pdev->sysdata; 2882 struct pcidev_cookie *pcp = pdev->sysdata;
2883 int node = -1; 2883 int use_idprom = 1;
2884 2884
2885 if (pcp != NULL) { 2885 if (pcp != NULL) {
2886 node = pcp->prom_node; 2886 unsigned char *addr;
2887 if (prom_getproplen(node, "local-mac-address") == 6) 2887 int len;
2888 prom_getproperty(node, "local-mac-address", 2888
2889 dev->dev_addr, 6); 2889 addr = of_get_property(pcp->prom_node, "local-mac-address",
2890 else 2890 &len);
2891 node = -1; 2891 if (addr && len == 6) {
2892 use_idprom = 0;
2893 memcpy(dev->dev_addr, addr, 6);
2894 }
2892 } 2895 }
2893 if (node == -1) 2896 if (use_idprom)
2894 memcpy(dev->dev_addr, idprom->id_ethaddr, 6); 2897 memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
2895#elif defined(CONFIG_PPC_PMAC) 2898#elif defined(CONFIG_PPC_PMAC)
2896 unsigned char *addr; 2899 unsigned char *addr;
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index bd5d2668a362..b0d452733c9b 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3013,7 +3013,6 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
3013 struct quattro *qp = NULL; 3013 struct quattro *qp = NULL;
3014#ifdef __sparc__ 3014#ifdef __sparc__
3015 struct pcidev_cookie *pcp; 3015 struct pcidev_cookie *pcp;
3016 int node;
3017#endif 3016#endif
3018 struct happy_meal *hp; 3017 struct happy_meal *hp;
3019 struct net_device *dev; 3018 struct net_device *dev;
@@ -3026,13 +3025,12 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
3026 /* Now make sure pci_dev cookie is there. */ 3025 /* Now make sure pci_dev cookie is there. */
3027#ifdef __sparc__ 3026#ifdef __sparc__
3028 pcp = pdev->sysdata; 3027 pcp = pdev->sysdata;
3029 if (pcp == NULL || pcp->prom_node == -1) { 3028 if (pcp == NULL) {
3030 printk(KERN_ERR "happymeal(PCI): Some PCI device info missing\n"); 3029 printk(KERN_ERR "happymeal(PCI): Some PCI device info missing\n");
3031 return -ENODEV; 3030 return -ENODEV;
3032 } 3031 }
3033 node = pcp->prom_node;
3034 3032
3035 prom_getstring(node, "name", prom_name, sizeof(prom_name)); 3033 strcpy(prom_name, pcp->prom_node->name);
3036#else 3034#else
3037 if (is_quattro_p(pdev)) 3035 if (is_quattro_p(pdev))
3038 strcpy(prom_name, "SUNW,qfe"); 3036 strcpy(prom_name, "SUNW,qfe");
@@ -3104,10 +3102,14 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
3104 macaddr[5]++; 3102 macaddr[5]++;
3105 } else { 3103 } else {
3106#ifdef __sparc__ 3104#ifdef __sparc__
3105 unsigned char *addr;
3106 int len;
3107
3107 if (qfe_slot != -1 && 3108 if (qfe_slot != -1 &&
3108 prom_getproplen(node, "local-mac-address") == 6) { 3109 (addr = of_get_property(pcp->prom_node,
3109 prom_getproperty(node, "local-mac-address", 3110 "local-mac-address", &len)) != NULL
3110 dev->dev_addr, 6); 3111 && len == 6) {
3112 memcpy(dev->dev_addr, addr, 6);
3111 } else { 3113 } else {
3112 memcpy(dev->dev_addr, idprom->id_ethaddr, 6); 3114 memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
3113 } 3115 }
@@ -3124,7 +3126,7 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
3124 hp->tcvregs = (hpreg_base + 0x7000UL); 3126 hp->tcvregs = (hpreg_base + 0x7000UL);
3125 3127
3126#ifdef __sparc__ 3128#ifdef __sparc__
3127 hp->hm_revision = prom_getintdefault(node, "hm-rev", 0xff); 3129 hp->hm_revision = of_getintprop_default(pcp->prom_node, "hm-rev", 0xff);
3128 if (hp->hm_revision == 0xff) { 3130 if (hp->hm_revision == 0xff) {
3129 unsigned char prev; 3131 unsigned char prev;
3130 3132
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index e3e380f90f86..35f931638750 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10549,11 +10549,13 @@ static int __devinit tg3_get_macaddr_sparc(struct tg3 *tp)
10549 struct pcidev_cookie *pcp = pdev->sysdata; 10549 struct pcidev_cookie *pcp = pdev->sysdata;
10550 10550
10551 if (pcp != NULL) { 10551 if (pcp != NULL) {
10552 int node = pcp->prom_node; 10552 unsigned char *addr;
10553 int len;
10553 10554
10554 if (prom_getproplen(node, "local-mac-address") == 6) { 10555 addr = of_get_property(pcp->prom_node, "local-mac-address",
10555 prom_getproperty(node, "local-mac-address", 10556 &len);
10556 dev->dev_addr, 6); 10557 if (addr && len == 6) {
10558 memcpy(dev->dev_addr, addr, 6);
10557 memcpy(dev->perm_addr, dev->dev_addr, 6); 10559 memcpy(dev->perm_addr, dev->dev_addr, 6);
10558 return 0; 10560 return 0;
10559 } 10561 }
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index cabdf894e21e..e0de66739a42 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -1550,10 +1550,14 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1550 dev->dev_addr[i] = last_phys_addr[i]; 1550 dev->dev_addr[i] = last_phys_addr[i];
1551 dev->dev_addr[i] = last_phys_addr[i] + 1; 1551 dev->dev_addr[i] = last_phys_addr[i] + 1;
1552#if defined(__sparc__) 1552#if defined(__sparc__)
1553 if ((pcp != NULL) && prom_getproplen(pcp->prom_node, 1553 if (pcp) {
1554 "local-mac-address") == 6) { 1554 unsigned char *addr;
1555 prom_getproperty(pcp->prom_node, "local-mac-address", 1555 int len;
1556 dev->dev_addr, 6); 1556
1557 addr = of_get_property(pcp->prom_node,
1558 "local-mac-address", &len);
1559 if (addr && len == 6)
1560 memcpy(dev->dev_addr, addr, 6);
1557 } 1561 }
1558#endif 1562#endif
1559#if defined(__i386__) || defined(__x86_64__) /* Patch up x86 BIOS bug. */ 1563#if defined(__i386__) || defined(__x86_64__) /* Patch up x86 BIOS bug. */
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 239e108b8ed1..cf5b476b5496 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -243,8 +243,8 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
243 ((int *) opp->oprom_array)[1]); 243 ((int *) opp->oprom_array)[1]);
244 244
245 pcp = pdev->sysdata; 245 pcp = pdev->sysdata;
246 if (pcp != NULL && pcp->prom_node != -1 && pcp->prom_node) { 246 if (pcp != NULL) {
247 node = pcp->prom_node; 247 node = pcp->prom_node->node;
248 data->current_node = node; 248 data->current_node = node;
249 *((int *)opp->oprom_array) = node; 249 *((int *)opp->oprom_array) = node;
250 opp->oprom_size = sizeof(int); 250 opp->oprom_size = sizeof(int);
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index eb6aa42be60e..c054bb28b1c4 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2966,7 +2966,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
2966 } 2966 }
2967 2967
2968 pcp = pdev->sysdata; 2968 pcp = pdev->sysdata;
2969 if (node == pcp->prom_node) { 2969 if (node == pcp->prom_node->node) {
2970 struct fb_var_screeninfo *var = &default_var; 2970 struct fb_var_screeninfo *var = &default_var;
2971 unsigned int N, P, Q, M, T, R; 2971 unsigned int N, P, Q, M, T, R;
2972 u32 v_total, h_total; 2972 u32 v_total, h_total;