Commit 70dcf3cd authored by Andrew Lunn's avatar Andrew Lunn Committed by Paolo Abeni

net: phylink: Convert to mdiobus_c45_{read|write}

Stop using the helpers to construct a special phy address which
indicates C45. Instead use the C45 accessors, which will call the
busses C45 specific read/write API.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 2fc9f69e
...@@ -2303,8 +2303,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id, ...@@ -2303,8 +2303,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id,
if (mdio_phy_id_is_c45(phy_id)) { if (mdio_phy_id_is_c45(phy_id)) {
prtad = mdio_phy_id_prtad(phy_id); prtad = mdio_phy_id_prtad(phy_id);
devad = mdio_phy_id_devad(phy_id); devad = mdio_phy_id_devad(phy_id);
devad = mdiobus_c45_addr(devad, reg); return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad,
} else if (phydev->is_c45) { reg);
}
if (phydev->is_c45) {
switch (reg) { switch (reg) {
case MII_BMCR: case MII_BMCR:
case MII_BMSR: case MII_BMSR:
...@@ -2326,12 +2329,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id, ...@@ -2326,12 +2329,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id,
return -EINVAL; return -EINVAL;
} }
prtad = phy_id; prtad = phy_id;
devad = mdiobus_c45_addr(devad, reg); return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad,
} else { reg);
prtad = phy_id;
devad = reg;
} }
return mdiobus_read(pl->phydev->mdio.bus, prtad, devad);
return mdiobus_read(pl->phydev->mdio.bus, phy_id, reg);
} }
static int phylink_phy_write(struct phylink *pl, unsigned int phy_id, static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
...@@ -2343,8 +2345,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id, ...@@ -2343,8 +2345,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
if (mdio_phy_id_is_c45(phy_id)) { if (mdio_phy_id_is_c45(phy_id)) {
prtad = mdio_phy_id_prtad(phy_id); prtad = mdio_phy_id_prtad(phy_id);
devad = mdio_phy_id_devad(phy_id); devad = mdio_phy_id_devad(phy_id);
devad = mdiobus_c45_addr(devad, reg); return mdiobus_c45_write(pl->phydev->mdio.bus, prtad, devad,
} else if (phydev->is_c45) { reg, val);
}
if (phydev->is_c45) {
switch (reg) { switch (reg) {
case MII_BMCR: case MII_BMCR:
case MII_BMSR: case MII_BMSR:
...@@ -2365,14 +2370,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id, ...@@ -2365,14 +2370,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
default: default:
return -EINVAL; return -EINVAL;
} }
prtad = phy_id; return mdiobus_c45_write(pl->phydev->mdio.bus, phy_id, devad,
devad = mdiobus_c45_addr(devad, reg); reg, val);
} else {
prtad = phy_id;
devad = reg;
} }
return mdiobus_write(phydev->mdio.bus, prtad, devad, val); return mdiobus_write(phydev->mdio.bus, phy_id, reg, val);
} }
static int phylink_mii_read(struct phylink *pl, unsigned int phy_id, static int phylink_mii_read(struct phylink *pl, unsigned int phy_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment