mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-27 08:14:35 +08:00
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: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
2fc9f69edd
commit
70dcf3cdc3
@ -2303,8 +2303,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id,
|
||||
if (mdio_phy_id_is_c45(phy_id)) {
|
||||
prtad = mdio_phy_id_prtad(phy_id);
|
||||
devad = mdio_phy_id_devad(phy_id);
|
||||
devad = mdiobus_c45_addr(devad, reg);
|
||||
} else if (phydev->is_c45) {
|
||||
return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad,
|
||||
reg);
|
||||
}
|
||||
|
||||
if (phydev->is_c45) {
|
||||
switch (reg) {
|
||||
case MII_BMCR:
|
||||
case MII_BMSR:
|
||||
@ -2326,12 +2329,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id,
|
||||
return -EINVAL;
|
||||
}
|
||||
prtad = phy_id;
|
||||
devad = mdiobus_c45_addr(devad, reg);
|
||||
} else {
|
||||
prtad = phy_id;
|
||||
devad = reg;
|
||||
return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, 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,
|
||||
@ -2343,8 +2345,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
|
||||
if (mdio_phy_id_is_c45(phy_id)) {
|
||||
prtad = mdio_phy_id_prtad(phy_id);
|
||||
devad = mdio_phy_id_devad(phy_id);
|
||||
devad = mdiobus_c45_addr(devad, reg);
|
||||
} else if (phydev->is_c45) {
|
||||
return mdiobus_c45_write(pl->phydev->mdio.bus, prtad, devad,
|
||||
reg, val);
|
||||
}
|
||||
|
||||
if (phydev->is_c45) {
|
||||
switch (reg) {
|
||||
case MII_BMCR:
|
||||
case MII_BMSR:
|
||||
@ -2365,14 +2370,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id,
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
prtad = phy_id;
|
||||
devad = mdiobus_c45_addr(devad, reg);
|
||||
} else {
|
||||
prtad = phy_id;
|
||||
devad = reg;
|
||||
return mdiobus_c45_write(pl->phydev->mdio.bus, phy_id, devad,
|
||||
reg, val);
|
||||
}
|
||||
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user