🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
7 messages
7 total messages Started by Ioana Ciornei Wed, 18 Nov 2026 16:31
[PATCH 0/3] phy: lynx: add support for downstream retimer PHYs
#18637
Author: Ioana Ciornei
Date: Wed, 18 Nov 2026 16:31
35 lines
17748 bytes
This patch set adds support in the Lynx SerDes PHY drivers for
retimer PHYs which can be found on the board downstream of the SerDes
lane towards any connector such as an SFP cage.

The first patch extends the Lynx 10G and Lynx 28G dt bindings so that we
allow the phys and phy-names properties at the SerDes lane level.

The second patch extends the core lane probing function with
lynx_lane_get_retimers() which walks the lane's phys array and gets a
reference to any downstream PHY found. The 3rd patch sets up the
forwarding of the phy_ops received by the SerDes lane towards the
retimer PHYs as well.

One thing to note here is that the forwarding code is kept rather
grouped in phy-fsl-lynx-core.c rather than in the individual Lynx10G and
Lynx28G drivers so that in the future, if necessary, it can be moved
internally into the Generic PHY framework. This leads to the consequence
that the actual phy_ops with which the PHY is created cannot be const
since the .owner field needs to be copied from the structure received
from the actual PHY driver.

Ioana Ciornei (3):
  dt-bindings: phy: lynx: allow downstream phys on the lane nodes
  phy: lynx: get the PHYs listed in the lane nodes
  phy: lynx: forward the phy_ops to the downstream PHYs of a lane

 .../devicetree/bindings/phy/fsl,lynx-10g.yaml |  27 ++
 .../devicetree/bindings/phy/fsl,lynx-28g.yaml |  27 ++
 drivers/phy/freescale/phy-fsl-lynx-core.c     | 266 +++++++++++++++++-
 drivers/phy/freescale/phy-fsl-lynx-core.h     |  14 +-
 4 files changed, 327 insertions(+), 7 deletions(-)

-- 
2.25.1
[PATCH 2/3] phy: lynx: get the PHYs listed in the lane nodes
#18638
Author: Ioana Ciornei
Date: Wed, 18 Nov 2026 16:31
142 lines
21062 bytes
A SerDes lane can be connected to the connector through other PHYs, for
example a retimer, which the device tree lists in the "phys" property of
the lane node.

Since the SerDes lane can work without these downstream PHYs, get a
reference to the retimers at lane probe time but do not let them prevent
the whole SerDes driver from probing in case one of them is not fully
enabled:

- On -EPROBE_DEFER, ask driver_deferred_probe_check_state() whether to
keep waiting. It returns -EPROBE_DEFER until the end of initcalls and,
with modules enabled, until the deferred probe timeout expires, so a PHY
whose driver is only late is still used. After that, for example because
the driver of a retimer is not enabled, skip the PHY with a warning
instead of deferring forever.

- Also skip any other downstream PHYs to which the driver cannot get a
valid reference.

- The DT bindings do not limit the number of PHYs, but the lane keeps at
most two of them, which is enough for a retimer with one channel per
direction. Warn about and ignore the extra entries.

Forwarding of the phy_ops to the downstream retimer PHYs is added in the
next patch.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/phy/freescale/phy-fsl-lynx-core.c | 60 +++++++++++++++++++++++
 drivers/phy/freescale/phy-fsl-lynx-core.h |  4 ++
 2 files changed, 64 insertions(+)

diff --git a/drivers/phy/freescale/phy-fsl-lynx-core.c b/drivers/phy/freescale/phy-fsl-lynx-core.c
index 2cfe9236ffc5..307427b73d40 100644
--- a/drivers/phy/freescale/phy-fsl-lynx-core.c
+++ b/drivers/phy/freescale/phy-fsl-lynx-core.c
@@ -1,7 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0+
 /* Copyright 2025-2026 NXP */
 
+#include <linux/device/driver.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 
 #include "phy-fsl-lynx-core.h"
@@ -319,12 +321,70 @@ static struct phy *lynx_xlate(struct device *dev,
 	return priv->lane[idx].phy ?: ERR_PTR(-ENODEV);
 }
 
+/* Get the PHYs on the signal path between the lane and the connector, such as
+ * the channels of a retimer, from the "phys" property of the lane node.
+ *
+ * The lane can be used without them, so if a retimer is not available or not
+ * described correctly, for example because its driver is not enabled, skip it
+ * with a warning instead of keeping the whole SerDes from probing.
+ */
+static int lynx_lane_get_retimers(struct lynx_priv *priv,
+				  struct lynx_lane *lane,
+				  struct device_node *dn)
+{
+	struct device *dev = priv->dev;
+	struct phy *retimer;
+	int num, i, err;
+
+	lane->num_retimers = 0;
+
+	if (!dn || !of_property_present(dn, "phys"))
+		return 0;
+
+	num = of_count_phandle_with_args(dn, "phys", "#phy-cells");
+	if (num <= 0) {
+		dev_warn(dev, "%pOF: invalid \"phys\", skipping\n", dn);
+		return 0;
+	}
+
+	if (num > LYNX_MAX_RETIMERS) {
+		dev_warn(dev,
+			 "%pOF: ignoring %d \"phys\" over the maximum of %d\n",
+			 dn, num - LYNX_MAX_RETIMERS, LYNX_MAX_RETIMERS);
+		num = LYNX_MAX_RETIMERS;
+	}
+
+	for (i = 0; i < num; i++) {
+		retimer = devm_of_phy_get_by_index(dev, dn, i);
+		if (!IS_ERR(retimer)) {
+			lane->retimer[lane->num_retimers++] = retimer;
+			continue;
+		}
+
+		err = PTR_ERR(retimer);
+		if (err == -EPROBE_DEFER)
+			err = driver_deferred_probe_check_state(dev);
+		if (err == -EPROBE_DEFER)
+			return err;
+
+		dev_warn(dev, "%pOF: ignoring phys[%d]: %pe\n", dn, i,
+			 ERR_PTR(err));
+	}
+
+	return 0;
+}
+
 static int lynx_probe_lane(struct lynx_priv *priv, int id,
 			   struct device_node *dn,
 			   const struct phy_ops *phy_ops)
 {
 	struct lynx_lane *lane = &priv->lane[id];
 	struct phy *phy;
+	int err;
+
+	err = lynx_lane_get_retimers(priv, lane, dn);
+	if (err)
+		return err;
 
 	phy = devm_phy_create(priv->dev, dn, phy_ops);
 	if (IS_ERR(phy))
diff --git a/drivers/phy/freescale/phy-fsl-lynx-core.h b/drivers/phy/freescale/phy-fsl-lynx-core.h
index a60429ba9324..c2ad81a9144b 100644
--- a/drivers/phy/freescale/phy-fsl-lynx-core.h
+++ b/drivers/phy/freescale/phy-fsl-lynx-core.h
@@ -9,6 +9,8 @@
 #include <soc/fsl/phy-fsl-lynx.h>
 
 #define LYNX_NUM_PLL				2
+/* Enough for a retimer with a generic PHY per direction */
+#define LYNX_MAX_RETIMERS			2
 #define LYNX_QUIRK_HAS_HARDCODED_USXGMII	BIT(0)
 
 struct lynx_priv;
@@ -33,6 +35,8 @@ struct lynx_pll {
 struct lynx_lane {
 	struct lynx_priv *priv;
 	struct phy *phy;
+	struct phy *retimer[LYNX_MAX_RETIMERS];
+	int num_retimers;
 	bool powered_up;
 	bool init;
 	unsigned int id;
-- 
2.25.1
Re: [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs
#19065
Author: Vladimir Oltean
Date: Thu, 19 Nov 2026 09:25
12 lines
17310 bytes
On Wed, Nov 18, 2026 at 06:31:31PM +0200, Ioana Ciornei wrote:
> One thing to note here is that the forwarding code is kept rather
> grouped in phy-fsl-lynx-core.c rather than in the individual Lynx10G and
> Lynx28G drivers so that in the future, if necessary, it can be moved
> internally into the Generic PHY framework. This leads to the consequence
> that the actual phy_ops with which the PHY is created cannot be const
> since the .owner field needs to be copied from the structure received
> from the actual PHY driver.

Have you evaluated the possibility to land retimer support in the core
PHY framework directly? What would the obstacles be?
Re: [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs
#19246
Author: Ioana Ciornei
Date: Thu, 19 Nov 2026 16:15
55 lines
19414 bytes
On Thu, Nov 19, 2026 at 11:25:01AM +0200, Vladimir Oltean wrote:
> On Wed, Nov 18, 2026 at 06:31:31PM +0200, Ioana Ciornei wrote:
> > One thing to note here is that the forwarding code is kept rather
> > grouped in phy-fsl-lynx-core.c rather than in the individual Lynx10G and
> > Lynx28G drivers so that in the future, if necessary, it can be moved
> > internally into the Generic PHY framework. This leads to the consequence
> > that the actual phy_ops with which the PHY is created cannot be const
> > since the .owner field needs to be copied from the structure received
> > from the actual PHY driver.
> 
> Have you evaluated the possibility to land retimer support in the core
> PHY framework directly? What would the obstacles be?

I did evaluate the possibility to add retimer support in the core PHY
framework but there is a lot of preparatory work to be done in order for
the core to be ready to receive this kind of feature and actually use
it in its current drivers. On top of this, I am not really sure there is
enough interest in the community to do it.

Everything stems from the fact that there is no actual enforced
guideline of how the PHY consumer and PHY provider drivers should
interact with one another through the phy_ops.

I will list below some of the identified issues:

- How to interpret a missing callback. A missing callback returns 0 for
  most of the ops but .configure() and .validate() which return
  -EOPNOTSUPP.

  For example, any PHY consumer can now call phy_set_mode_ext(phy,
  PHY_MODE_ETHERNET, PHY_INTERFACE_MODE_25GBASER) on a PHY which does
  not implement the .set_mode() callback and get no error, even though
  the SerDes could be very well unable to sustain that mode. The
  question is what to do when this happens.

  In my view, .validate should always be defined by a PHY provider which
  wants to expose .set_mode and .configure since without .validate the
  consumer cannot check what modes the PHY supports nor what
  configurations it accepts. Since this is not the norm currently in the
  core PHY framework I would be taking on responsability that is backed
  by no authoritative source.

- Which ops to forward and in what order.

  Today each driver that uses this kind of "chained PHY" schema
  forwards a different subset by hand - some forward .init() / .exit() /
  .set_mode(), others only .init().

  At the same time, there is no uniform order in which the phy_ops are
  called on the SerDes PHY and its downstream PHYs. Some drivers go
  through the downstream PHYs first and then their own callback, others
  the other way around.

Ioana
Re: [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs
#19293
Author: Ioana Ciornei
Date: Thu, 19 Nov 2026 17:25
51 lines
19081 bytes
On Thu, Nov 19, 2026 at 04:57:05PM +0100, Vincent Jardin wrote:
> Hi Ioana,
> 
> > This patch set adds support in the Lynx SerDes PHY drivers for
> > retimer PHYs which can be found on the board downstream of the SerDes
> > lane towards any connector such as an SFP cage.
> 
> It is a good idea, it can be used then to leverage other retimers
> on those serdes too (like a ds250).
> 
> So, two questions:
>  - in patch 3, a downstream PHY without .validate fails every mode of
> the lane. Could it be stated in the binding or in a kernel doc ? A
> minimal retimer driver would take the port down.

I am not really sure where exactly to document this Lynx SerDes
restriction: the dt bindings do not deal with this kind of restrictions
and I am not sure that in the driver it will actually be visible.

On the other hand, phylink_dbg will print the phy_interface_t bitmap
supported by an SFP and the bitmap supported by the MAC/SerDes +
retimers. So there will be some debug messages to start from.

> 
>  - for 100G and 40G ports that are 4 lanes under one MAC, and the
> Lynx 28G driver has no lane mode for them, so set_mode would never reach
> their retimers. What's the plan ?

I would think that if a retimer connected to the lanes of a 100G or 40G
port needs to configured at runtime, it would also need to have SerDes
level support in the Lynx 28G driver. So than plan would be to add
100G/40G support first.

> 
> One more point: we need to be able to tune the equalization and run PRBS
> on these chips from userspace. A driver that selects a channel and then
> writes would race with such tools. The retimer driver
> would have to deal with it. What could the proper design be ?
> 

If PRBS is done in user space then I would expect the Linux drivers
which touch the SerDes lanes and any other retimer on the signal path
to be unbound from the devices. For example, if PRBS is run on a Lynx28G
SerDes lane then the entire SerDes block needs to be in test mode. This
implies that no other lane can be in application mode which is invasive
enough that an unbind is necessary.

Ioana

[1] https://lore.kernel.org/all/aY2lFTIALH7qEJmM@shell.armlinux.org.uk/
Re: [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs
#21353
Author: Vladimir Oltean
Date: Mon, 23 Nov 2026 22:37
42 lines
18569 bytes
On Wed, Nov 18, 2026 at 06:31:31PM +0200, Ioana Ciornei wrote:
> This patch set adds support in the Lynx SerDes PHY drivers for
> retimer PHYs which can be found on the board downstream of the SerDes
> lane towards any connector such as an SFP cage.
> 
> The first patch extends the Lynx 10G and Lynx 28G dt bindings so that we
> allow the phys and phy-names properties at the SerDes lane level.
> 
> The second patch extends the core lane probing function with
> lynx_lane_get_retimers() which walks the lane's phys array and gets a
> reference to any downstream PHY found. The 3rd patch sets up the
> forwarding of the phy_ops received by the SerDes lane towards the
> retimer PHYs as well.
> 
> One thing to note here is that the forwarding code is kept rather
> grouped in phy-fsl-lynx-core.c rather than in the individual Lynx10G and
> Lynx28G drivers so that in the future, if necessary, it can be moved
> internally into the Generic PHY framework. This leads to the consequence
> that the actual phy_ops with which the PHY is created cannot be const
> since the .owner field needs to be copied from the structure received
> from the actual PHY driver.
> 
> Ioana Ciornei (3):
>   dt-bindings: phy: lynx: allow downstream phys on the lane nodes
>   phy: lynx: get the PHYs listed in the lane nodes
>   phy: lynx: forward the phy_ops to the downstream PHYs of a lane
> 
>  .../devicetree/bindings/phy/fsl,lynx-10g.yaml |  27 ++
>  .../devicetree/bindings/phy/fsl,lynx-28g.yaml |  27 ++
>  drivers/phy/freescale/phy-fsl-lynx-core.c     | 266 +++++++++++++++++-
>  drivers/phy/freescale/phy-fsl-lynx-core.h     |  14 +-
>  4 files changed, 327 insertions(+), 7 deletions(-)
> 
> -- 
> 2.25.1
>

For the series:

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Re: [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs
#21749
Author: Vinod Koul
Date: Tue, 24 Nov 2026 12:22
24 lines
8386 bytes
On Wed, 18 Nov 2026 18:31:31 +0200, Ioana Ciornei wrote:
> This patch set adds support in the Lynx SerDes PHY drivers for
> retimer PHYs which can be found on the board downstream of the SerDes
> lane towards any connector such as an SFP cage.
> 
> The first patch extends the Lynx 10G and Lynx 28G dt bindings so that we
> allow the phys and phy-names properties at the SerDes lane level.
> 
> [...]

Applied, thanks!

[1/3] dt-bindings: phy: lynx: allow downstream phys on the lane nodes
      commit: 5f7f673778dde3fca552cb7ad30b5f145774da3c
[2/3] phy: lynx: get the PHYs listed in the lane nodes
      commit: 9b98db3e56ded4e2990c5f1fb508cf45a78fb547
[3/3] phy: lynx: forward the phy_ops to the downstream PHYs of a lane
      commit: 3e10636038ee8a9430f791777f50f73c48afc5ad

Best regards,
-- 
~Vinod
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads