Commit e29edc47 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'clean-up-pcs-xpcs-accessors'

Russell King says:

====================
Clean up pcs-xpcs accessors

This series cleans up the pcs-xpcs code to use mdiodev accessors for
read/write just like xpcs_modify_changed() does. In order to do this,
we need to introduce the mdiodev clause 45 accessors.
====================

Link: https://lore.kernel.org/r/Y2pm13+SDg6N/IVx@shell.armlinux.org.ukSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 21780f89 85a2b4ac
......@@ -188,18 +188,12 @@ static bool __xpcs_linkmode_supported(const struct xpcs_compat *compat,
int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg)
{
struct mii_bus *bus = xpcs->mdiodev->bus;
int addr = xpcs->mdiodev->addr;
return mdiobus_c45_read(bus, addr, dev, reg);
return mdiodev_c45_read(xpcs->mdiodev, dev, reg);
}
int xpcs_write(struct dw_xpcs *xpcs, int dev, u32 reg, u16 val)
{
struct mii_bus *bus = xpcs->mdiodev->bus;
int addr = xpcs->mdiodev->addr;
return mdiobus_c45_write(bus, addr, dev, reg, val);
return mdiodev_c45_write(xpcs->mdiodev, dev, reg, val);
}
static int xpcs_modify_changed(struct dw_xpcs *xpcs, int dev, u32 reg,
......
......@@ -488,6 +488,19 @@ static inline int mdiobus_c45_write(struct mii_bus *bus, int prtad, int devad,
return mdiobus_write(bus, prtad, mdiobus_c45_addr(devad, regnum), val);
}
static inline int mdiodev_c45_read(struct mdio_device *mdiodev, int devad,
u16 regnum)
{
return mdiobus_c45_read(mdiodev->bus, mdiodev->addr, devad, regnum);
}
static inline int mdiodev_c45_write(struct mdio_device *mdiodev, u32 devad,
u16 regnum, u16 val)
{
return mdiobus_c45_write(mdiodev->bus, mdiodev->addr, devad, regnum,
val);
}
int mdiobus_register_device(struct mdio_device *mdiodev);
int mdiobus_unregister_device(struct mdio_device *mdiodev);
bool mdiobus_is_registered_device(struct mii_bus *bus, int addr);
......
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