vserver 1.9.5.x5
[linux-2.6.git] / drivers / net / ne.c
index 9de5ccc..4964339 100644 (file)
@@ -29,6 +29,7 @@
     last in cleanup_modue()
     Richard Guenther    : Added support for ISAPnP cards
     Paul Gortmaker     : Discontinued PCI support - use ne2k-pci.c instead.
+    Hayato Fujiwara    : Add m32r support.
 
 */
 
@@ -55,6 +56,8 @@ static const char version2[] =
 
 #include "8390.h"
 
+#define DRV_NAME "ne"
+
 /* Some defines that people can play with if so inclined. */
 
 /* Do we support clones that don't adhere to 14,15 of the SAprom ? */
@@ -109,7 +112,7 @@ bad_clone_list[] __initdata = {
     {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */
     {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */
     {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */
-    {0,}
+    {NULL,}
 };
 #endif
 
@@ -126,6 +129,14 @@ bad_clone_list[] __initdata = {
 #define NESM_START_PG  0x40    /* First page of TX buffer */
 #define NESM_STOP_PG   0x80    /* Last page +1 of RX ring */
 
+#ifdef CONFIG_PLAT_MAPPI
+#  define DCR_VAL 0x4b
+#elif CONFIG_PLAT_OAKS32R
+#  define DCR_VAL 0x48
+#else
+#  define DCR_VAL 0x49
+#endif
+
 static int ne_probe1(struct net_device *dev, int ioaddr);
 static int ne_probe_isapnp(struct net_device *dev);
 
@@ -203,6 +214,7 @@ static void cleanup_card(struct net_device *dev)
        release_region(dev->base_addr, NE_IO_EXTENT);
 }
 
+#ifndef MODULE
 struct net_device * __init ne_probe(int unit)
 {
        struct net_device *dev = alloc_ei_netdev();
@@ -227,6 +239,7 @@ out:
        free_netdev(dev);
        return ERR_PTR(err);
 }
+#endif
 
 static int __init ne_probe_isapnp(struct net_device *dev)
 {
@@ -284,7 +297,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
        int reg0, ret;
        static unsigned version_printed;
 
-       if (!request_region(ioaddr, NE_IO_EXTENT, dev->name))
+       if (!request_region(ioaddr, NE_IO_EXTENT, DRV_NAME))
                return -EBUSY;
 
        reg0 = inb_p(ioaddr);
@@ -383,7 +396,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
                for (i = 0; i < 16; i++)
                        SA_prom[i] = SA_prom[i+i];
                /* We must set the 8390 for word mode. */
-               outb_p(0x49, ioaddr + EN0_DCFG);
+               outb_p(DCR_VAL, ioaddr + EN0_DCFG);
                start_page = NESM_START_PG;
                stop_page = NESM_STOP_PG;
        } else {
@@ -391,7 +404,12 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
                stop_page = NE1SM_STOP_PG;
        }
 
+#if  defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R)
+       neX000 = ((SA_prom[14] == 0x57  &&  SA_prom[15] == 0x57)
+               || (SA_prom[14] == 0x42 && SA_prom[15] == 0x42));
+#else
        neX000 = (SA_prom[14] == 0x57  &&  SA_prom[15] == 0x57);
+#endif
        ctron =  (SA_prom[0] == 0x00 && SA_prom[1] == 0x00 && SA_prom[2] == 0x1d);
        copam =  (SA_prom[14] == 0x49 && SA_prom[15] == 0x00);
 
@@ -472,10 +490,20 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
 
        dev->base_addr = ioaddr;
 
+#ifdef CONFIG_PLAT_MAPPI
+       outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP,
+               ioaddr + E8390_CMD); /* 0x61 */
+       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%s: %s found at %#x, using IRQ %d.\n",
                dev->name, name, ioaddr, dev->irq);
@@ -483,7 +511,11 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
        ei_status.name = name;
        ei_status.tx_start_page = start_page;
        ei_status.stop_page = stop_page;
+#ifdef CONFIG_PLAT_OAKS32R
+       ei_status.word16 = 0;
+#else
        ei_status.word16 = (wordlength == 2);
+#endif
 
        ei_status.rx_start_page = start_page + TX_PAGES;
 #ifdef PACKETBUF_MEMSIZE
@@ -768,9 +800,9 @@ static int io[MAX_NE_CARDS];
 static int irq[MAX_NE_CARDS];
 static int bad[MAX_NE_CARDS];  /* 0xbad = bad sig or no reset ack */
 
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(bad, int, NULL, 0);
 MODULE_PARM_DESC(io, "I/O base address(es),required");
 MODULE_PARM_DESC(irq, "IRQ number(s)");
 MODULE_PARM_DESC(bad, "Accept card(s) with bad signatures");