aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorRussell King (Oracle) <[email protected]>2024-12-03 15:31:18 +0000
committerJakub Kicinski <[email protected]>2024-12-05 03:19:07 +0000
commit5d58a890c02770ba8d790b1f3c6e8c0e20514dc2 (patch)
tree241df742faa57612edc430af5c46b3f5e073b65c /drivers/net/phy/phy.c
parentnet: phy: marvell: implement phy_inband_caps() method (diff)
downloadkernel-5d58a890c02770ba8d790b1f3c6e8c0e20514dc2.tar.gz
kernel-5d58a890c02770ba8d790b1f3c6e8c0e20514dc2.zip
net: phy: add phy_config_inband()
Add a method to configure the PHY's in-band mode. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f42cd6584841..0c228aa18019 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1027,6 +1027,38 @@ unsigned int phy_inband_caps(struct phy_device *phydev,
EXPORT_SYMBOL_GPL(phy_inband_caps);
/**
+ * phy_config_inband - configure the desired PHY in-band mode
+ * @phydev: the phy_device struct
+ * @modes: in-band modes to configure
+ *
+ * Description: disables, enables or enables-with-bypass in-band signalling
+ * between the PHY and host system.
+ *
+ * Returns: zero on success, or negative errno value.
+ */
+int phy_config_inband(struct phy_device *phydev, unsigned int modes)
+{
+ int err;
+
+ if (!!(modes & LINK_INBAND_DISABLE) +
+ !!(modes & LINK_INBAND_ENABLE) +
+ !!(modes & LINK_INBAND_BYPASS) != 1)
+ return -EINVAL;
+
+ mutex_lock(&phydev->lock);
+ if (!phydev->drv)
+ err = -EIO;
+ else if (!phydev->drv->config_inband)
+ err = -EOPNOTSUPP;
+ else
+ err = phydev->drv->config_inband(phydev, modes);
+ mutex_unlock(&phydev->lock);
+
+ return err;
+}
+EXPORT_SYMBOL(phy_config_inband);
+
+/**
* _phy_start_aneg - start auto-negotiation for this PHY device
* @phydev: the phy_device struct
*