[PATCH] for pcnet32.c

From: Steve Koh (skoh@pass.korea.army.mil)
Date: Tue Jan 16 2001 - 17:42:57 EST


Here is a patch to use the fiber optic interface from an
Allied Telesyn AT-2450FTX. The card uses the AMD 79C972
chip and works fine using the original driver on the
twisted pair port. The change is only effective as a
module, and takes the parameter "fiber=1" to enable
the interface.

This patch is for kernel 2.2.18.

All questions and comments are welcome.

Thank you,
Stephen H Koh

--- drivers/net/pcnet32.c.orig Tue Jan 16 21:48:58 2001
+++ drivers/net/pcnet32.c Tue Jan 16 22:34:39 2001
@@ -90,6 +90,7 @@
 #define MAX_UNITS 8
 static int options[MAX_UNITS] = {0, };
 static int full_duplex[MAX_UNITS] = {0, };
+static int fiber;
 
 /*
  * Theory of Operation
@@ -810,6 +811,25 @@
               (u32) virt_to_bus(lp->rx_ring),
               (u32) virt_to_bus(&lp->init_block));
 
+ /*
+ * option for fiber optic interface
+ * as found in Allied Telesyn's AT-2450FTX
+ *
+ * set DANAS, clear ASEL, select MII
+ * set the external PHY Isolate bit for PHYAD 1
+ * and clear it for PHYAD 2
+ */
+ if (fiber) {
+ printk("pcnet32: using fiber optic interface\n");
+ 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);
+ }
+
     /* set/reset autoselect bit */
     val = lp->a.read_bcr (ioaddr, 2) & ~2;
     if (lp->options & PORT_ASEL)
@@ -1502,6 +1522,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(fiber, "i");
 
 
 /* An additional parameter that may be passed in... */
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org



This archive was generated by hypermail 2b29 : Tue Jan 23 2001 - 21:00:32 EST