mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
net: phy: add generic helpers for direct C45 MMD access
Some PHYs support direct C45 register access but not C22 indirect MMD access (registers 0xD and 0xE). When discovered via C22, phylib routes MMD access through the indirect path, which won't work on these devices. Add genphy_read_mmd_c45() and genphy_write_mmd_c45() as read_mmd/ write_mmd callbacks that bypass the C22 indirect path and use the bus C45 accessors directly. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Ciprian Regus <ciprian.regus@analog.com> Link: https://patch.msgid.link/20260708-adin1140-driver-v5-10-4aca7b51a58b@analog.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
638b41f770
commit
aa63217916
|
|
@ -2770,6 +2770,31 @@ int genphy_read_abilities(struct phy_device *phydev)
|
|||
}
|
||||
EXPORT_SYMBOL(genphy_read_abilities);
|
||||
|
||||
/* Some PHYs support direct C45 register access but not C22 indirect
|
||||
* MMD access (registers 13 and 14). When discovered via C22, phylib
|
||||
* routes MMD access through the indirect path, which won't work on
|
||||
* these devices. These helpers bypass indirect access and use the bus
|
||||
* C45 accessors directly.
|
||||
*/
|
||||
int genphy_read_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum)
|
||||
{
|
||||
struct mii_bus *bus = phydev->mdio.bus;
|
||||
int addr = phydev->mdio.addr;
|
||||
|
||||
return __mdiobus_c45_read(bus, addr, devnum, regnum);
|
||||
}
|
||||
EXPORT_SYMBOL(genphy_read_mmd_c45);
|
||||
|
||||
int genphy_write_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum,
|
||||
u16 val)
|
||||
{
|
||||
struct mii_bus *bus = phydev->mdio.bus;
|
||||
int addr = phydev->mdio.addr;
|
||||
|
||||
return __mdiobus_c45_write(bus, addr, devnum, regnum, val);
|
||||
}
|
||||
EXPORT_SYMBOL(genphy_write_mmd_c45);
|
||||
|
||||
/* This is used for the phy device which doesn't support the MMD extended
|
||||
* register access, but it does have side effect when we are trying to access
|
||||
* the MMD register via indirect method.
|
||||
|
|
|
|||
|
|
@ -2302,6 +2302,9 @@ static inline int genphy_no_config_intr(struct phy_device *phydev)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
int genphy_read_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum);
|
||||
int genphy_write_mmd_c45(struct phy_device *phydev, int devnum, u16 regnum,
|
||||
u16 val);
|
||||
int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad,
|
||||
u16 regnum);
|
||||
int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user