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: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Andrew Lunn 2022-04-30 19:30:34 +02:00 committed by Paolo Abeni
parent 70dcf3cdc3
commit 260bdfea87
1 changed files with 11 additions and 7 deletions

View File

@ -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)) {
prtad = mdio_phy_id_prtad(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 {
prtad = mii_data->phy_id;
devad = mii_data->reg_num;
mii_data->val_out = mdiobus_read(
phydev->mdio.bus, mii_data->phy_id,
mii_data->reg_num);
}
mii_data->val_out = mdiobus_read(phydev->mdio.bus, prtad,
devad);
return 0;
case SIOCSMIIREG:
if (mdio_phy_id_is_c45(mii_data->phy_id)) {
prtad = mdio_phy_id_prtad(mii_data->phy_id);
devad = mdio_phy_id_devad(mii_data->phy_id);
devad = mdiobus_c45_addr(devad, mii_data->reg_num);
} else {
prtad = mii_data->phy_id;
devad = mii_data->reg_num;
@ -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 &&
devad == MII_BMCR &&