Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sean Anderson and committed by
David S. Miller
0ebecb26 db690aec

+24
+24
include/linux/mdio.h
··· 352 352 int mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum, 353 353 u16 mask, u16 set); 354 354 355 + static inline int mdiodev_read(struct mdio_device *mdiodev, u32 regnum) 356 + { 357 + return mdiobus_read(mdiodev->bus, mdiodev->addr, regnum); 358 + } 359 + 360 + static inline int mdiodev_write(struct mdio_device *mdiodev, u32 regnum, 361 + u16 val) 362 + { 363 + return mdiobus_write(mdiodev->bus, mdiodev->addr, regnum, val); 364 + } 365 + 366 + static inline int mdiodev_modify(struct mdio_device *mdiodev, u32 regnum, 367 + u16 mask, u16 set) 368 + { 369 + return mdiobus_modify(mdiodev->bus, mdiodev->addr, regnum, mask, set); 370 + } 371 + 372 + static inline int mdiodev_modify_changed(struct mdio_device *mdiodev, 373 + u32 regnum, u16 mask, u16 set) 374 + { 375 + return mdiobus_modify_changed(mdiodev->bus, mdiodev->addr, regnum, 376 + mask, set); 377 + } 378 + 355 379 static inline u32 mdiobus_c45_addr(int devad, u16 regnum) 356 380 { 357 381 return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum;