Commit 0ebecb26 authored by Sean Anderson's avatar Sean Anderson Committed by David S. Miller

net: mdio: Add helper functions for accessing MDIO devices

This adds some helpers for accessing non-phy MDIO devices. They are
analogous to phy_(read|write|modify), except that they take an mdio_device
and not a phy_device.
Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent db690aec
...@@ -352,6 +352,30 @@ int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask, ...@@ -352,6 +352,30 @@ int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask,
int mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum, int mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum,
u16 mask, u16 set); u16 mask, u16 set);
static inline int mdiodev_read(struct mdio_device *mdiodev, u32 regnum)
{
return mdiobus_read(mdiodev->bus, mdiodev->addr, regnum);
}
static inline int mdiodev_write(struct mdio_device *mdiodev, u32 regnum,
u16 val)
{
return mdiobus_write(mdiodev->bus, mdiodev->addr, regnum, val);
}
static inline int mdiodev_modify(struct mdio_device *mdiodev, u32 regnum,
u16 mask, u16 set)
{
return mdiobus_modify(mdiodev->bus, mdiodev->addr, regnum, mask, set);
}
static inline int mdiodev_modify_changed(struct mdio_device *mdiodev,
u32 regnum, u16 mask, u16 set)
{
return mdiobus_modify_changed(mdiodev->bus, mdiodev->addr, regnum,
mask, set);
}
static inline u32 mdiobus_c45_addr(int devad, u16 regnum) static inline u32 mdiobus_c45_addr(int devad, u16 regnum)
{ {
return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum; return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum;
......
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