Converted the remainder of the NIC drivers to use the mii_attach()

introduced in r213878 instead of mii_phy_probe(). Unlike r213893 these
are only straight forward conversions though.

Reviewed by:	yongari
This commit is contained in:
Marius Strobl 2010-10-15 15:00:30 +00:00
parent 8e5d93dbb4
commit d6c65d276e
19 changed files with 89 additions and 83 deletions

View File

@ -318,9 +318,11 @@ ate_attach(device_t dev)
}
sc->ifp = ifp = if_alloc(IFT_ETHER);
if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) {
err = mii_attach(dev, &sc->miibus, ifp, ate_ifmedia_upd,
ate_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
device_printf(dev, "Cannot find my PHY.\n");
err = ENXIO;
if (err != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto out;
}
/*

View File

@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$");
#include <arm/at91/if_macbvar.h>
#include <arm/at91/at91_piovar.h>
#include <arm/at91/at91_pio_sam9.h>
#include <arm/at91/at91sam9g20reg.h>
#include <machine/bus.h>
@ -1365,9 +1364,10 @@ macb_attach(device_t dev)
write_4(sc, EMAC_NCR, MPE_ENABLE); //enable MPE
sc->ifp = ifp = if_alloc(IFT_ETHER);
if (mii_phy_probe(dev, &sc->miibus, macb_ifmedia_upd, macb_ifmedia_sts)) {
device_printf(dev, "Cannot find my PHY.\n");
err = ENXIO;
err = mii_attach(dev, &sc->miibus, ifp, macb_ifmedia_upd,
macb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (err != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto out;
}

View File

@ -1140,12 +1140,13 @@ bce_attach(device_t dev)
/* Handle any special PHY initialization for SerDes PHYs. */
bce_init_media(sc);
/* MII child bus by probing the PHY. */
if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd,
bce_ifmedia_sts)) {
BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n",
__FILE__, __LINE__);
rc = ENXIO;
/* MII child bus by attaching the PHY. */
rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd,
bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
MII_OFFSET_ANY, 0);
if (rc != 0) {
BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__,
__LINE__);
goto bce_attach_fail;
}

View File

@ -578,25 +578,21 @@ ed_pccard_attach(device_t dev)
goto bad;
if (sc->chip_type == ED_CHIP_TYPE_DL10019 ||
sc->chip_type == ED_CHIP_TYPE_DL10022) {
/* Probe for an MII bus, but ignore errors. */
/* Try to attach an MII bus, but ignore errors. */
ed_pccard_dl100xx_mii_reset(sc);
(void)mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
ed_ifmedia_sts);
(void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd,
ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
MII_OFFSET_ANY, 0);
} else if (sc->chip_type == ED_CHIP_TYPE_AX88190 ||
sc->chip_type == ED_CHIP_TYPE_AX88790) {
if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
ed_ifmedia_sts)) != 0) {
device_printf(dev, "Missing mii %d!\n", error);
sc->chip_type == ED_CHIP_TYPE_AX88790 ||
sc->chip_type == ED_CHIP_TYPE_TC5299J) {
error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd,
ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto bad;
}
} else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) {
if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
ed_ifmedia_sts)) != 0) {
device_printf(dev, "Missing mii!\n");
goto bad;
}
}
if (sc->miibus != NULL) {
sc->sc_tick = ed_pccard_tick;

View File

@ -63,8 +63,8 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
#include <dev/mii/truephyreg.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@ -343,10 +343,10 @@ et_attach(device_t dev)
et_chip_attach(sc);
error = mii_phy_probe(dev, &sc->sc_miibus,
et_ifmedia_upd, et_ifmedia_sts);
error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd,
et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error) {
device_printf(dev, "can't probe any PHY\n");
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}

View File

