Commit 260bdfea authored by Andrew Lunn's avatar Andrew Lunn Committed by Paolo Abeni

net: phy: 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 70dcf3cd
...@@ -295,20 +295,20 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) ...@@ -295,20 +295,20 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
if (mdio_phy_id_is_c45(mii_data->phy_id)) { if (mdio_phy_id_is_c45(mii_data->phy_id)) {
prtad = mdio_phy_id_prtad(mii_data->phy_id); prtad = mdio_phy_id_prtad(mii_data->phy_id);
devad = mdio_phy_id_devad(mii_data->phy_id); devad = mdio_phy_id_devad(mii_data->phy_id);
devad = mdiobus_c45_addr(devad, mii_data->reg_num); mii_data->val_out = mdiobus_c45_read(
phydev->mdio.bus, prtad, devad,
mii_data->reg_num);
} else { } else {
prtad = mii_data->phy_id; mii_data->val_out = mdiobus_read(
devad = mii_data->reg_num; phydev->mdio.bus, mii_data->phy_id,
mii_data->reg_num);
} }
mii_data->val_out = mdiobus_read(phydev->mdio.bus, prtad,
devad);
return 0; return 0;
case SIOCSMIIREG: case SIOCSMIIREG:
if (mdio_phy_id_is_c45(mii_data->phy_id)) { if (mdio_phy_id_is_c45(mii_data->phy_id)) {
prtad = mdio_phy_id_prtad(mii_data->phy_id); prtad = mdio_phy_id_prtad(mii_data->phy_id);
devad = mdio_phy_id_devad(mii_data->phy_id); devad = mdio_phy_id_devad(mii_data->phy_id);
devad = mdiobus_c45_addr(devad, mii_data->reg_num);
} else { } else {
prtad = mii_data->phy_id; prtad = mii_data->phy_id;
devad = mii_data->reg_num; devad = mii_data->reg_num;
...@@ -351,7 +351,11 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) ...@@ -351,7 +351,11 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
} }
} }
mdiobus_write(phydev->mdio.bus, prtad, devad, val); if (mdio_phy_id_is_c45(mii_data->phy_id))
mdiobus_c45_write(phydev->mdio.bus, prtad, devad,
mii_data->reg_num, val);
else
mdiobus_write(phydev->mdio.bus, prtad, devad, val);
if (prtad == phydev->mdio.addr && if (prtad == phydev->mdio.addr &&
devad == MII_BMCR && devad == MII_BMCR &&
......
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