linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Alexander Couzens <lynxis@fe80.eu>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Daniel Golle <daniel@makrotopia.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Jose Abreu <Jose.Abreu@synopsys.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Marcin Wojtas <marcin.s.wojtas@gmail.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH RFC net-next 07/16] net: phy: add phy_config_inband()
Date: Tue, 26 Nov 2024 09:24:51 +0000	[thread overview]
Message-ID: <E1tFroR-005xQE-Ab@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Z0WTpE8wkpjMiv_J@shell.armlinux.org.uk>

Add a method to configure the PHY's in-band mode.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phy.c | 31 +++++++++++++++++++++++++++++++
 include/linux/phy.h   |  6 ++++++
 2 files changed, 37 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d7b34f8ae415..3e4922839895 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1026,6 +1026,37 @@ 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;
+}
+
 /**
  * _phy_start_aneg - start auto-negotiation for this PHY device
  * @phydev: the phy_device struct
diff --git a/include/linux/phy.h b/include/linux/phy.h
index ff60c4785e11..6c1887d1edbf 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -980,6 +980,11 @@ struct phy_driver {
 	unsigned int (*inband_caps)(struct phy_device *phydev,
 				    phy_interface_t interface);
 
+	/**
+	 * @config_inband: configure in-band mode for the PHY
+	 */
+	int (*config_inband)(struct phy_device *phydev, unsigned int modes);
+
 	/**
 	 * @get_rate_matching: Get the supported type of rate matching for a
 	 * particular phy interface. This is used by phy consumers to determine
@@ -1844,6 +1849,7 @@ int phy_start_aneg(struct phy_device *phydev);
 int phy_aneg_done(struct phy_device *phydev);
 unsigned int phy_inband_caps(struct phy_device *phydev,
 			     phy_interface_t interface);
+int phy_config_inband(struct phy_device *phydev, unsigned int modes);
 int phy_speed_down(struct phy_device *phydev, bool sync);
 int phy_speed_up(struct phy_device *phydev);
 bool phy_check_valid(int speed, int duplex, unsigned long *features);
-- 
2.30.2



  parent reply	other threads:[~2024-11-26  9:34 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26  9:23 [PATCH RFC net-next 00/16] net: add negotiation of in-band capabilities Russell King (Oracle)
2024-11-26  9:24 ` [PATCH RFC net-next 01/16] net: phylink: pass phylink and pcs into phylink_pcs_neg_mode() Russell King (Oracle)
2024-11-26 20:01   ` Andrew Lunn
2024-11-26  9:24 ` [PATCH RFC net-next 02/16] net: phylink: split cur_link_an_mode into requested and active Russell King (Oracle)
2024-11-26 20:02   ` Andrew Lunn
2024-11-26  9:24 ` [PATCH RFC net-next 03/16] net: phylink: add debug for phylink_major_config() Russell King (Oracle)
2024-11-26 20:03   ` Andrew Lunn
2024-11-26  9:24 ` [PATCH RFC net-next 04/16] net: phy: add phy_inband_caps() Russell King (Oracle)
2024-11-26 20:56   ` Andrew Lunn
2024-11-26  9:24 ` [PATCH RFC net-next 05/16] net: phy: bcm84881: implement phy_inband_caps() method Russell King (Oracle)
2024-11-26 20:57   ` Andrew Lunn
2024-11-26  9:24 ` [PATCH RFC net-next 06/16] net: phy: marvell: " Russell King (Oracle)
2024-11-26 20:58   ` Andrew Lunn
2024-11-26  9:24 ` Russell King (Oracle) [this message]
2024-11-26 21:00   ` [PATCH RFC net-next 07/16] net: phy: add phy_config_inband() Andrew Lunn
2024-11-26  9:24 ` [PATCH RFC net-next 08/16] net: phy: marvell: implement config_inband() method Russell King (Oracle)
2024-11-26 21:00   ` Andrew Lunn
2024-11-26  9:25 ` [PATCH RFC net-next 09/16] net: phylink: add pcs_inband_caps() method Russell King (Oracle)
2024-11-26 21:05   ` Andrew Lunn
2024-11-26  9:25 ` [PATCH RFC net-next 10/16] net: mvneta: implement " Russell King (Oracle)
2024-11-26 21:06   ` Andrew Lunn
2024-11-26  9:25 ` [PATCH RFC net-next 11/16] net: mvpp2: " Russell King (Oracle)
2024-11-26 21:07   ` Andrew Lunn
2024-11-26  9:25 ` [PATCH RFC net-next 12/16] net: pcs: pcs-lynx: " Russell King (Oracle)
2024-11-27 14:08   ` Maxime Chevallier
2024-11-26  9:25 ` [PATCH RFC net-next 13/16] net: pcs: pcs-mtk-lynxi: " Russell King (Oracle)
2024-11-26  9:25 ` [PATCH RFC net-next 14/16] net: pcs: xpcs: " Russell King (Oracle)
2024-11-26  9:25 ` [PATCH RFC net-next 15/16] net: phylink: add negotiation of in-band capabilities Russell King (Oracle)
2024-11-26 21:18   ` Andrew Lunn
2024-11-26 21:43     ` Russell King (Oracle)
2024-11-26  9:25 ` [PATCH RFC net-next 16/16] net: phylink: remove phylink_phy_no_inband() Russell King (Oracle)
2024-11-26 21:19   ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1tFroR-005xQE-Ab@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=Jose.Abreu@synopsys.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lynxis@fe80.eu \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).