[epic] [patch] activating fiber interface, 2nd version, need your help for testing
Gernot Hillier
gernot@hillier.de
Tue Jul 9 00:52:33 2002
--------------Boundary-00=_5M5Y166TK26OFEML4K2D
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi!
Due to feedback of Andrew Morton (network device drivers maintainer for l=
inux=20
kernel) on linux-net, we made some changes to our last patch.=20
BTW: Donald, are you reading this list? Did you have a look on our change=
s?
Now to the changes: Andrew pointed out that our change of media detection=
that=20
was done regularly in interrupt context could be problematic, so Christop=
h=20
moved it to the open routine of the driver
=3D> this means, that HOT-PLUG CHANGE OF MEDIA is NOT POSSIBLE any=20
more
=3D> SOLUTION is to reload and restart the driver after a media change
=3D> if the card has no link when loading the driver, it will switch to T=
X and=20
stay with TX until you reload the driver
Additional changes:=20
* the udelay in open() of about 1.5 sec is needed for the optical modul t=
o=20
finish its autonegotiate, so it is checked if link on fiber is up, if lin=
k is=20
not up, the driver switches to TwistedPair
Our patch was tested with the following combinations successfully:
* SMC 9432 FTX connected via FX to a HP switch:
-> running on 48 Pentium III machines for public use in our university si=
nce=20
several days without problems=20
-> running on 2 Compaq Proliant Dual processor servers since some days wi=
thout=20
problems (so the epic100-driver works with SMP machines which wasn't the =
case=20
with the driver from SMC!!)
* SMC 9432 FTX connected via TX to a HP 100BaseT switch
* SMC 9432 FTX connected via TX to a 10BaseT hub/switch
* SMC 9432 TX connected via TX to a HP 100BaseT switch
* SMC 9432 TX connected via TX to a 10BaseT hub/switch
-> these combinations were tested for some time (mainly "ping -f" tests),=
but=20
not as thoroughly as the first one, as we don't have any machines with th=
is=20
combination running under Linux permanently.
NOT tested is the 9432 BTX card, esp. with the BNC connector. So we would=
=20
welcome anyone who wants to test our patch. We expect no negative effects=
as=20
this part of the code wasn't changed.
Again, this patch applies to the current 2.4.18-kernel-version of epic100=
=2Ec,=20
not against the current versions available from scyld.com.
Short information how to apply the patch (naturally, you need to have the=
=20
2.4.18-kernel sources installed and configured properly before):
* cd <path to your linux sources> (often /usr/src/linux)
* cd drivers/net
* patch -p0 < epic100_fx_2.4.17.diff
If you see an error message that the _first_ hunk failed, that's not too =
bad,=20
as these are only some comments added to the header and a changed version=
=20
number. If any other hunk fails, the driver will not work and you need ei=
ther=20
another patch or another kernel sources.
* cd ../..
* make modules modules_install
Please don't hesitate to contact me if you have some problems or question=
s=20
concerning our patch or how to apply it!
If you need the patch against the current versions from scyld.com, please=
tell=20
me, too.
We would really appreciate if some people could test our changes, so we c=
an=20
get it included in the standard kernel some day...
Don't worry, these changes are rather small, so no too bad effects are to=
be=20
expected...
--=20
Ciao,
Gernot
--------------Boundary-00=_5M5Y166TK26OFEML4K2D
Content-Type: text/x-diff;
charset="us-ascii";
name="epic100_fx_2.4.17.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="epic100_fx_2.4.17.diff"
--- epic100.c Fri Jan 1 01:00:34 1999
+++ epic100-v2.c Fri Jan 1 01:11:57 1999
@@ -60,11 +60,13 @@
LK1.1.12:
* fix power-up sequence
+ LK1.1.xx:
+ * fiber link enabled (Christoph Dolina), switch media delayed by 5 sec
*/
#define DRV_NAME "epic100"
-#define DRV_VERSION "1.11+LK1.1.12"
-#define DRV_RELDATE "Jan 18, 2002"
+#define DRV_VERSION "1.12+LK1.1.xx"
+#define DRV_RELDATE "Jun 26, 2002"
/* The user-configurable values.
@@ -477,6 +479,9 @@
ep->chip_id = chip_idx;
ep->chip_flags = pci_id_tbl[chip_idx].drv_flags;
+ /* (Christoph Dolina): Needed for rising up the Hardware */
+ { udelay(200); }
+
/* Find the connected MII xcvrs.
Doing this in open() would allow detecting external xcvrs later, but
takes much time and no cards have external MII. */
@@ -692,33 +697,86 @@
outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL);
#endif
+ /* (Christoph Dolina): Needed for rising up the Hardware */
+ { udelay(200); }
+
for (i = 0; i < 3; i++)
outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4);
ep->tx_threshold = TX_FIFO_THRESH;
outl(ep->tx_threshold, ioaddr + TxThresh);
- if (media2miictl[dev->if_port & 15]) {
- if (ep->mii_phy_cnt)
- mdio_write(dev, ep->phys[0], MII_BMCR, media2miictl[dev->if_port&15]);
- if (dev->if_port == 1) {
- if (debug > 1)
- printk(KERN_INFO "%s: Using the 10base2 transceiver, MII "
- "status %4.4x.\n",
- dev->name, mdio_read(dev, ep->phys[0], MII_BMSR));
- }
- } else {
- int mii_lpa = mdio_read(dev, ep->phys[0], MII_LPA);
- if (mii_lpa != 0xffff) {
- if ((mii_lpa & LPA_100FULL) || (mii_lpa & 0x01C0) == LPA_10FULL)
- ep->mii.full_duplex = 1;
- else if (! (mii_lpa & LPA_LPACK))
- mdio_write(dev, ep->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART);
- if (debug > 1)
- printk(KERN_INFO "%s: Setting %s-duplex based on MII xcvr %d"
- " register read of %4.4x.\n", dev->name,
- ep->mii.full_duplex ? "full" : "half",
- ep->phys[0], mii_lpa);
+ /* 26.Jun.2002: Switch on the Power on Fiber and Enables the Fiber */
+ /* Config-Reg (0x13): Fiber_Enable (0x0004), Fiber_On, Led_On */
+ mdio_write(dev, ep->phys[0], 0x13, 0x0004 | 0x0040 | 0x0080);
+
+ /* Phy-BMC-Reg: Loopback */
+ mdio_write(dev, ep->phys[0], 0x00, 0x4000);
+
+ /* Phy-BMC-Reg: Loopback off(0x0002), FullDuplex (0x0100), 100Mbps (0x2000) */
+ mdio_write(dev, ep->phys[0], 0x00, 0x0002 | 0x0100 | 0x2000);
+
+ /* Wait until Autoneg ready => so you can check for Link up or down on fiber */
+ for (i = 0; i<1000; i++)
+ udelay(1500);
+
+ /* Status-Reg (0x14): check FOR Link up */
+ i = mdio_read(dev, ep->phys[0], 0x14);
+
+ /* IF no Link, change type of media */
+ if ( ( i & 0x2000) == 0 ) {
+
+ /* read Config-Reg (0x13): check IF fiber is on */
+ i = mdio_read(dev, ep->phys[0], 0x13);
+
+ /* fiber on (and no link) then disable fiber */
+ if ( ( i & 0x0004 ) != 0 ) {
+
+ // Config-Reg (0x13): disable it
+ mdio_write(dev, ep->phys[0], 0x13, 0x0000);
+
+ /* and activate utp */
+ {
+ if (media2miictl[dev->if_port & 15]) {
+ if (ep->mii_phy_cnt)
+ mdio_write(dev, ep->phys[0], MII_BMCR, media2miictl[dev->if_port&15]);
+ if (dev->if_port == 1) {
+ if (debug > 1)
+ printk(KERN_INFO "%s: Using the 10base2 transceiver, MII "
+ "status %4.4x.\n",
+ dev->name, mdio_read(dev, ep->phys[0], MII_BMSR));
+ }
+ } else {
+ int mii_lpa = mdio_read(dev, ep->phys[0], MII_LPA);
+ if (mii_lpa != 0xffff) {
+ if ((mii_lpa & LPA_100FULL) || (mii_lpa & 0x01C0) == LPA_10FULL)
+ ep->mii.full_duplex = 1;
+ else if (! (mii_lpa & LPA_LPACK))
+ mdio_write(dev, ep->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART);
+ if (debug > 1)
+ printk(KERN_INFO "%s: Setting %s-duplex based on MII xcvr %d"
+ " register read of %4.4x.\n", dev->name,
+ ep->mii.full_duplex ? "full" : "half",
+ ep->phys[0], mii_lpa);
+ }
+ }
+ }
+ /* IF fiber off (and no link) then enable it */
+ } else {
+ /* 26.Jun.2002, Changes for Fiber (Christoph Dolina)
+ 1. Switch on the Power and Enables the Fiber
+ 2. Activates the Loopbackmode (forces the other side to autoneg.)
+ 3. Deactivates the Loopback, back to net in 100Mbps and Fulldplx
+ */
+
+ /* Config-Reg (0x13): Fiber_Enable (0x0004), Fiber_On, Led_On */
+ mdio_write(dev, ep->phys[0], 0x13, 0x0004 | 0x0040 | 0x0080);
+
+ /* Phy-BMC-Reg: Loopback */
+ mdio_write(dev, ep->phys[0], 0x00, 0x4000);
+
+ /* Phy-BMC-Reg: Loopback aus(0x0002), FullDuplex (0x0100), 100Mbps (0x2000) */
+ mdio_write(dev, ep->phys[0], 0x00, 0x0002 | 0x0100 | 0x2000);
}
}
--------------Boundary-00=_5M5Y166TK26OFEML4K2D--