]> err.no Git - linux-2.6/blobdiff - drivers/net/ne.c
forcedeth: add tx pause limit
[linux-2.6] / drivers / net / ne.c
index 32ae91b0b61174e91a4303117880912d2d7e24b3..42443d697423d72fef98e52958d514a1ef3c4779 100644 (file)
@@ -56,10 +56,6 @@ static const char version2[] =
 #include <asm/system.h>
 #include <asm/io.h>
 
-#if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
-#include <asm/tx4938/rbtx4938.h>
-#endif
-
 #include "8390.h"
 
 #define DRV_NAME "ne"
@@ -78,8 +74,13 @@ static const char version2[] =
 /* Do we have a non std. amount of memory? (in units of 256 byte pages) */
 /* #define PACKETBUF_MEMSIZE   0x40 */
 
+#if !defined(MODULE) && (defined(CONFIG_ISA) || defined(CONFIG_M32R))
+/* Do we need a portlist for the ISA auto-probe ? */
+#define NEEDS_PORTLIST
+#endif
+
 /* A zero-terminated list of I/O addresses to be probed at boot. */
-#ifndef MODULE
+#ifdef NEEDS_PORTLIST
 static unsigned int netcard_portlist[] __initdata = {
        0x300, 0x280, 0x320, 0x340, 0x360, 0x380, 0
 };
@@ -186,12 +187,10 @@ static void ne_block_output(struct net_device *dev, const int count,
 static int __init do_ne_probe(struct net_device *dev)
 {
        unsigned long base_addr = dev->base_addr;
-#ifndef MODULE
+#ifdef NEEDS_PORTLIST
        int orig_irq = dev->irq;
 #endif
 
-       SET_MODULE_OWNER(dev);
-
        /* First check any supplied i/o locations. User knows best. <cough> */
        if (base_addr > 0x1ff)  /* Check a single specified location. */
                return ne_probe1(dev, base_addr);
@@ -202,7 +201,7 @@ static int __init do_ne_probe(struct net_device *dev)
        if (isapnp_present() && (ne_probe_isapnp(dev) == 0))
                return 0;
 
-#ifndef MODULE
+#ifdef NEEDS_PORTLIST
        /* Last resort. The semi-risky ISA auto-probe. */
        for (base_addr = 0; netcard_portlist[base_addr] != 0; base_addr++) {
                int ioaddr = netcard_portlist[base_addr];
@@ -218,7 +217,7 @@ static int __init do_ne_probe(struct net_device *dev)
 #ifndef MODULE
 struct net_device * __init ne_probe(int unit)
 {
-       struct net_device *dev = alloc_ei_netdev();
+       struct net_device *dev = alloc_eip_netdev();
        int err;
 
        if (!dev)
@@ -227,10 +226,6 @@ struct net_device * __init ne_probe(int unit)
        sprintf(dev->name, "eth%d", unit);
        netdev_boot_setup_check(dev);
 
-#ifdef CONFIG_TOSHIBA_RBTX4938
-       dev->base_addr = RBTX4938_RTL_8019_BASE;
-       dev->irq = RBTX4938_RTL_8019_IRQ;
-#endif
        err = do_ne_probe(dev);
        if (err)
                goto out;
@@ -296,6 +291,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
        int neX000, ctron, copam, bad_card;
        int reg0, ret;
        static unsigned version_printed;
+       DECLARE_MAC_BUF(mac);
 
        if (!request_region(ioaddr, NE_IO_EXTENT, DRV_NAME))
                return -EBUSY;
@@ -359,7 +355,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
        }
 
        /* Read the 16 bytes of station address PROM.
-          We must first initialize registers, similar to NS8390_init(eifdev, 0).
+          We must first initialize registers, similar to NS8390p_init(eifdev, 0).
           We can't reliably read the SAPROM address without this.
           (I learned the hard way!). */
        {
@@ -380,7 +376,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
                        {E8390_RREAD+E8390_START, E8390_CMD},
                };
 
-               for (i = 0; i < sizeof(program_seq)/sizeof(program_seq[0]); i++)
+               for (i = 0; i < ARRAY_SIZE(program_seq); i++)
                        outb_p(program_seq[i].value, ioaddr + program_seq[i].offset);
 
        }
@@ -494,7 +490,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
 
        /* Snarf the interrupt now.  There's no point in waiting since we cannot
           share and the board will usually be enabled. */
-       ret = request_irq(dev->irq, ei_interrupt, 0, name, dev);
+       ret = request_irq(dev->irq, eip_interrupt, 0, name, dev);
        if (ret) {
                printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
                goto err_out;
@@ -508,16 +504,14 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
        for (i = 0 ; i < ETHER_ADDR_LEN ; i++) {
                dev->dev_addr[i] = SA_prom[i]
                        = inb_p(ioaddr + EN1_PHYS_SHIFT(i));
-               printk(" %2.2x", SA_prom[i]);
        }
 #else
        for(i = 0; i < ETHER_ADDR_LEN; i++) {
-               printk(" %2.2x", SA_prom[i]);
                dev->dev_addr[i] = SA_prom[i];
        }
 #endif
 
-       printk("\n");
+       printk("%s\n", print_mac(mac, dev->dev_addr));
 
        ei_status.name = name;
        ei_status.tx_start_page = start_page;
@@ -540,9 +534,9 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
        dev->open = &ne_open;
        dev->stop = &ne_close;
 #ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = ei_poll;
+       dev->poll_controller = eip_poll;
 #endif
-       NS8390_init(dev, 0);
+       NS8390p_init(dev, 0);
 
        ret = register_netdev(dev);
        if (ret)
@@ -560,7 +554,7 @@ err_out:
 
 static int ne_open(struct net_device *dev)
 {
-       ei_open(dev);
+       eip_open(dev);
        return 0;
 }
 
@@ -568,7 +562,7 @@ static int ne_close(struct net_device *dev)
 {
        if (ei_debug > 1)
                printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name);
-       ei_close(dev);
+       eip_close(dev);
        return 0;
 }
 
@@ -800,7 +794,7 @@ retry:
                if (time_after(jiffies, dma_start + 2*HZ/100)) {                /* 20ms */
                        printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
                        ne_reset_8390(dev);
-                       NS8390_init(dev,1);
+                       NS8390p_init(dev, 1);
                        break;
                }
 
@@ -820,7 +814,7 @@ static int __init ne_drv_probe(struct platform_device *pdev)
        if (!res || irq < 0)
                return -ENODEV;
 
-       dev = alloc_ei_netdev();
+       dev = alloc_eip_netdev();
        if (!dev)
                return -ENOMEM;
        dev->irq = irq;
@@ -861,7 +855,7 @@ static int ne_drv_resume(struct platform_device *pdev)
 
        if (netif_running(dev)) {
                ne_reset_8390(dev);
-               NS8390_init(dev, 1);
+               NS8390p_init(dev, 1);
                netif_device_attach(dev);
        }
        return 0;
@@ -918,7 +912,7 @@ int __init init_module(void)
        int plat_found = !ne_init();
 
        for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
-               struct net_device *dev = alloc_ei_netdev();
+               struct net_device *dev = alloc_eip_netdev();
                if (!dev)
                        break;
                dev->irq = irq[this_dev];