Subject: Re: wm+makphy
To: None <martin@duskware.de>
From: SAITOH Masanobu <masanobu@iij.ad.jp>
List: current-users
Date: 02/22/2007 22:19:06
> On Wed, Feb 21, 2007 at 12:33:35PM +0900, SAITOH Masanobu wrote:
> > #30906 ethernet medium not detected on wm0
>
> Unfortunatley this one is not fixed with the patch.
>
> Martin
It seems your wm is
(from PR#30906)
> wm0 at pci1 dev 2 function 0: Intel i82543GC 1000BASE-T Ethernet, rev. 2
I got an i82543GC card from a colleague in office and tested.
Additional patch:
Index: 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
--- if_wm.c 23 Nov 2006 19:42:59 -0000 1.131
+++ if_wm.c 22 Feb 2007 13:08:55 -0000
@@ -3992,6 +3992,15 @@
CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
delay(20000);
} else {
+ /*
+ * With 82543, we need to force speed and duplex on the MAC
+ * equal to what the PHY speed and duplex configuration is.
+ * In addition, we need to perform a hardware reset on the PHY
+ * to take it out of reset.
+ */
+ sc->sc_ctrl |= CTRL_FRCSPD | CTRL_FRCFDX;
+ CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
+
/* The PHY reset pin is active-low. */
reg = CSR_READ(sc, WMREG_CTRL_EXT);
reg &= ~((CTRL_EXT_SWDPIO_MASK << CTRL_EXT_SWDPIO_SHIFT) |
@@ -4002,7 +4011,7 @@
delay(10);
CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
- delay(10);
+ delay(10000);
CSR_WRITE(sc, WMREG_CTRL_EXT, reg | CTRL_EXT_SWDPIN(4));
delay(10);
@@ -4100,8 +4109,9 @@
if (ifp->if_flags & IFF_UP) {
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;
+ if ((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO)
+ || (sc->sc_type > WM_T_82543)){
+ sc->sc_ctrl &= ~(CTRL_FRCSPD | CTRL_FRCFDX);
} else {
sc->sc_ctrl &= ~CTRL_ASDE;
sc->sc_ctrl |= CTRL_FRCSPD | CTRL_FRCFDX;
@@ -4123,6 +4133,8 @@
}
}
CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
+ if (sc->sc_type <= WM_T_82543)
+ wm_gmii_reset(sc);
mii_mediachg(&sc->sc_mii);
}
return (0);
----------------------------------------------------------
SAITOH Masanobu (masanobu@iij.ad.jp
msaitoh@netbsd.org)