Always call PHY_RESET upon attaching eephy(4) so as to do PHY initialization,
authorbrad <brad@openbsd.org>
Sat, 28 Dec 2013 20:32:16 +0000 (20:32 +0000)
committerbrad <brad@openbsd.org>
Sat, 28 Dec 2013 20:32:16 +0000 (20:32 +0000)
to match behavior before rev 1.52.

ok deraadt@

sys/dev/mii/eephy.c

index 5664b4c..f4c7c07 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: eephy.c,v 1.52 2013/12/28 03:28:45 deraadt Exp $      */
+/*     $OpenBSD: eephy.c,v 1.53 2013/12/28 20:32:16 brad Exp $ */
 /*
  * Principal Author: Parag Patel
  * Copyright (c) 2001
@@ -170,8 +170,6 @@ eephy_attach(struct device *parent, struct device *self, void *aux)
                if ((reg & E1000_ESSR_HWCFG_MODE) == E1000_ESSR_RGMII_COPPER) {
                        reg |= E1000_ESSR_DIS_FC;
                        PHY_WRITE(sc, E1000_ESSR, reg);
-
-                       PHY_RESET(sc);
                }
        }
 
@@ -185,10 +183,10 @@ eephy_attach(struct device *parent, struct device *self, void *aux)
                reg |= E1000_SCR_MODE_1000BX;
                PHY_WRITE(sc, E1000_SCR, reg);
                PHY_WRITE(sc, E1000_EADR, page);
-
-               PHY_RESET(sc);
        }
 
+       PHY_RESET(sc);
+
        sc->mii_capabilities = PHY_READ(sc, E1000_SR) & ma->mii_capmask;
        if (sc->mii_capabilities & BMSR_EXTSTAT)
                sc->mii_extcapabilities = PHY_READ(sc, E1000_ESR);