aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sunlance.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-07-30 21:23:39 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-30 21:23:39 -0400
commit76fcdb30ae1cb28e438e5ffd4db5f49ea3d96cd7 (patch)
treec0c274c9c6e5f25f82e218a65161857a356903a1 /drivers/net/sunlance.c
parent80ba80a9bf25d251237694c3fcee850a73324532 (diff)
[SUNLANCE]: Fix sparc32 crashes by using of_*() interfaces.
This driver was still using the deprecated prom_*() interfaces to obtain values out of the OBP device tree, and this is causing some kinds of problems on sparc32 especially SMP boxes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sunlance.c')
-rw-r--r--drivers/net/sunlance.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 053b7cb0d944..68e4f660367d 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -99,8 +99,7 @@ static char lancestr[] = "LANCE";
99#include <asm/byteorder.h> /* Used by the checksum routines */ 99#include <asm/byteorder.h> /* Used by the checksum routines */
100#include <asm/idprom.h> 100#include <asm/idprom.h>
101#include <asm/sbus.h> 101#include <asm/sbus.h>
102#include <asm/openprom.h> 102#include <asm/prom.h>
103#include <asm/oplib.h>
104#include <asm/auxio.h> /* For tpe-link-test? setting */ 103#include <asm/auxio.h> /* For tpe-link-test? setting */
105#include <asm/irq.h> 104#include <asm/irq.h>
106 105
@@ -1326,6 +1325,7 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
1326 struct sbus_dev *lebuffer) 1325 struct sbus_dev *lebuffer)
1327{ 1326{
1328 static unsigned version_printed; 1327 static unsigned version_printed;
1328 struct device_node *dp = sdev->ofdev.node;
1329 struct net_device *dev; 1329 struct net_device *dev;
1330 struct lance_private *lp; 1330 struct lance_private *lp;
1331 int i; 1331 int i;
@@ -1389,54 +1389,46 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
1389 lp->rx = lance_rx_dvma; 1389 lp->rx = lance_rx_dvma;
1390 lp->tx = lance_tx_dvma; 1390 lp->tx = lance_tx_dvma;
1391 } 1391 }
1392 lp->busmaster_regval = prom_getintdefault(sdev->prom_node, 1392 lp->busmaster_regval = of_getintprop_default(dp, "busmaster-regval",
1393 "busmaster-regval", 1393 (LE_C3_BSWP |
1394 (LE_C3_BSWP | LE_C3_ACON | 1394 LE_C3_ACON |
1395 LE_C3_BCON)); 1395 LE_C3_BCON));
1396 1396
1397 lp->name = lancestr; 1397 lp->name = lancestr;
1398 lp->ledma = ledma; 1398 lp->ledma = ledma;
1399 1399
1400 lp->burst_sizes = 0; 1400 lp->burst_sizes = 0;
1401 if (lp->ledma) { 1401 if (lp->ledma) {
1402 char prop[6]; 1402 struct device_node *ledma_dp = ledma->sdev->ofdev.node;
1403 const char *prop;
1403 unsigned int sbmask; 1404 unsigned int sbmask;
1404 u32 csr; 1405 u32 csr;
1405 1406
1406 /* Find burst-size property for ledma */ 1407 /* Find burst-size property for ledma */
1407 lp->burst_sizes = prom_getintdefault(ledma->sdev->prom_node, 1408 lp->burst_sizes = of_getintprop_default(ledma_dp,
1408 "burst-sizes", 0); 1409 "burst-sizes", 0);
1409 1410
1410 /* ledma may be capable of fast bursts, but sbus may not. */ 1411 /* ledma may be capable of fast bursts, but sbus may not. */
1411 sbmask = prom_getintdefault(ledma->sdev->bus->prom_node, 1412 sbmask = of_getintprop_default(ledma_dp, "burst-sizes",
1412 "burst-sizes", DMA_BURSTBITS); 1413 DMA_BURSTBITS);
1413 lp->burst_sizes &= sbmask; 1414 lp->burst_sizes &= sbmask;
1414 1415
1415 /* Get the cable-selection property */ 1416 /* Get the cable-selection property */
1416 memset(prop, 0, sizeof(prop)); 1417 prop = of_get_property(ledma_dp, "cable-selection", NULL);
1417 prom_getstring(ledma->sdev->prom_node, "cable-selection", 1418 if (!prop || prop[0] == '\0') {
1418 prop, sizeof(prop)); 1419 struct device_node *nd;
1419 if (prop[0] == 0) {
1420 int topnd, nd;
1421 1420
1422 printk(KERN_INFO "SunLance: using auto-carrier-detection.\n"); 1421 printk(KERN_INFO "SunLance: using "
1422 "auto-carrier-detection.\n");
1423 1423
1424 /* Is this found at /options .attributes in all 1424 nd = of_find_node_by_path("/options");
1425 * Prom versions? XXX
1426 */
1427 topnd = prom_getchild(prom_root_node);
1428
1429 nd = prom_searchsiblings(topnd, "options");
1430 if (!nd) 1425 if (!nd)
1431 goto no_link_test; 1426 goto no_link_test;
1432 1427
1433 if (!prom_node_has_property(nd, "tpe-link-test?")) 1428 prop = of_get_property(nd, "tpe-link-test?", NULL);
1429 if (!prop)
1434 goto no_link_test; 1430 goto no_link_test;
1435 1431
1436 memset(prop, 0, sizeof(prop));
1437 prom_getstring(nd, "tpe-link-test?", prop,
1438 sizeof(prop));
1439
1440 if (strcmp(prop, "true")) { 1432 if (strcmp(prop, "true")) {
1441 printk(KERN_NOTICE "SunLance: warning: overriding option " 1433 printk(KERN_NOTICE "SunLance: warning: overriding option "
1442 "'tpe-link-test?'\n"); 1434 "'tpe-link-test?'\n");