@ -557,10 +557,10 @@ lge_attach(dev)
/*
* Do MII setup.
*/
if (mii_phy_probe(dev, &sc->lge_miibus,
lge_ifmedia_upd, lge_ifmedia_sts)) {
device_printf(dev, "MII without any PHY!\n");
error = ENXIO;
error = mii_attach(dev, &sc->lge_miibus, ifp, lge_ifmedia_upd,
lge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}

View File

@ -600,10 +600,10 @@ nfe_attach(device_t dev)
#endif
/* Do MII setup */
if (mii_phy_probe(dev, &sc->nfe_miibus, nfe_ifmedia_upd,
nfe_ifmedia_sts)) {
device_printf(dev, "MII without any phy!\n");
error = ENXIO;
error = mii_attach(dev, &sc->nfe_miibus, ifp, nfe_ifmedia_upd,
nfe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
ether_ifattach(ifp, sc->eaddr);

View File

@ -1079,10 +1079,10 @@ nge_attach(device_t dev)
/*
* Do MII setup.
*/
error = mii_phy_probe(dev, &sc->nge_miibus, nge_mediachange,
nge_mediastatus);
error = mii_attach(dev, &sc->nge_miibus, ifp, nge_mediachange,
nge_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "no PHY found!\n");
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}

View File

@ -541,11 +541,12 @@ nve_attach(device_t dev)
ifp->if_capabilities |= IFCAP_VLAN_MTU;
ifp->if_capenable |= IFCAP_VLAN_MTU;
/* Probe device for MII interface to PHY */
DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_phy_probe\n");
if (mii_phy_probe(dev, &sc->miibus, nve_ifmedia_upd, nve_ifmedia_sts)) {
device_printf(dev, "MII without any phy!\n");
error = ENXIO;
/* Attach device for MII interface to PHY */
DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_attach\n");
error = mii_attach(dev, &sc->miibus, ifp, nve_ifmedia_upd,
nve_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
@ -553,10 +554,10 @@ nve_attach(device_t dev)
ether_ifattach(ifp, eaddr);
/* Activate our interrupt handler. - attach last to avoid lock */
error = bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
NULL, nve_intr, sc, &sc->sc_ih);
if (error) {
device_printf(sc->dev, "couldn't set up interrupt handler\n");
device_printf(dev, "couldn't set up interrupt handler\n");
goto fail;
}
DEBUGOUT(NVE_DEBUG_INIT, "nve: nve_attach - exit\n");

View File

@ -866,10 +866,10 @@ sf_attach(device_t dev)
}
/* Do MII setup. */
if (mii_phy_probe(dev, &sc->sf_miibus, sf_ifmedia_upd,
sf_ifmedia_sts)) {
device_printf(dev, "MII without any phy!\n");
error = ENXIO;
error = mii_attach(dev, &sc->sf_miibus, ifp, sf_ifmedia_upd,
sf_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}

View File

@ -627,10 +627,10 @@ sge_attach(device_t dev)
/*
* Do MII setup.
*/
if (mii_phy_probe(dev, &sc->sge_miibus, sge_ifmedia_upd,
sge_ifmedia_sts)) {
device_printf(dev, "no PHY found!\n");
error = ENXIO;
error = mii_attach(dev, &sc->sge_miibus, ifp, sge_ifmedia_upd,
sge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}

View File

@ -1164,10 +1164,10 @@ sis_attach(device_t dev)
/*
* Do MII setup.
*/
if (mii_phy_probe(dev, &sc->sis_miibus,
sis_ifmedia_upd, sis_ifmedia_sts)) {
device_printf(dev, "MII without any PHY!\n");
error = ENXIO;
error = mii_attach(dev, &sc->sis_miibus, ifp, sis_ifmedia_upd,
sis_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}

View File

@ -324,8 +324,9 @@ smc_attach(device_t dev)
callout_init_mtx(&sc->smc_mii_tick_ch, &sc->smc_mtx,
CALLOUT_RETURNUNLOCKED);
if (sc->smc_chip >= REV_CHIP_91110FD) {
mii_phy_probe(dev, &sc->smc_miibus, smc_mii_ifmedia_upd,
smc_mii_ifmedia_sts);
(void)mii_attach(dev, &sc->smc_miibus, ifp,
smc_mii_ifmedia_upd, smc_mii_ifmedia_sts, BMSR_DEFCAPMASK,
MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (sc->smc_miibus != NULL) {
sc->smc_mii_tick = smc_mii_tick;
sc->smc_mii_mediachg = smc_mii_mediachg;

View File

@ -1276,9 +1276,11 @@ tl_attach(dev)
* Do MII setup. If no PHYs are found, then this is a
* bitrate ThunderLAN chip that only supports 10baseT
* and AUI/BNC.
* XXX mii_attach() can fail for reason different than
* no PHYs found!
*/
if (mii_phy_probe(dev, &sc->tl_miibus,
tl_ifmedia_upd, tl_ifmedia_sts)) {
if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd,
tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) {
struct ifmedia *ifm;
sc->tl_bitrate = 1;
ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts);

View File

@ -379,10 +379,10 @@ epic_attach(device_t dev)
device_printf(dev, "unknown card vendor %04xh\n", sc->cardvend);
/* Do ifmedia setup. */
if (mii_phy_probe(dev, &sc->miibus,
epic_ifmedia_upd, epic_ifmedia_sts)) {
device_printf(dev, "ERROR! MII without any PHY!?\n");
error = ENXIO;
error = mii_attach(dev, &sc->miibus, ifp, epic_ifmedia_upd,
epic_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}

View File

@ -222,11 +222,12 @@ ue_attach_post_task(struct usb_proc_msg *_task)
if (ue->ue_methods->ue_mii_upd != NULL &&
ue->ue_methods->ue_mii_sts != NULL) {
mtx_lock(&Giant); /* device_xxx() depends on this */
error = mii_phy_probe(ue->ue_dev, &ue->ue_miibus,
ue_ifmedia_upd, ue->ue_methods->ue_mii_sts);
error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp,
ue_ifmedia_upd, ue->ue_methods->ue_mii_sts,
BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
mtx_unlock(&Giant);
if (error) {
device_printf(ue->ue_dev, "MII without any PHY\n");
device_printf(ue->ue_dev, "attaching PHYs failed\n");
goto error;
}
}

View File

@ -855,9 +855,10 @@ wb_attach(dev)
/*
* Do MII setup.
*/
if (mii_phy_probe(dev, &sc->wb_miibus,
wb_ifmedia_upd, wb_ifmedia_sts)) {
error = ENXIO;
error = mii_attach(dev, &sc->wb_miibus, ifp, wb_ifmedia_upd,
wb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}

View File

@ -424,10 +424,11 @@ arge_attach(device_t dev)
if (phys_total == 1) {
/* Do MII setup. */
if (mii_phy_probe(dev, &sc->arge_miibus,
arge_ifmedia_upd, arge_ifmedia_sts)) {
device_printf(dev, "MII without any phy!\n");
error = ENXIO;
error = mii_attach(dev, &sc->arge_miibus, ifp,
arge_ifmedia_upd, arge_ifmedia_sts, BMSR_DEFCAPMASK,
MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
}

View File

@ -265,10 +265,10 @@ kr_attach(device_t dev)
CSR_WRITE_4(sc, KR_MIIMCFG, 0);
/* Do MII setup. */
if (mii_phy_probe(dev, &sc->kr_miibus,
kr_ifmedia_upd, kr_ifmedia_sts)) {
device_printf(dev, "MII without any phy!\n");
error = ENXIO;
error = mii_attach(dev, &sc->kr_miibus, ifp, kr_ifmedia_upd,
kr_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
}