diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2023-08-21 13:04:32 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-04-16 16:51:04 +0100 |
commit | 2c621b33b510f6b9adbadcf1eec01cdf62fa9bd6 (patch) | |
tree | 715513a18cdbd2ddcf32482ad6e661435d8790f7 /drivers | |
parent | 5de9ed47abfe7547ff008e97992ba2650e47a20d (diff) |
net: phy: add phy_query_inband()
Add a method to query the PHY's in-band capabilities for a PHY
interface mode. This can be used to determine for the specified
interface mode whether in-band signalling is supported, and whether
the PHY requires in-band signalling.
When not implemented, or the PHY driver doesn't report any modes
for the interface, LINK_INBAND_VALID will not be set. When set, the
remainder of the flags can be interpreted.
LINK_INBAND_POSSIBLE means that the device can be configured to use
or not use in-band signalling. Later patches may add support to
configure this at the PHY.
LINK_INBAND_REQUIRED means that the device uses in-band signalling
which can not be disabled.
When only LINK_INBAND_VALID has been set, this means that the device
does not support any in-band signalling, and can't be configured to
do so.
"Bypass" mode (where the device may be configured for in-band, but
may still bring the link up if there is no in-band received from the
link partner) is not considered in this patch.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/phy/phy.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 89fd2564cbad..ef8b4c9e346a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -993,6 +993,27 @@ static int phy_check_link_status(struct phy_device *phydev) } /** + * phy_query_inband - query which in-band signalling modes are supported + * @phydev: a pointer to a &struct phy_device + * @interface: the interface mode for the PHY + * + * Returns zero if it is unknown what in-band signalling is supported by the + * PHY (e.g. because the PHY driver doesn't implement the method.) Otherwise, + * returns a bit mask of the LINK_INBAND_* values from + * &enum link_inband_signalling to describe which inband modes are supported + * for this interface mode. + */ +unsigned int phy_query_inband(struct phy_device *phydev, + phy_interface_t interface) +{ + if (phydev->drv && phydev->drv->query_inband) + return phydev->drv->query_inband(phydev, interface); + + return 0; +} +EXPORT_SYMBOL_GPL(phy_query_inband); + +/** * _phy_start_aneg - start auto-negotiation for this PHY device * @phydev: the phy_device struct * |