summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/cavium/octe/octe.c12
-rw-r--r--sys/mips/rmi/dev/nlge/if_nlge.c10
2 files changed, 12 insertions, 10 deletions
diff --git a/sys/mips/cavium/octe/octe.c b/sys/mips/cavium/octe/octe.c
index 2e05734..daccb36 100644
--- a/sys/mips/cavium/octe/octe.c
+++ b/sys/mips/cavium/octe/octe.c
@@ -157,10 +157,11 @@ octe_attach(device_t dev)
if (priv->phy_id != -1) {
if (priv->phy_device == NULL) {
- error = mii_phy_probe(dev, &priv->miibus, octe_mii_medchange,
- octe_mii_medstat);
+ error = mii_attach(dev, &priv->miibus, ifp,
+ octe_mii_medchange, octe_mii_medstat,
+ BMSR_DEFCAPMASK, priv->phy_id, MII_OFFSET_ANY, 0);
if (error != 0)
- device_printf(dev, "missing phy %u\n", priv->phy_id);
+ device_printf(dev, "attaching PHYs failed\n");
} else {
child = device_add_child(dev, priv->phy_device, -1);
if (child == NULL)
@@ -239,9 +240,8 @@ octe_miibus_readreg(device_t dev, int phy, int reg)
/*
* Try generic MII routine.
*/
- if (phy != priv->phy_id)
- return (0);
-
+ KASSERT(phy == priv->phy_id,
+ ("read from phy %u but our phy is %u", phy, priv->phy_id));
return (cvm_oct_mdio_read(priv->ifp, phy, reg));
}
diff --git a/sys/mips/rmi/dev/nlge/if_nlge.c b/sys/mips/rmi/dev/nlge/if_nlge.c
index 6688422..6495e4b 100644
--- a/sys/mips/rmi/dev/nlge/if_nlge.c
+++ b/sys/mips/rmi/dev/nlge/if_nlge.c
@@ -848,7 +848,7 @@ nlge_mii_write(struct device *dev, int phyaddr, int regidx, int regval)
struct nlge_softc *sc;
sc = device_get_softc(dev);
- if (sc->phy_addr == phyaddr && sc->port_type != XLR_XGMII)
+ if (sc->port_type != XLR_XGMII)
nlge_mii_write_internal(sc->mii_base, phyaddr, regidx, regval);
return (0);
@@ -861,7 +861,7 @@ nlge_mii_read(struct device *dev, int phyaddr, int regidx)
int val;
sc = device_get_softc(dev);
- val = (sc->phy_addr != phyaddr && sc->port_type != XLR_XGMII) ? (0xffff) :
+ val = (sc->port_type != XLR_XGMII) ? (0xffff) :
nlge_mii_read_internal(sc->mii_base, phyaddr, regidx);
return (val);
@@ -1907,9 +1907,11 @@ nlge_mii_init(device_t dev, struct nlge_softc *sc)
if (sc->port_type != XLR_XAUI && sc->port_type != XLR_XGMII) {
NLGE_WRITE(sc->mii_base, R_MII_MGMT_CONFIG, 0x07);
}
- error = mii_phy_probe(dev, &sc->mii_bus, nlge_mediachange, nlge_mediastatus);
+ error = mii_attach(dev, &sc->mii_bus, sc->nlge_if, nlge_mediachange,
+ nlge_mediastatus, BMSR_DEFCAPMASK, sc->phy_addr, MII_OFFSET_ANY,
+ 0);
if (error) {
- device_printf(dev, "no PHY device found\n");
+ device_printf(dev, "attaching PHYs failed\n");
sc->mii_bus = NULL;
}
if (sc->mii_bus != NULL) {
OpenPOWER on IntegriCloud