Skip to contentSkip to conversation

2.4.4-ac8 doesn't work with Lite-On 82c168 PNIC rev 32

DISCUSSION H . J . Lu 2 participants 3 messages May 11, 2001 – May 12, 2001

Subsystems (2)
lore
Share & tools
lore

H . J . Lu

author
#0 lore raw

The tulip driver in 2.4.4-ac8 doesn't work with Lite-On 82c168 PNIC rev 32 in the NetGear FA310TX REV-D2. It sends BOOTP request and times out.

H.J.

#1 lore raw

Does this patch, against ac8, help with the PNIC problem?

Signature · 3 lines
Jeff Garzik      | Game called on account of naked chick
Building 1024    |
MandrakeSoft     |

Index: drivers/net/tulip/media.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/tulip/media.c,v retrieving revision 1.1.1.30

net/tulip/media.c +5 -3
diff -u -r1.1.1.30 media.c
@@ -255,7 +255,7 @@
 		case 1: case 3: {
 			int phy_num = p[0];
 			int init_length = p[1];
-			u16 *misc_info;
+			u16 *misc_info, tmp_info;
 
 			dev->if_port = 11;
 			new_csr6 = 0x020E0000;
@@ -282,8 +282,10 @@
 				for (i = 0; i < init_length; i++)
 					outl(init_sequence[i], ioaddr + CSR12);
 			}
-			tp->advertising[phy_num] = get_u16(&misc_info[1]) | 1;
-			if (startup < 2) {
+			tmp_info = get_u16(&misc_info[1]);
+			if (tmp_info)
+				tp->advertising[phy_num] = tmp_info | 1;
+			if (tmp_info && startup < 2) {
 				if (tp->mii_advertise == 0)
 					tp->mii_advertise = tp->advertising[phy_num];
 				if (tulip_debug > 1)

Index: drivers/net/tulip/tulip_core.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/tulip/tulip_core.c,v retrieving revision 1.1.1.43

net/tulip/tulip_core.c +26 -5
diff -u -r1.1.1.43 tulip_core.c
@@ -20,10 +20,11 @@
 #include <linux/init.h>
 #include <linux/etherdevice.h>
 #include <linux/delay.h>
+#include <linux/mii.h>
 #include <asm/unaligned.h>
 
 static char version[] __devinitdata =
-	"Linux Tulip driver version 0.9.14f (May 10, 2001)\n";
+	"Linux Tulip driver version 0.9.15cvs (April XX, 2001)\n";
 
 
 /* A few user-configurable values. */
@@ -1434,7 +1435,7 @@
 				((mii_status & 0x8000) == 0  && (mii_status & 0x7800) != 0)) {
 				int mii_reg0 = tulip_mdio_read(dev, phy, 0);
 				int mii_advert = tulip_mdio_read(dev, phy, 4);
-				int to_advert;
+				unsigned int to_advert, new_bmcr;
 
 				if (tp->mii_advertise)
 					to_advert = tp->mii_advertise;
@@ -1455,10 +1456,30 @@
 						   board_idx, to_advert, phy, mii_advert);
 					tulip_mdio_write(dev, phy, 4, to_advert);
 				}
+
 				/* Enable autonegotiation: some boards default to off. */
-				tulip_mdio_write(dev, phy, 0, mii_reg0 |
-						   (tp->full_duplex ? 0x1100 : 0x1000) |
-						   (tulip_media_cap[tp->default_port]&MediaIs100 ? 0x2000:0));
+				if (tp->default_port == 0) {
+					new_bmcr = mii_reg0 | BMCR_ANENABLE;
+					if (new_bmcr != mii_reg0)
+						new_bmcr |= BMCR_ANRESTART;
+				}
+				/* ...or disable nway, if forcing media */
+				else
+					new_bmcr = mii_reg0 & ~BMCR_ANENABLE;
+
+				if (new_bmcr != mii_reg0)
+					tulip_mdio_write(dev, phy, MII_BMCR, new_bmcr);
+
+				if (tp->full_duplex) new_bmcr |= BMCR_FULLDPLX;
+				else		     new_bmcr &= ~BMCR_FULLDPLX;
+				if (tulip_media_cap[tp->default_port] & MediaIs100)
+					new_bmcr |= BMCR_SPEED100;
+				else    new_bmcr &= ~BMCR_SPEED100;
+
+				if (new_bmcr != mii_reg0) {
+					udelay(10);
+					tulip_mdio_write(dev, phy, MII_BMCR, new_bmcr);
+				}
 			}
 		}
 		tp->mii_cnt = phy_idx;
#2 lore raw
In reply to H . J . Lu

Here's another patch to try, for PNIC. Feedback welcome.

Signature · 3 lines
Jeff Garzik      | Game called on account of naked chick
Building 1024    |
MandrakeSoft     |
drivers/net/tulip/media.c +1 -3
diff -ur 2.4/drivers/net/tulip/media.c build-2.4/drivers/net/tulip/media.c
@@ -409,8 +409,6 @@
 	struct tulip_private *tp = dev->priv;
 	unsigned int bmsr, lpa, negotiated, new_csr6;
 
-	if (tp->full_duplex_lock)
-		return 0;
 	bmsr = tulip_mdio_read(dev, tp->phys[0], MII_BMSR);
 	lpa = tulip_mdio_read(dev, tp->phys[0], MII_LPA);
 	if (tulip_debug > 1)
@@ -428,7 +426,7 @@
 		}
 	}
 	negotiated = lpa & tp->advertising[0];
-	tp->full_duplex = (mii_nway_result(negotiated) & LPA_DUPLEX) ? 1 : 0;
+	tp->full_duplex = tp->full_duplex_lock | (mii_nway_result(negotiated) & LPA_DUPLEX) ? 1 : 0;
 
 	new_csr6 = tp->csr6;