-/* $OpenBSD: eephy.c,v 1.51 2013/12/08 15:53:01 deraadt Exp $ */
+/* $OpenBSD: eephy.c,v 1.52 2013/12/28 03:28:45 deraadt Exp $ */
/*
* Principal Author: Parag Patel
* Copyright (c) 2001
int eephy_match(struct device *, void *, void *);
void eephy_attach(struct device *, struct device *, void *);
-int eephy_activate(struct device *, int);
struct cfattach eephy_ca = {
- sizeof (struct mii_softc), eephy_match, eephy_attach,
- mii_phy_detach, eephy_activate
+ sizeof (struct mii_softc), eephy_match, eephy_attach, mii_phy_detach
};
struct cfdriver eephy_cd = {
NULL, "eephy", DV_DULL
};
-void eephy_init(struct mii_softc *);
int eephy_service(struct mii_softc *, struct mii_data *, int);
void eephy_status(struct mii_softc *);
void eephy_reset(struct mii_softc *);
mii_phy_add_media(sc);
- eephy_init(sc);
}
-int
-eephy_activate(struct device *self, int act)
+void
+eephy_reset(struct mii_softc *sc)
{
- struct mii_softc *sc = (void *)self;
+ int reg, i;
- switch (act) {
- case DVACT_RESUME:
- eephy_init(sc);
- break;
+ reg = PHY_READ(sc, E1000_CR);
+ reg |= E1000_CR_RESET;
+ PHY_WRITE(sc, E1000_CR, reg);
+
+ for (i = 0; i < 500; i++) {
+ DELAY(1);
+ reg = PHY_READ(sc, E1000_CR);
+ if (!(reg & E1000_CR_RESET))
+ break;
}
- return (0);
-}
-
-void
-eephy_init(struct mii_softc *sc)
-{
- int reg;
-
/*
* Initialize PHY Specific Control Register.
*/
-
reg = PHY_READ(sc, E1000_SCR);
/* Assert CRS on transmit. */
PHY_WRITE(sc, E1000_CR, reg | E1000_CR_RESET);
}
-void
-eephy_reset(struct mii_softc *sc)
-{
- int reg, i;
-
- reg = PHY_READ(sc, E1000_CR);
- reg |= E1000_CR_RESET;
- PHY_WRITE(sc, E1000_CR, reg);
-
- for (i = 0; i < 500; i++) {
- DELAY(1);
- reg = PHY_READ(sc, E1000_CR);
- if (!(reg & E1000_CR_RESET))
- break;
- }
-}
-
int
eephy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{