mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Revert couple of changes from 1.51 and 1.52. Reading link status with 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)
This commit is contained in:
parent
6c655efcaf
commit
9239bab2fe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167728
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user