X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fnet%2Fne2.c;h=f4cd8c7e81bad97536ed8911be353f5c3a0da367;hb=fd8c326cadd2f781d5c4d6bcee79bb17b3745bb0;hp=eebf5f02b4763071ac50f2f343a8f6fbf7e0bcad;hpb=0c97f524fc16004602f97ba19c36acdcc0fb9688;p=linux-2.6-omap-h63xx.git diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c index eebf5f02b47..f4cd8c7e81b 100644 --- a/drivers/net/ne2.c +++ b/drivers/net/ne2.c @@ -28,7 +28,7 @@ - added support for Arco Electronics AE/2-card (experimental) Mon Sep 14 09:53:42 CET 1998 (David Weinehall) - - added support for Compex ENET-16MC/P (experimental) + - added support for Compex ENET-16MC/P (experimental) Tue Sep 15 16:21:12 CET 1998 (David Weinehall, Magnus Jonsson, Tomas Ogren) - Miscellaneous bugfixes @@ -44,11 +44,11 @@ - Version# bump Mon Nov 16 15:28:23 CET 1998 (Wim Dumon) - - pass 'dev' as last parameter of request_irq in stead of 'NULL' + - pass 'dev' as last parameter of request_irq in stead of 'NULL' Wed Feb 7 21:24:00 CET 2001 (Alfred Arnold) - added support for the D-Link DE-320CT - + * WARNING ------- This is alpha-test software. It is not guaranteed to work. As a @@ -150,9 +150,9 @@ static void ne_block_output(struct net_device *dev, const int count, /* - * special code to read the DE-320's MAC address EEPROM. In contrast to a + * special code to read the DE-320's MAC address EEPROM. In contrast to a * standard NE design, this is a serial EEPROM (93C46) that has to be read - * bit by bit. The EEPROM cotrol port at base + 0x1e has the following + * bit by bit. The EEPROM cotrol port at base + 0x1e has the following * layout: * * Bit 0 = Data out (read from EEPROM) @@ -218,7 +218,7 @@ static unsigned int __init dlink_get_eeprom(unsigned int eeaddr, unsigned int ad { int z; unsigned int value = 0; - + /* pull the CS line low for a moment. This resets the EEPROM- internal logic, and makes it ready for a new command. */ @@ -251,25 +251,23 @@ static int __init do_ne2_probe(struct net_device *dev) int i; int adapter_found = 0; - SET_MODULE_OWNER(dev); - - /* Do not check any supplied i/o locations. + /* Do not check any supplied i/o locations. POS registers usually don't fail :) */ - /* MCA cards have POS registers. - Autodetecting MCA cards is extremely simple. + /* MCA cards have POS registers. + Autodetecting MCA cards is extremely simple. Just search for the card. */ for(i = 0; (ne2_adapters[i].name != NULL) && !adapter_found; i++) { - current_mca_slot = + current_mca_slot = mca_find_unused_adapter(ne2_adapters[i].id, 0); if((current_mca_slot != MCA_NOTFOUND) && !adapter_found) { int res; - mca_set_adapter_name(current_mca_slot, + mca_set_adapter_name(current_mca_slot, ne2_adapters[i].name); mca_mark_as_used(current_mca_slot); - + res = ne2_probe1(dev, current_mca_slot); if (res) mca_mark_as_unused(current_mca_slot); @@ -304,22 +302,18 @@ out: static int ne2_procinfo(char *buf, int slot, struct net_device *dev) { int len=0; + DECLARE_MAC_BUF(mac); len += sprintf(buf+len, "The NE/2 Ethernet Adapter\n" ); len += sprintf(buf+len, "Driver written by Wim Dumon "); - len += sprintf(buf+len, "\n"); + len += sprintf(buf+len, "\n"); len += sprintf(buf+len, "Modified by "); len += sprintf(buf+len, "David Weinehall \n"); len += sprintf(buf+len, "and by Magnus Jonsson \n"); len += sprintf(buf+len, "Based on the original NE2000 drivers\n" ); len += sprintf(buf+len, "Base IO: %#x\n", (unsigned int)dev->base_addr); len += sprintf(buf+len, "IRQ : %d\n", dev->irq); - -#define HW_ADDR(i) dev->dev_addr[i] - len += sprintf(buf+len, "HW addr : %x:%x:%x:%x:%x:%x\n", - HW_ADDR(0), HW_ADDR(1), HW_ADDR(2), - HW_ADDR(3), HW_ADDR(4), HW_ADDR(5) ); -#undef HW_ADDR + len += sprintf(buf+len, "HW addr : %s\n", print_mac(mac, dev->dev_addr)); return len; } @@ -332,6 +326,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot) const char *name = "NE/2"; int start_page, stop_page; static unsigned version_printed; + DECLARE_MAC_BUF(mac); if (ei_debug && version_printed++ == 0) printk(version); @@ -370,7 +365,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot) #ifndef CRYNWR_WAY /* Reset the card the way they do it in the Crynwr packet driver */ - for (i=0; i<8; i++) + for (i=0; i<8; i++) outb(0x0, base_addr + NE_RESET); inb(base_addr + NE_RESET); outb(0x21, base_addr + NE_CMD); @@ -388,10 +383,10 @@ static int __init ne2_probe1(struct net_device *dev, int slot) #else /* _I_ never tested it this way .. Go ahead and try ...*/ /* Reset card. Who knows what dain-bramaged state it was left in. */ - { + { unsigned long reset_start_time = jiffies; - /* DON'T change these to inb_p/outb_p or reset will fail on + /* DON'T change these to inb_p/outb_p or reset will fail on clones.. */ outb(inb(base_addr + NE_RESET), base_addr + NE_RESET); @@ -408,16 +403,16 @@ static int __init ne2_probe1(struct net_device *dev, int slot) /* Read the 16 bytes of station address PROM. - We must first initialize registers, similar to + We must first initialize registers, similar to NS8390_init(eifdev, 0). We can't reliably read the SAPROM address without this. (I learned the hard way!). */ { - struct { - unsigned char value, offset; + struct { + unsigned char value, offset; } program_seq[] = { /* Select page 0 */ - {E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD}, + {E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD}, {0x49, EN0_DCFG}, /* Set WORD-wide (0x49) access. */ {0x00, EN0_RCNTLO}, /* Clear the count regs. */ {0x00, EN0_RCNTHI}, @@ -432,8 +427,8 @@ static int __init ne2_probe1(struct net_device *dev, int slot) {E8390_RREAD+E8390_START, E8390_CMD}, }; - for (i = 0; i < sizeof(program_seq)/sizeof(program_seq[0]); i++) - outb_p(program_seq[i].value, base_addr + + for (i = 0; i < ARRAY_SIZE(program_seq); i++) + outb_p(program_seq[i].value, base_addr + program_seq[i].offset); } @@ -464,19 +459,19 @@ static int __init ne2_probe1(struct net_device *dev, int slot) share and the board will usually be enabled. */ retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev); if (retval) { - printk (" unable to get IRQ %d (irqval=%d).\n", + printk (" unable to get IRQ %d (irqval=%d).\n", dev->irq, retval); goto out; } dev->base_addr = base_addr; - for(i = 0; i < ETHER_ADDR_LEN; i++) { - printk(" %2.2x", SA_prom[i]); + for(i = 0; i < ETHER_ADDR_LEN; i++) dev->dev_addr[i] = SA_prom[i]; - } - printk("\n%s: %s found at %#x, using IRQ %d.\n", + printk(" %s\n", print_mac(mac, dev->dev_addr)); + + printk("%s: %s found at %#x, using IRQ %d.\n", dev->name, name, base_addr, dev->irq); mca_set_adapter_procfn(slot, (MCA_ProcFn) ne2_procinfo, dev); @@ -496,9 +491,9 @@ static int __init ne2_probe1(struct net_device *dev, int slot) ei_status.block_input = &ne_block_input; ei_status.block_output = &ne_block_output; ei_status.get_8390_hdr = &ne_get_8390_hdr; - + ei_status.priv = slot; - + dev->open = &ne_open; dev->stop = &ne_close; #ifdef CONFIG_NET_POLL_CONTROLLER @@ -538,7 +533,7 @@ static void ne_reset_8390(struct net_device *dev) { unsigned long reset_start_time = jiffies; - if (ei_debug > 1) + if (ei_debug > 1) printk("resetting the 8390 t=%ld...", jiffies); /* DON'T change these to inb_p/outb_p or reset will fail on clones. */ @@ -550,7 +545,7 @@ static void ne_reset_8390(struct net_device *dev) /* This check _should_not_ be necessary, omit eventually. */ while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) if (time_after(jiffies, reset_start_time + 2*HZ/100)) { - printk("%s: ne_reset_8390() did not complete.\n", + printk("%s: ne_reset_8390() did not complete.\n", dev->name); break; } @@ -561,13 +556,13 @@ static void ne_reset_8390(struct net_device *dev) we don't need to be concerned with ring wrap as the header will be at the start of a page, so we optimize accordingly. */ -static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, +static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) { int nic_base = dev->base_addr; - /* This *shouldn't* happen. + /* This *shouldn't* happen. If it does, it's the last thing you'll see */ if (ei_status.dmaing) { printk("%s: DMAing conflict in ne_get_8390_hdr " @@ -585,10 +580,10 @@ static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, outb_p(E8390_RREAD+E8390_START, nic_base + NE_CMD); if (ei_status.word16) - insw(NE_BASE + NE_DATAPORT, hdr, + insw(NE_BASE + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)>>1); else - insb(NE_BASE + NE_DATAPORT, hdr, + insb(NE_BASE + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)); outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ @@ -600,7 +595,7 @@ static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, hints. The NEx000 doesn't share the on-board packet memory -- you have to put the packet out through the "remote DMA" dataport using outb. */ -static void ne_block_input(struct net_device *dev, int count, struct sk_buff *skb, +static void ne_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) { #ifdef NE_SANITY_CHECK @@ -609,7 +604,7 @@ static void ne_block_input(struct net_device *dev, int count, struct sk_buff *sk int nic_base = dev->base_addr; char *buf = skb->data; - /* This *shouldn't* happen. + /* This *shouldn't* happen. If it does, it's the last thing you'll see */ if (ei_status.dmaing) { printk("%s: DMAing conflict in ne_block_input " @@ -677,7 +672,7 @@ static void ne_block_output(struct net_device *dev, int count, if (ei_status.word16 && (count & 0x01)) count++; - /* This *shouldn't* happen. + /* This *shouldn't* happen. If it does, it's the last thing you'll see */ if (ei_status.dmaing) { printk("%s: DMAing conflict in ne_block_output." @@ -813,7 +808,7 @@ static void cleanup_card(struct net_device *dev) release_region(dev->base_addr, NE_IO_EXTENT); } -void cleanup_module(void) +void __exit cleanup_module(void) { int this_dev;