net: phy: move phy MMD accessors to phy-core.c

Move the phy_(read|write)__mmd() helpers out of line, they will become
our main MMD accessor functions, and so will be a little more complex.
This complexity doesn't belong in an inline function.  Also move the
_indirect variants as well to keep like functionality together.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Russell King
2017-03-21 16:36:37 +00:00
committed by David S. Miller
parent 2d72d5016f
commit 9860118b58
4 changed files with 138 additions and 104 deletions

View File

@@ -651,14 +651,7 @@ struct phy_fixup {
*
* Same rules as for phy_read();
*/
static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
{
if (!phydev->is_c45)
return -EOPNOTSUPP;
return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr,
MII_ADDR_C45 | (devad << 16) | (regnum & 0xffff));
}
int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
/**
* phy_read_mmd_indirect - reads data from the MMD registers
@@ -752,16 +745,7 @@ static inline bool phy_is_pseudo_fixed_link(struct phy_device *phydev)
*
* Same rules as for phy_write();
*/
static inline int phy_write_mmd(struct phy_device *phydev, int devad,
u32 regnum, u16 val)
{
if (!phydev->is_c45)
return -EOPNOTSUPP;
regnum = MII_ADDR_C45 | ((devad & 0x1f) << 16) | (regnum & 0xffff);
return mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, val);
}
int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
/**
* phy_write_mmd_indirect - writes data to the MMD registers