[PATCH] interface mod parm for pcnet32 (79C792 & 79C978)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a patch against a plain 2.4.1 kernel for pcnet32.c to allow using alternate interfaces with the HomePNA cards and the AT-2450FTX fiber optic/twisted pair card.

--- drivers/net/pcnet32.c.orig  Mon Feb  5 10:40:05 2001
+++ drivers/net/pcnet32.c       Mon Feb  5 18:30:55 2001
@@ -85,6 +85,7 @@
 #define MAX_UNITS 8
 static int options[MAX_UNITS];
 static int full_duplex[MAX_UNITS];
+static char interface[8];
 
 /*
  *                             Theory of Operation
@@ -161,6 +162,7 @@
  * v1.25kf Added No Interrupt on successful Tx for some Tx's <kaf@fc.hp.com>
  * v1.26   Converted to pci_alloc_consistent, Jamey Hicks / George France
  *                                           <jamey@crl.dec.com>
+ * v1.26sk Added interface module parameter for 79C972 and 79C978, Steve Koh
  */
 
 
@@ -279,7 +281,8 @@
              dxsuflo:1,                                                    /* disable transmit stop on uflo */
 #endif
        full_duplex:1,                          /* full duplex possible */
-       mii:1;                                  /* mii port available */
+       mii:1,                                  /* mii port available */
+       fiber:1;                                /* use fiber port */
     struct net_device *next;
 };
 
@@ -514,7 +517,7 @@
 {
     struct pcnet32_private *lp;
     dma_addr_t lp_dma_addr;
-    int i,media,fdx = 0, mii = 0, fset = 0;
+    int i,media,fdx = 0, mii = 0, fset = 0, fiber = 0;
 #ifdef DO_DXSUFLO
     int dxsuflo = 0;
 #endif
@@ -565,6 +568,11 @@
     case 0x2624:
        chipname = "PCnet/FAST+ 79C972"; /* PCI */
        fdx = 1; mii = 1; fset = 1;
+       if (!strcmp(interface, "fiber")) {
+               if (pcnet32_debug > 2)
+                       printk(KERN_DEBUG "pcnet32: using fiber interface.\n");
+               fiber = 1;
+       }
        break;
     case 0x2625:
        chipname = "PCnet/FAST III 79C973"; /* PCI */
@@ -576,18 +584,22 @@
        /*
         * This is based on specs published at www.amd.com.  This section
         * assumes that a card with a 79C978 wants to go into 1Mb HomePNA
-        * mode.  The 79C978 can also go into standard ethernet, and there
-        * probably should be some sort of module option to select the
-        * mode by which the card should operate
+        * mode.  The 79C978 can also go into standard ethernet.
         */
-       /* switch to home wiring mode */
        media = a->read_bcr (ioaddr, 49);
-#if 0
-       if (pcnet32_debug > 2)
-           printk(KERN_DEBUG "pcnet32: pcnet32 media value %#x.\n",  media);
-       media &= ~3;
-       media |= 1;
-#endif
+       if (!strcmp(interface, "rj45")) { /* switch to rj45 mode */
+               if (pcnet32_debug > 2) {
+               printk(KERN_DEBUG "pcnet32: pcnet32 media value %#x.\n",  media);
+               printk(KERN_DEBUG "pcnet32: using rj45 connector.\n");
+               }
+       } else { /* switch to home wiring mode */
+               if (pcnet32_debug > 2) {
+                   printk(KERN_DEBUG "pcnet32: pcnet32 media value %#x.\n",  media);
+                   printk(KERN_DEBUG "pcnet32: using HomePNA mode.\n");
+               }
+               media &= ~3;
+               media |= 1;
+       }
        if (pcnet32_debug > 2)
            printk(KERN_DEBUG "pcnet32: pcnet32 media reset to %#x.\n",  media);
        a->write_bcr (ioaddr, 49, media);
@@ -675,6 +687,7 @@
 #endif
     lp->ltint = ltint;
     lp->mii = mii;
+    lp->fiber = fiber;
     if (options[card_idx] > sizeof (options_mapping))
        lp->options = PORT_ASEL; 
     else
@@ -820,6 +833,20 @@
        lp->a.write_bcr (ioaddr, 32, val);
     }
 
+       /*
+        * set DANAS, clear ASEL, select MII,
+        * set isolate PHY 1, clear isolate PHY 2
+        */
+       if (lp->fiber) {
+               lp->a.write_bcr(ioaddr, 32, lp->a.read_bcr(ioaddr, 32) | 0x80);
+               lp->a.write_bcr(ioaddr, 2, lp->a.read_bcr(ioaddr, 2) & ~0x2);
+               lp->a.write_csr(ioaddr, 15, lp->a.read_csr(ioaddr, 15) | 0x180);
+               lp->a.write_bcr(ioaddr, 33, (lp->a.read_bcr(ioaddr, 33) & ~0x3e0) | 0x1 << 5);
+               lp->a.write_bcr(ioaddr, 34, lp->a.read_bcr(ioaddr, 34) | 0x400);
+               lp->a.write_bcr(ioaddr, 33, (lp->a.read_bcr(ioaddr, 33) & ~0x3e0) | 0x2 << 5);
+               lp->a.write_bcr(ioaddr, 34, lp->a.read_bcr(ioaddr, 34) & ~0x400);
+       }
+
 #ifdef DO_DXSUFLO
     if (lp->dxsuflo) { /* Disable transmit stop on underflow */
        val = lp->a.read_csr (ioaddr, 3);
@@ -1489,6 +1516,7 @@
 MODULE_PARM(tx_start_pt, "i");
 MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
 MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
+MODULE_PARM(interface, "c8");
 MODULE_AUTHOR("Thomas Bogendoerfer");
 MODULE_DESCRIPTION("Driver for PCnet32 and PCnetPCI based ethercards");   


Get your own FREE E-mail address at http://www.linuxfreemail.com
Linux FREE Mail is 100% FREE, 100% Linux, and 100% yours!
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux