S.u.S.E. Support Data Base

Title: Compex PCI NE2000 clone

---

Mainpage ---- Searchform ---- History ---- Versions ---- Categories ---- Contents ---- Deutsch ---

Compex PCI NE2000 clone

Applicable to
Kernel version:
up to 2.0.27

Symptom:

The card mentioned above is wrongly detected and does not work.

Solution:

Use at least kernel 2.1.x (it still is not recommended)

Use the following patch:

diff -ur linux-v2.1/drivers/net/ne.c linux/drivers/net/ne.c
--- linux-v2.1/drivers/net/ne.c Thu Oct 10 01:17:06 1996
+++ linux/drivers/net/ne.c      Wed Oct 16 02:37:17 1996
@@ -24,6 +24,7 @@
     Paul Gortmaker     : multiple card support for module users.
     Paul Gortmaker     : Support for PCI ne2k clones, similar to lance.c
     Paul Gortmaker     : Allow users with bad cards to avoid full probe.
+    Paul Gortmaker     : PCI probe changes, more PCI cards supported.
 
 */
 
@@ -61,12 +62,21 @@
 /* Do we have a non std. amount of memory? (in units of 256 byte pages) */
 /* #define PACKETBUF_MEMSIZE   0x40 */
 
-/* ---- No user-serviceable parts below ---- */
-
 /* A zero-terminated list of I/O addresses to be probed. */
 static unsigned int netcard_portlist[] =
 { 0x300, 0x280, 0x320, 0x340, 0x360, 0};
 
+#ifdef CONFIG_PCI
+/* Ack! People are making PCI ne2000 clones! Oh the horror, the 
horror... */
+static struct { unsigned short vendor, dev_id;}
+pci_clone_list[] = {
+       {PCI_VENDOR_ID_REALTEK,         PCI_DEVICE_ID_REALTEK_8029},
+       {PCI_VENDOR_ID_WINBOND2,        PCI_DEVICE_ID_WINBOND2_89C940},
+       {PCI_VENDOR_ID_COMPEX,          PCI_DEVICE_ID_COMPEX_RL2000},
+       {0,}
+};
+#endif
+
 #ifdef SUPPORT_NE_BAD_CLONES
 /* A list of bad clones that we none-the-less recognize. */
 static struct { const char *name8, *name16; unsigned char SAprefix[4];}
@@ -80,10 +90,14 @@
     {"4-DIM8","4-DIM16", {0x00,0x00,0x4d,}},  /* Outlaw 4-Dimension 
cards. */
     {"Con-Intl_8", "Con-Intl_16", {0x00, 0x00, 0x24}}, /* Connect Int'nl */
     {"ET-100","ET-200", {0x00, 0x45, 0x54}}, /* YANG and YA clone */
+    {"COMPEX","COMPEX16",{0x00,0x80,0x48}}, /* Broken ISA Compex cards */
+    {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 
clones */
     {0,}
 };
 #endif
 
+/* ---- No user-serviceable parts below ---- */
+
 #define NE_BASE         (dev->base_addr)
 #define NE_CMD         0x00
 #define NE_DATAPORT    0x10    /* NatSemi-defined port window offset. */
@@ -99,6 +113,7 @@
static unsigned char pci_irq_line = 0;
 
 int ne_probe(struct device *dev);
+static int ne_probe_pci(struct device *dev);
 static int ne_probe1(struct device *dev, int ioaddr);
 
 static int ne_open(struct device *dev);
@@ -154,40 +169,13 @@
     else if (base_addr != 0)   /* Don't probe at all. */
        return ENXIO;
 
+#ifdef CONFIG_PCI
     /* Then look for any installed PCI clones */
-#if defined(CONFIG_PCI)
-    if (pcibios_present()) {
-       int pci_index;
-       for (pci_index = 0; pci_index < 8; pci_index++) {
-               unsigned char pci_bus, pci_device_fn;
-               unsigned int pci_ioaddr;
-
-               /* Currently only Realtek are making PCI ne2k clones. */
-               if (pcibios_find_device (PCI_VENDOR_ID_REALTEK,
-                               PCI_DEVICE_ID_REALTEK_8029, pci_index,
-                               &pci_bus, &pci_device_fn) != 0)
-                       break;  /* OK, now try to probe for std. ISA card */
-               pcibios_read_config_byte(pci_bus, pci_device_fn,
-                               PCI_INTERRUPT_LINE, &pci_irq_line);
-               pcibios_read_config_dword(pci_bus, pci_device_fn,
-                               PCI_BASE_ADDRESS_0, &pci_ioaddr);
-               /* Strip the I/O address out of the returned value */
-               pci_ioaddr &= PCI_BASE_ADDRESS_IO_MASK;
-               /* Avoid already found cards from previous ne_probe() 
calls */
-               if (check_region(pci_ioaddr, NE_IO_EXTENT))
-                       continue;
-               printk("ne.c: PCI BIOS reports ne2000 clone at i/o %#x, 
irq %d.\
n",
-                               pci_ioaddr, pci_irq_line);
-               if (ne_probe1(dev, pci_ioaddr) != 0) {  /* Shouldn't 
happen. */
-                       printk(KERN_ERR "ne.c: Probe of PCI card at %#x 
failed.\
n", pci_ioaddr);
-                       break;  /* Hrmm, try to probe for ISA card... */
-               }
-               pci_irq_line = 0;
-               return 0;
-       }
-    }
-#endif  /* defined(CONFIG_PCI) */
+    if (pcibios_present() && (ne_probe_pci(dev) == 0)) 
+       return 0;
+#endif
 
+#ifndef MODULE
     /* Last resort. The semi-risky ISA auto-probe. */
     for (i = 0; netcard_portlist[i]; i++) {
        int ioaddr = netcard_portlist[i];
@@ -196,11 +184,55 @@
        if (ne_probe1(dev, ioaddr) == 0)
            return 0;
     }
+#endif
 
     return ENODEV;
 }
 #endif
 
