Commit 76fcdb30 authored by David S. Miller's avatar David S. Miller

[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: default avatarDavid S. Miller <davem@davemloft.net>
parent 80ba80a9
...@@ -99,8 +99,7 @@ static char lancestr[] = "LANCE"; ...@@ -99,8 +99,7 @@ static char lancestr[] = "LANCE";
#include <asm/byteorder.h> /* Used by the checksum routines */ #include <asm/byteorder.h> /* Used by the checksum routines */
#include <asm/idprom.h> #include <asm/idprom.h>
#include <asm/sbus.h> #include <asm/sbus.h>
#include <asm/openprom.h> #include <asm/prom.h>
#include <asm/oplib.h>
#include <asm/auxio.h> /* For tpe-link-test? setting */ #include <asm/auxio.h> /* For tpe-link-test? setting */
#include <asm/irq.h> #include <asm/irq.h>
...@@ -1326,6 +1325,7 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev, ...@@ -1326,6 +1325,7 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
struct sbus_dev *lebuffer) struct sbus_dev *lebuffer)
{ {
static unsigned version_printed; static unsigned version_printed;
struct device_node *dp = sdev->ofdev.node;
struct net_device *dev; struct net_device *dev;
struct lance_private *lp; struct lance_private *lp;
int i; int i;
...@@ -1389,54 +1389,46 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev, ...@@ -1389,54 +1389,46 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
lp->rx = lance_rx_dvma; lp->rx = lance_rx_dvma;
lp->tx = lance_tx_dvma; lp->tx = lance_tx_dvma;
} }
lp->busmaster_regval = prom_getintdefault(sdev->prom_node, lp->busmaster_regval = of_getintprop_default(dp, "busmaster-regval",
"busmaster-regval", (LE_C3_BSWP |
(LE_C3_BSWP | LE_C3_ACON | LE_C3_ACON |
LE_C3_BCON)); LE_C3_BCON));
lp->name = lancestr; lp->name = lancestr;
lp->ledma = ledma; lp->ledma = ledma;
lp->burst_sizes = 0; lp->burst_sizes = 0;
if (lp->ledma) { if (lp->ledma) {
char prop[6]; struct device_node *ledma_dp = ledma->sdev->ofdev.node;
const char *prop;
unsigned int sbmask; unsigned int sbmask;
u32 csr; u32 csr;
/* Find burst-size property for ledma */ /* Find burst-size property for ledma */
lp->burst_sizes = prom_getintdefault(ledma->sdev->prom_node, lp->burst_sizes = of_getintprop_default(ledma_dp,
"burst-sizes", 0); "burst-sizes", 0);
/* ledma may be capable of fast bursts, but sbus may not. */ /* ledma may be capable of fast bursts, but sbus may not. */
sbmask = prom_getintdefault(ledma->sdev->bus->prom_node, sbmask = of_getintprop_default(ledma_dp, "burst-sizes",
"burst-sizes", DMA_BURSTBITS); DMA_BURSTBITS);
lp->burst_sizes &= sbmask; lp->burst_sizes &= sbmask;
/* Get the cable-selection property */ /* Get the cable-selection property */
memset(prop, 0, sizeof(prop)); prop = of_get_property(ledma_dp, "cable-selection", NULL);
prom_getstring(ledma->sdev->prom_node, "cable-selection", if (!prop || prop[0] == '\0') {
prop, sizeof(prop)); struct device_node *nd;
if (prop[0] == 0) {
int topnd, nd;
printk(KERN_INFO "SunLance: using auto-carrier-detection.\n"); printk(KERN_INFO "SunLance: using "
"auto-carrier-detection.\n");
/* Is this found at /options .attributes in all nd = of_find_node_by_path("/options");
* Prom versions? XXX
*/
topnd = prom_getchild(prom_root_node);
nd = prom_searchsiblings(topnd, "options");
if (!nd) if (!nd)
goto no_link_test; goto no_link_test;
if (!prom_node_has_property(nd, "tpe-link-test?")) prop = of_get_property(nd, "tpe-link-test?", NULL);
if (!prop)
goto no_link_test; goto no_link_test;
memset(prop, 0, sizeof(prop));
prom_getstring(nd, "tpe-link-test?", prop,
sizeof(prop));
if (strcmp(prop, "true")) { if (strcmp(prop, "true")) {
printk(KERN_NOTICE "SunLance: warning: overriding option " printk(KERN_NOTICE "SunLance: warning: overriding option "
"'tpe-link-test?'\n"); "'tpe-link-test?'\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment