Skip to content

Commit

Permalink
Revert couple of changes from 1.51 and 1.52. Reading link status with…
Browse files Browse the repository at this point in the history
… BMSR

is okay for most of the chipsets but BCM5701 PHY does not seem to like it.
Set media to IFM_NONE if link is not up instead of the previous value.

Reported by:	Goran Lowkrantz (goran dot lowkrantz at ismobile dot com)
  • Loading branch information
juikim committed Mar 19, 2007
1 parent 260775b commit a8db64a
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions sys/dev/mii/brgphy.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ brgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
* Check to see if we have link. If we do, we don't
* need to restart the autonegotiation process.
*/
if (PHY_READ(sc, BRGPHY_MII_BMSR) & BRGPHY_BMSR_LINK) {
if (PHY_READ(sc, BRGPHY_MII_AUXSTS) & BRGPHY_AUXSTS_LINK) {
sc->mii_ticks = 0; /* Reset autoneg timer. */
break;
}
Expand Down Expand Up @@ -416,32 +416,30 @@ static void
brgphy_status(struct mii_softc *sc)
{
struct mii_data *mii = sc->mii_pdata;
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
int bmcr, bmsr;
int aux, bmcr, bmsr;

mii->mii_media_status = IFM_AVALID;
mii->mii_media_active = IFM_ETHER;

aux = PHY_READ(sc, BRGPHY_MII_AUXSTS);
bmcr = PHY_READ(sc, BRGPHY_MII_BMCR);
bmsr = PHY_READ(sc, BRGPHY_MII_BMSR);

if (bmsr & BRGPHY_BMSR_LINK)
if (aux & BRGPHY_AUXSTS_LINK)
mii->mii_media_status |= IFM_ACTIVE;

if (bmcr & BRGPHY_BMCR_LOOP)
mii->mii_media_active |= IFM_LOOP;

if (bmcr & BRGPHY_BMCR_AUTOEN) {
if ((bmsr & BRGPHY_BMSR_ACOMP) == 0) {
/* Erg, still trying, I guess... */
mii->mii_media_active |= IFM_NONE;
return;
}
if ((bmcr & BRGPHY_BMCR_AUTOEN) &&
(bmsr & BRGPHY_BMSR_ACOMP) == 0) {
/* Erg, still trying, I guess... */
mii->mii_media_active |= IFM_NONE;
return;
}

if (bmsr & BRGPHY_BMSR_LINK) {
switch (PHY_READ(sc, BRGPHY_MII_AUXSTS) &
BRGPHY_AUXSTS_AN_RES) {
if (aux & BRGPHY_AUXSTS_LINK) {
switch (aux & BRGPHY_AUXSTS_AN_RES) {
case BRGPHY_RES_1000FD:
mii->mii_media_active |= IFM_1000_T | IFM_FDX;
break;
Expand All @@ -468,7 +466,7 @@ brgphy_status(struct mii_softc *sc)
break;
}
} else
mii->mii_media_active = ife->ifm_media;
mii->mii_media_active |= IFM_NONE;
}

static int
Expand Down

0 comments on commit a8db64a

Please sign in to comment.