Commit 8cee2695 authored by Ralf Bächle's avatar Ralf Bächle

[PATCH] declance updates

Various small changes, DEC still doesn't work under 2.6.
parent 30d05ef4
...@@ -1798,7 +1798,7 @@ config SGISEEQ ...@@ -1798,7 +1798,7 @@ config SGISEEQ
config DECLANCE config DECLANCE
tristate "DEC LANCE ethernet controller support" tristate "DEC LANCE ethernet controller support"
depends on NET_ETHERNET && DECSTATION depends on NET_ETHERNET && MACH_DECSTATION
select CRC32 select CRC32
help help
This driver is for the series of Ethernet controllers produced by This driver is for the series of Ethernet controllers produced by
......
...@@ -786,7 +786,7 @@ static int lance_open(struct net_device *dev) ...@@ -786,7 +786,7 @@ static int lance_open(struct net_device *dev)
/* Associate IRQ with lance_interrupt */ /* Associate IRQ with lance_interrupt */
if (request_irq(dev->irq, &lance_interrupt, 0, "lance", dev)) { if (request_irq(dev->irq, &lance_interrupt, 0, "lance", dev)) {
printk("lance: Can't get IRQ %d\n", dev->irq); printk("%s: Can't get IRQ %d\n", dev->name, dev->irq);
return -EAGAIN; return -EAGAIN;
} }
if (lp->dma_irq >= 0) { if (lp->dma_irq >= 0) {
...@@ -795,7 +795,8 @@ static int lance_open(struct net_device *dev) ...@@ -795,7 +795,8 @@ static int lance_open(struct net_device *dev)
if (request_irq(lp->dma_irq, &lance_dma_merr_int, 0, if (request_irq(lp->dma_irq, &lance_dma_merr_int, 0,
"lance error", dev)) { "lance error", dev)) {
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
printk("lance: Can't get DMA IRQ %d\n", lp->dma_irq); printk("%s: Can't get DMA IRQ %d\n", dev->name,
lp->dma_irq);
return -EAGAIN; return -EAGAIN;
} }
...@@ -877,8 +878,8 @@ static void lance_tx_timeout(struct net_device *dev) ...@@ -877,8 +878,8 @@ static void lance_tx_timeout(struct net_device *dev)
volatile struct lance_regs *ll = lp->ll; volatile struct lance_regs *ll = lp->ll;
printk(KERN_ERR "%s: transmit timed out, status %04x, reset\n", printk(KERN_ERR "%s: transmit timed out, status %04x, reset\n",
dev->name, ll->rdp); dev->name, ll->rdp);
lance_reset(dev); lance_reset(dev);
netif_wake_queue(dev); netif_wake_queue(dev);
} }
...@@ -1025,6 +1026,8 @@ static void lance_set_multicast_retry(unsigned long _opaque) ...@@ -1025,6 +1026,8 @@ static void lance_set_multicast_retry(unsigned long _opaque)
static int __init dec_lance_init(const int type, const int slot) static int __init dec_lance_init(const int type, const int slot)
{ {
static unsigned version_printed; static unsigned version_printed;
static const char fmt[] = "declance%d";
char name[10];
struct net_device *dev; struct net_device *dev;
struct lance_private *lp; struct lance_private *lp;
volatile struct lance_regs *ll; volatile struct lance_regs *ll;
...@@ -1039,10 +1042,22 @@ static int __init dec_lance_init(const int type, const int slot) ...@@ -1039,10 +1042,22 @@ static int __init dec_lance_init(const int type, const int slot)
if (dec_lance_debug && version_printed++ == 0) if (dec_lance_debug && version_printed++ == 0)
printk(version); printk(version);
i = 0;
dev = root_lance_dev;
while (dev) {
i++;
lp = (struct lance_private *)dev->priv;
dev = lp->next;
}
snprintf(name, sizeof(name), fmt, i);
dev = alloc_etherdev(sizeof(struct lance_private)); dev = alloc_etherdev(sizeof(struct lance_private));
if (!dev) if (!dev) {
return -ENOMEM; printk(KERN_ERR "%s: Unable to allocate etherdev, aborting.\n",
SET_MODULE_OWNER(dev); name);
ret = -ENOMEM;
goto err_out;
}
/* /*
* alloc_etherdev ensures the data structures used by the LANCE * alloc_etherdev ensures the data structures used by the LANCE
...@@ -1160,9 +1175,10 @@ static int __init dec_lance_init(const int type, const int slot) ...@@ -1160,9 +1175,10 @@ static int __init dec_lance_init(const int type, const int slot)
break; break;
default: default:
printk("declance_init called with unknown type\n"); printk(KERN_ERR "%s: declance_init called with unknown type\n",
name);
ret = -ENODEV; ret = -ENODEV;
goto err_out; goto err_out_free_dev;
} }
ll = (struct lance_regs *) dev->base_addr; ll = (struct lance_regs *) dev->base_addr;
...@@ -1172,19 +1188,21 @@ static int __init dec_lance_init(const int type, const int slot) ...@@ -1172,19 +1188,21 @@ static int __init dec_lance_init(const int type, const int slot)
/* First, check for test pattern */ /* First, check for test pattern */
if (esar[0x60] != 0xff && esar[0x64] != 0x00 && if (esar[0x60] != 0xff && esar[0x64] != 0x00 &&
esar[0x68] != 0x55 && esar[0x6c] != 0xaa) { esar[0x68] != 0x55 && esar[0x6c] != 0xaa) {
printk("Ethernet station address prom not found!\n"); printk(KERN_ERR
"%s: Ethernet station address prom not found!\n",
name);
ret = -ENODEV; ret = -ENODEV;
goto err_out; goto err_out_free_dev;
} }
/* Check the prom contents */ /* Check the prom contents */
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
if (esar[i * 4] != esar[0x3c - i * 4] && if (esar[i * 4] != esar[0x3c - i * 4] &&
esar[i * 4] != esar[0x40 + i * 4] && esar[i * 4] != esar[0x40 + i * 4] &&
esar[0x3c - i * 4] != esar[0x40 + i * 4]) { esar[0x3c - i * 4] != esar[0x40 + i * 4]) {
printk("Something is wrong with the ethernet " printk(KERN_ERR "%s: Something is wrong with the "
"station address prom!\n"); "ethernet station address prom!\n", name);
ret = -ENODEV; ret = -ENODEV;
goto err_out; goto err_out_free_dev;
} }
} }
...@@ -1194,13 +1212,13 @@ static int __init dec_lance_init(const int type, const int slot) ...@@ -1194,13 +1212,13 @@ static int __init dec_lance_init(const int type, const int slot)
*/ */
switch (type) { switch (type) {
case ASIC_LANCE: case ASIC_LANCE:
printk("%s: IOASIC onboard LANCE, addr = ", dev->name); printk("%s: IOASIC onboard LANCE, addr = ", name);
break; break;
case PMAD_LANCE: case PMAD_LANCE:
printk("%s: PMAD-AA, addr = ", dev->name); printk("%s: PMAD-AA, addr = ", name);
break; break;
case PMAX_LANCE: case PMAX_LANCE:
printk("%s: PMAX onboard LANCE, addr = ", dev->name); printk("%s: PMAX onboard LANCE, addr = ", name);
break; break;
} }
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
...@@ -1236,15 +1254,24 @@ static int __init dec_lance_init(const int type, const int slot) ...@@ -1236,15 +1254,24 @@ static int __init dec_lance_init(const int type, const int slot)
init_timer(&lp->multicast_timer); init_timer(&lp->multicast_timer);
lp->multicast_timer.data = (unsigned long) dev; lp->multicast_timer.data = (unsigned long) dev;
lp->multicast_timer.function = &lance_set_multicast_retry; lp->multicast_timer.function = &lance_set_multicast_retry;
ret = register_netdev(dev); ret = register_netdev(dev);
if (ret) if (ret) {
goto err_out; printk(KERN_ERR
"%s: Unable to register netdev, aborting.\n", name);
goto err_out_free_dev;
}
lp->next = root_lance_dev; lp->next = root_lance_dev;
root_lance_dev = dev; root_lance_dev = dev;
printk("%s: registered as %s.\n", name, dev->name);
return 0; return 0;
err_out_free_dev:
kfree(dev);
err_out: err_out:
free_netdev(dev);
return ret; return ret;
} }
......
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