+#ifdef CONFIG_PCI
+static int ne_probe_pci(struct device *dev)
+{
+       int i;
+
+       for (i = 0; pci_clone_list[i].vendor != 0; i++) {
+               unsigned char pci_bus, pci_device_fn;
+               unsigned int pci_ioaddr;
+               int pci_index;
+               
+               for (pci_index = 0; pci_index < 8; pci_index++) {
+                       if (pcibios_find_device (pci_clone_list[i].vendor,
+                                       pci_clone_list[i].dev_id, pci_index,
+                                       &pci_bus, &pci_device_fn) != 0)
+                               break;  /* No more of these type of cards */
+                       pcibios_read_config_dword(pci_bus, pci_device_fn,
+                                       PCI_BASE_ADDRESS_0, &pci_ioaddr);
+                       /* Strip the I/O address out of the returned 
value */
+                       pci_ioaddr &= PCI_BASE_ADDRESS_IO_MASK;
+                       /* Avoid already found cards from previous calls */
+                       if (check_region(pci_ioaddr, NE_IO_EXTENT))
+                               continue;
+                       pcibios_read_config_byte(pci_bus, pci_device_fn,
+                                       PCI_INTERRUPT_LINE, &pci_irq_line);
+                       break;  /* Beauty -- got a valid card. */
+               }
+               if (pci_irq_line == 0) continue;        /* Try next PCI 
ID */
+               printk("ne.c: PCI BIOS reports %s %s at i/o %#x, irq %d.\n",
+                               pci_strvendor(pci_clone_list[i].vendor),
+                               pci_strdev(pci_clone_list[i].vendor, 
pci_clone_l
ist[i].dev_id),
+                               pci_ioaddr, pci_irq_line);
+               if (ne_probe1(dev, pci_ioaddr) != 0) {  /* Shouldn't 
happen. */
+                       printk(KERN_ERR "ne.c: Probe of PCI card at %#x 
failed.\
n", pci_ioaddr);
+                       pci_irq_line = 0;
+                       return -ENXIO;
+               }
+               pci_irq_line = 0;
+               return 0;
+       }
+       return -ENODEV;
+}
+#endif  /* CONFIG_PCI */
+
 static int ne_probe1(struct device *dev, int ioaddr)
 {
     int i;
@@ -308,8 +340,8 @@
        for (i = 0; i < 16; i++)
                SA_prom[i] = SA_prom[i+i];
     
-    if (pci_irq_line)
-       wordlength = 2;         /* Catch broken cards mentioned above. */
+    if (pci_irq_line || ioaddr >= 0x400)
+       wordlength = 2;         /* Catch broken PCI cards mentioned 
above. */
 
     if (wordlength == 2) {
        /* We must set the 8390 for word mode. */
@@ -359,9 +391,8 @@
 
     }
 
-    if (pci_irq_line) {
+    if (pci_irq_line)
        dev->irq = pci_irq_line;
-    }
 
     if (dev->irq < 2) {
        autoirq_setup(0);
@@ -711,17 +742,17 @@
                dev->irq = irq[this_dev];
                dev->base_addr = io[this_dev];
                dev->init = ne_probe;
-               if (io[this_dev] == 0)  {
-                       if (this_dev != 0) break; /* only complain once */
-                       printk(KERN_NOTICE "ne.c: Module autoprobing not 
allowed
. Append \"io=0xNNN\" value(s).\n");
-                       return -EPERM;
-               }
-               if (register_netdev(dev) != 0) {
-                       printk(KERN_WARNING "ne.c: No NE*000 card found 
(i/o = 0
x%x).\n", io[this_dev]);
-                       if (found != 0) return 0;       /* Got at least 
one. */
-                       return -ENXIO;
+               if (register_netdev(dev) == 0) {
+                       found++;
+                       continue;
                }
-               found++;
+               if (found != 0)         /* Got at least one. */
+                       return 0;
+               if (io[this_dev] != 0)
+                       printk(KERN_WARNING "ne.c: No NE*000 card found 
at i/o =
 %#x\n", io[this_dev]);
+               else
+                       printk(KERN_NOTICE "ne.c: No PCI cards found. Use 
\"io=0
xNNN\" value(s) for ISA cards.\n");
+               return -ENXIO;
        }
 
        return 0;
diff -ur linux-v2.1/drivers/pci/pci.c linux/drivers/pci/pci.c
--- linux-v2.1/drivers/pci/pci.c        Mon Oct  7 17:38:52 1996
+++ linux/drivers/pci/pci.c     Tue Oct 15 13:57:49 1996
@@ -116,6 +116,7 @@
        DEVICE( BUSLOGIC,       BUSLOGIC_MULTIMASTER,    "MultiMaster"),
        DEVICE( BUSLOGIC,       BUSLOGIC_FLASHPOINT,     "FlashPoint"),
        DEVICE( OAK,            OAK_OTI107,     "OTI107"),
+       DEVICE( WINBOND2,       WINBOND2_89C940,"NE2000-PCI"),
        DEVICE( PROMISE,        PROMISE_5300,   "DC5030"),
        DEVICE( N9,             N9_I128,        "Imagine 128"),
        DEVICE( N9,             N9_I128_2,      "Imagine 128v2"),
@@ -196,6 +197,7 @@
        DEVICE( ZEITNET,        ZEITNET_1225,   "1225"),
        DEVICE( SPECIALIX,      SPECIALIX_XIO,  "XIO/SIO host"),
        DEVICE( SPECIALIX,      SPECIALIX_RIO,  "RIO host"),
+       DEVICE( COMPEX,         COMPEX_RL2000,  "ReadyLink 2000"),
        DEVICE( RP,             RP8OCTA,        "RocketPort 8 Oct"),
        DEVICE( RP,             RP8INTF,        "RocketPort 8 Intf"),
        DEVICE( RP,             RP16INTF,       "RocketPort 16 Intf"),
@@ -475,6 +477,7 @@
              case PCI_VENDOR_ID_SGS:           return "SGS Thomson";
              case PCI_VENDOR_ID_BUSLOGIC:      return "BusLogic";
              case PCI_VENDOR_ID_OAK:           return "OAK";
+             case PCI_VENDOR_ID_WINBOND2:      return "Winbond";
              case PCI_VENDOR_ID_PROMISE:       return "Promise Technology";
              case PCI_VENDOR_ID_N9:            return "Number Nine";
              case PCI_VENDOR_ID_UMC:           return "UMC";
@@ -512,6 +515,7 @@
              case PCI_VENDOR_ID_TOSHIBA:       return "Toshiba";
              case PCI_VENDOR_ID_ZEITNET:       return "ZeitNet";
              case PCI_VENDOR_ID_SPECIALIX:     return "Specialix";
+             case PCI_VENDOR_ID_COMPEX:        return "Compex";
              case PCI_VENDOR_ID_RP:            return "Comtrol";
              case PCI_VENDOR_ID_CYCLADES:      return "Cyclades";
              case PCI_VENDOR_ID_SYMPHONY:      return "Symphony";
diff -ur linux-v2.1/include/linux/pci.h linux/include/linux/pci.h
--- linux-v2.1/include/linux/pci.h      Mon Oct  7 17:38:58 1996
+++ linux/include/linux/pci.h   Tue Oct 15 13:50:25 1996
@@ -348,6 +348,10 @@
 #define PCI_VENDOR_ID_OAK              0x104e
 #define PCI_DEVICE_ID_OAK_OTI107       0x0107
 
+/* Winbond have two vendor ID! See 0x10ad as well */
+#define PCI_VENDOR_ID_WINBOND2         0x1050
+#define PCI_DEVICE_ID_WINBOND2_89C940  0x0940
+
 #define PCI_VENDOR_ID_PROMISE          0x105a
 #define PCI_DEVICE_ID_PROMISE_5300     0x5300
 
@@ -503,6 +507,9 @@
 #define PCI_VENDOR_ID_SPECIALIX                0x11cb
 #define PCI_DEVICE_ID_SPECIALIX_XIO    0x4000
 #define PCI_DEVICE_ID_SPECIALIX_RIO    0x8000
+
+#define PCI_VENDOR_ID_COMPEX           0x11f6
+#define PCI_DEVICE_ID_COMPEX_RL2000    0x1401
 
 #define PCI_VENDOR_ID_RP               0x11fe
 #define PCI_DEVICE_ID_RP8OCTA          0x0001

---

Keywords: NE2000, COMPEX

---

Feedback welcome: Send Mail to rj@suse.de (Please give the following subject: SDB-compex2000)

---

Mainpage ---- Searchform ---- History ---- Versions ---- Categories ---- Contents ---- Deutsch ---

SDB-compex2000, Copyright S.u.S.E. GmbH, Fürth, Germany - Version: 18.02.97
Impressum - Last generated: 17. Sep 1997 12:56:01 by mb with sdb_gen 0.70.0