Analogous to mii_add_media(), factor out the code for checking whether
the BMSR contains any media at all to mii_phy_add_media(). The majority of the drivers currently using mii_phy_add_media() were missing such a check anyway though. MFC after: 2 weeks
This commit is contained in:
parent
0c3e319244
commit
9475e904d6
@ -182,11 +182,7 @@ bmtphy_attach(device_t dev)
|
||||
sc->mii_capabilities =
|
||||
PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
|
||||
device_printf(dev, " ");
|
||||
if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
|
||||
printf("no media present");
|
||||
else
|
||||
mii_phy_add_media(sc);
|
||||
|
||||
mii_phy_add_media(sc);
|
||||
printf("\n");
|
||||
|
||||
MIIBUS_MEDIAINIT(sc->mii_dev);
|
||||
|
@ -198,11 +198,7 @@ gentbi_attach(device_t dev)
|
||||
sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
|
||||
|
||||
device_printf(dev, " ");
|
||||
if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 &&
|
||||
(sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0)
|
||||
printf("no media present");
|
||||
else
|
||||
mii_phy_add_media(sc);
|
||||
mii_phy_add_media(sc);
|
||||
printf("\n");
|
||||
|
||||
return (0);
|
||||
|
@ -417,6 +417,12 @@ mii_phy_add_media(struct mii_softc *sc)
|
||||
struct mii_data *mii = sc->mii_pdata;
|
||||
const char *sep = "";
|
||||
|
||||
if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 &&
|
||||
(sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) {
|
||||
printf("no media present");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set aneg timer for 10/100 media. Gigabit media handled below. */
|
||||
sc->mii_anegticks = MII_ANEGTICKS;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user