COM20020 Driver Patches for 2.5.49

From: Roman Fietze (fietze@swec.muh.de.heidelberg.com)
Date: Fri Nov 29 2002 - 07:30:50 EST


Hello,

These are patches for the com20020.c and com20020-pci.c generic and
PCI specific drivers. These patches incorporate:

- support for SOHARD card
- bug fix checking return code of request_region
- fix for number of I/O ports used by the card
- enable P1Mode for backplane mode

These changes had been submitted once in a while since kernel
2.4.6. We've been running the changed driver in number of application
in RAW mode w/o any problem on the i386.

diff -Naur ./linux-2.5.49/drivers/net/arcnet/com20020-pci.c ./linux-2.5.49-arcnet-patches/drivers/net/arcnet/com20020-pci.c
--- ./linux-2.5.49/drivers/net/arcnet/com20020-pci.c Fri Nov 22 22:40:21 2002
+++ ./linux-2.5.49-arcnet-patches/drivers/net/arcnet/com20020-pci.c Fri Nov 29 10:12:09 2002
@@ -1,5 +1,6 @@
 /*
- * Linux ARCnet driver - COM20020 PCI support (Contemporary Controls PCI20)
+ * Linux ARCnet driver - COM20020 PCI support
+ * Contemporary Controls PCI20 and SOHARD SH-ARC PCI
  *
  * Written 1994-1999 by Avery Pennarun,
  * based on an ISA version by David Woodhouse.
@@ -86,7 +87,21 @@
         memset(lp, 0, sizeof(struct arcnet_local));
         pci_set_drvdata(pdev, dev);
 
- ioaddr = pci_resource_start(pdev, 2);
+ // SOHARD needs PCI base addr 4
+ if (pdev->vendor==0x10B5) {
+ BUGMSG(D_NORMAL, "SOHARD\n");
+ ioaddr = pci_resource_start(pdev, 4);
+ }
+ else {
+ BUGMSG(D_NORMAL, "Contemporary Controls\n");
+ ioaddr = pci_resource_start(pdev, 2);
+ }
+
+ // Dummy access after Reset
+ // ARCNET controller needs this access to detect bustype
+ outb(0x00,ioaddr+1);
+ inb(ioaddr+1);
+
         dev->base_addr = ioaddr;
         dev->irq = pdev->irq;
         dev->dev_addr[0] = node;
@@ -152,6 +167,7 @@
         { 0x1571, 0xa204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
         { 0x1571, 0xa205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
         { 0x1571, 0xa206, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
+ { 0x10B5, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT },
         {0,}
 };
 
diff -Naur ./linux-2.5.49/drivers/net/arcnet/com20020.c ./linux-2.5.49-arcnet-patches/drivers/net/arcnet/com20020.c
--- ./linux-2.5.49/drivers/net/arcnet/com20020.c Fri Nov 22 22:40:27 2002
+++ ./linux-2.5.49-arcnet-patches/drivers/net/arcnet/com20020.c Fri Nov 29 10:00:17 2002
@@ -98,6 +98,9 @@
         lp->setup = lp->clockm ? 0 : (lp->clockp << 1);
         lp->setup2 = (lp->clockm << 4) | 8;
 
+ /* Enable P1Mode for backplane mode */
+ lp->setup = lp->setup | P1MODE;
+
         SET_SUBADR(SUB_SETUP1);
         outb(lp->setup, _XREG);
 
@@ -202,7 +205,7 @@
                 return -ENODEV;
         }
         /* reserve the I/O region */
- if (request_region(ioaddr, ARCNET_TOTAL_SIZE, "arcnet (COM20020)")) {
+ if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "arcnet (COM20020)")) {
                 free_irq(dev->irq, dev);
                 return -EBUSY;
         }
@@ -300,8 +303,9 @@
         struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
         int ioaddr = dev->base_addr;
 
- if (open)
+ if (open) {
                 MOD_INC_USE_COUNT;
+ }
         else {
                 /* disable transmitter */
                 lp->config &= ~TXENcfg;
diff -Naur ./linux-2.5.49/include/linux/com20020.h ./linux-2.5.49-arcnet-patches/include/linux/com20020.h
--- ./linux-2.5.49/include/linux/com20020.h Fri Nov 22 22:40:19 2002
+++ ./linux-2.5.49-arcnet-patches/include/linux/com20020.h Fri Nov 29 09:58:56 2002
@@ -32,7 +32,7 @@
 void com20020_remove(struct net_device *dev);
 
 /* The number of low I/O ports used by the card. */
-#define ARCNET_TOTAL_SIZE 9
+#define ARCNET_TOTAL_SIZE 8
 
 /* various register addresses */
 #define _INTMASK (ioaddr+0) /* writable */
@@ -59,6 +59,8 @@
 
 /* in SETUP register */
 #define PROMISCset 0x10 /* enable RCV_ALL */
+#define P1MODE 0x80 /* enable P1-MODE for Backplane */
+#define SLOWARB 0x01 /* enable Slow Arbitration for >=5Mbps */
 
 /* COM2002x */
 #define SUB_TENTATIVE 0 /* tentative node ID */

Roman

-- 
Roman Fietze (Mail Code 6)  Heidelberg Digital Finishing GmbH, Germany
fietze@swec.muh.de.heidelberg.com          roman.fietze@heidelberg.com
GnuPG/PGP Key Server for my Keys:      http://www.pgp.net/wwwkeys.html


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Nov 30 2002 - 22:00:22 EST