[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-tech
Subject:    if_sis(DP83815) short cable patch
From:       Willem Dijkstra <wpd () xs4all ! nl>
Date:       2003-02-27 7:09:16
[Download RAW message or body]

Hi All,

I ported the NatSemi patch for the short cable problem in some DP83815's to
OpenBSD. Most of the registers that are written to are reported to be
"reserved", so it would be nice if people experiencing this problem could try
this out.

(The DP83815 is used on the Soekris boards).

Cheers,

Willem

diff -ruN orig/dev/pci/if_sis.c sys/dev/pci/if_sis.c
--- orig/dev/pci/if_sis.c	Fri Jan  3 05:14:43 2003
+++ sys/dev/pci/if_sis.c	Fri Jan  3 04:58:39 2003
@@ -1445,6 +1445,7 @@
 	struct ifnet		*ifp = &sc->arpcom.ac_if;
 	struct mii_data		*mii;
 	int			s;
+	int                     tmp;
 
 	s = splnet();
 
@@ -1588,6 +1589,32 @@
 		CSR_WRITE_4(sc, NS_PHY_TDATA, 0x0000);
 		CSR_WRITE_4(sc, NS_PHY_DSPCFG, 0x5040);
 		CSR_WRITE_4(sc, NS_PHY_SDCFG, 0x008C);
+		
+		/* 
+		 * A small number of DP83815's will have excessive receive
+		 * errors when using short cables (<30m/100feet) in 100Base-TX
+		 * mode. This patch was taken from the National Semiconductor
+		 * linux driver and (supposedly - no mention of this in any NS
+		 * docs) modifies the dsp's signal attenuation.
+		 */
+		if (IFM_SUBTYPE(mii->mii_media_active) != IFM_10_T) {
+			CSR_WRITE_4(sc, NS_PHY_PAGE, 0x0001);
+			tmp = CSR_READ_4(sc, NS_PHY_DSPCFG);
+			tmp &= 0xFFF;
+			CSR_WRITE_4(sc, NS_PHY_DSPCFG, (tmp | 0x1000));
+			DELAY(100);
+			tmp = CSR_READ_4(sc, NS_PHY_TDATA);
+			tmp &= 0xFF;
+			if (!(tmp & 0x80) || (tmp >= 0xD8)) {
+				printf("sis%d: short cable detected - changing dsp attenuation", 
+				       sc->unit);
+				CSR_WRITE_4(sc, NS_PHY_TDATA, 0xE8);
+				tmp = CSR_READ_4(sc, DP_PHY_DSPCFG);
+				CSR_WRITE_4(sc, NS_PHY_DSPCFG, (tmp | 0x20));
+			} else {
+				CSR_WRITE_4(sc, NS_PHY_PAGE, 0);
+			}
+		}
 	}
 
 	ifp->if_flags |= IFF_RUNNING;

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic