Subject: wm+makphy
To: None <current-users@netbsd.org>
From: SAITOH Masanobu <masanobu@iij.ad.jp>
List: current-users
Date: 02/20/2007 18:45:35
 Please test following patch if you have any trouble with wm (and/or makphy).

e.g. i82573

 Regards.
 

Index: mii/makphy.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mii/makphy.c,v
retrieving revision 1.22
diff -u -r1.22 makphy.c
--- mii/makphy.c	16 Nov 2006 21:24:07 -0000	1.22
+++ mii/makphy.c	20 Feb 2007 09:42:03 -0000
@@ -97,9 +97,10 @@
 
 static int	makphy_service(struct mii_softc *, struct mii_data *, int);
 static void	makphy_status(struct mii_softc *);
+static void	makphy_reset(struct mii_softc *);
 
 static const struct mii_phy_funcs makphy_funcs = {
-	makphy_service, makphy_status, mii_phy_reset,
+	makphy_service, makphy_status, makphy_reset,
 };
 
 static const struct mii_phydesc makphys[] = {
@@ -166,6 +167,18 @@
 	aprint_normal("\n");
 }
 
+static void
+makphy_reset(struct mii_softc *sc)
+{
+	uint16_t pscr;
+
+	/* Assert CRS on transmit */
+	pscr = PHY_READ(sc, MII_MAKPHY_PSCR);
+	PHY_WRITE(sc, MII_MAKPHY_PSCR, pscr | PSCR_CRS_ON_TX);
+
+	mii_phy_reset(sc);
+}
+
 static int
 makphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
 {
Index: pci/if_wm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.131
diff -u -r1.131 if_wm.c
--- pci/if_wm.c	23 Nov 2006 19:42:59 -0000	1.131
+++ pci/if_wm.c	20 Feb 2007 09:42:05 -0000
@@ -4038,7 +4038,7 @@
 	 * XXXbouyer - I'm not sure this is right for the 80003,
 	 * the em driver only sets CTRL_SLU here - but it seems to work.
 	 */
-	sc->sc_ctrl |= CTRL_SLU | CTRL_ASDE;
+	sc->sc_ctrl |= CTRL_SLU;
 	CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
 
 	/* Initialize our media structures and probe the GMII. */
@@ -4101,7 +4101,7 @@
 		sc->sc_ctrl &= ~(CTRL_SPEED_MASK | CTRL_FD);
 		sc->sc_ctrl |= CTRL_SLU;
 		if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
-			sc->sc_ctrl |= CTRL_ASDE;
+			sc->sc_ctrl &= ~(CTRL_FRCSPD | CTRL_FRCFDX);
 		} else {
 			sc->sc_ctrl &= ~CTRL_ASDE;
 			sc->sc_ctrl |= CTRL_FRCSPD | CTRL_FRCFDX;


----------------------------------------------------------
		SAITOH Masanobu (masanobu@iij.ad.jp
				  msaitoh@netbsd.org)