* [PATCH 1/3] dt-bindings: phy: lynx: allow downstream phys on the lane nodes
2026-11-18 16:31 [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs Ioana Ciornei
@ 2026-11-18 16:31 ` Ioana Ciornei
2026-11-18 16:31 ` [PATCH 2/3] phy: lynx: get the PHYs listed in " Ioana Ciornei
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ioana Ciornei @ 2026-11-18 16:31 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy
Cc: devicetree, netdev, Vladimir Oltean
A SerDes lane can be connected to the connector through other PHYs. For
example, the DS125DF111 retimer on the LS1088ARDB has one channel per
direction, each channel being modeled with its own PHY device, so the
lane is connected to two of its channels.
Allow a "phys" property in the lane sub-nodes of both the Lynx 10G and
the Lynx 28G bindings.
Also allow an optional "phy-names", with one name per entry of "phys",
so that a board can name the channels, for example "tx" and "rx". The
names are only descriptive: the entries are used by index, and no
particular names are required.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
.../devicetree/bindings/phy/fsl,lynx-10g.yaml | 27 +++++++++++++++++++
.../devicetree/bindings/phy/fsl,lynx-28g.yaml | 27 +++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml
index 2e7d0abfa71a..a4592e02f972 100644
--- a/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml
+++ b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml
@@ -57,10 +57,24 @@ patternProperties:
"#phy-cells":
const: 0
+ phys:
+ description:
+ PHYs on the signal path between the lane and the connector, such as a
+ signal retimer. A retimer can be modeled with a PHY device per
+ channel / direction.
+
+ phy-names:
+ description:
+ Optional names for the entries of "phys", for example to tell the
+ channels of a retimer apart.
+
required:
- reg
- "#phy-cells"
+ dependencies:
+ phy-names: [ phys ]
+
additionalProperties: false
required:
@@ -119,6 +133,8 @@ examples:
phy@0 {
reg = <0>;
#phy-cells = <0>;
+ phys = <&retimer 0>, <&retimer 1>;
+ phy-names = "tx", "rx";
};
phy@1 {
@@ -137,3 +153,14 @@ examples:
};
};
};
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ retimer: retimer@18 {
+ compatible = "ti,ds125df111";
+ reg = <0x18>;
+ #phy-cells = <1>;
+ };
+ };
diff --git a/Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml b/Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml
index d73591315d4b..5d2505fe2fcc 100644
--- a/Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml
+++ b/Documentation/devicetree/bindings/phy/fsl,lynx-28g.yaml
@@ -67,10 +67,24 @@ patternProperties:
"#phy-cells":
const: 0
+ phys:
+ description:
+ PHYs on the signal path between the lane and the connector, such as a
+ signal retimer. A retimer can be modeled with a PHY device per
+ channel / direction.
+
+ phy-names:
+ description:
+ Optional names for the entries of "phys", for example to tell the
+ channels of a retimer apart.
+
required:
- reg
- "#phy-cells"
+ dependencies:
+ phy-names: [ phys ]
+
additionalProperties: false
required:
@@ -111,6 +125,8 @@ examples:
phy@0 {
reg = <0>;
#phy-cells = <0>;
+ phys = <&retimer 0>, <&retimer 1>;
+ phy-names = "tx", "rx";
};
phy@1 {
@@ -149,3 +165,14 @@ examples:
};
};
};
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ retimer: retimer@18 {
+ compatible = "ti,ds125df111";
+ reg = <0x18>;
+ #phy-cells = <1>;
+ };
+ };
--
2.25.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] phy: lynx: get the PHYs listed in the lane nodes
2026-11-18 16:31 [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs Ioana Ciornei
2026-11-18 16:31 ` [PATCH 1/3] dt-bindings: phy: lynx: allow downstream phys on the lane nodes Ioana Ciornei
@ 2026-11-18 16:31 ` Ioana Ciornei
2026-11-18 16:31 ` [PATCH 3/3] phy: lynx: forward the phy_ops to the downstream PHYs of a lane Ioana Ciornei
2026-11-19 9:25 ` [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs Vladimir Oltean
3 siblings, 0 replies; 5+ messages in thread
From: Ioana Ciornei @ 2026-11-18 16:31 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy
Cc: devicetree, netdev, Vladimir Oltean
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
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] phy: lynx: forward the phy_ops to the downstream PHYs of a lane
2026-11-18 16:31 [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs Ioana Ciornei
2026-11-18 16:31 ` [PATCH 1/3] dt-bindings: phy: lynx: allow downstream phys on the lane nodes Ioana Ciornei
2026-11-18 16:31 ` [PATCH 2/3] phy: lynx: get the PHYs listed in " Ioana Ciornei
@ 2026-11-18 16:31 ` Ioana Ciornei
2026-11-19 9:25 ` [PATCH 0/3] phy: lynx: add support for downstream retimer PHYs Vladimir Oltean
3 siblings, 0 replies; 5+ messages in thread
From: Ioana Ciornei @ 2026-11-18 16:31 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-phy
Cc: devicetree, netdev, Vladimir Oltean
Now that the lane has the PHYs listed in its "phys" property, make them
follow the lane. A consumer, such as dpaa2-mac, only sees the lane PHY,
so it is the lane that has to bring up and program the retimer for the
protocol that the consumer asks for, and report as supported only the
interfaces that the retimer accepts as well.
Forward init, exit, power_on, power_off, set_mode and validate. The PHYs
of the lane are called through the phy_*() API, so that they keep their
own locking and counters.
Errors are handled as follows:
- init and power_on: if one of the PHYs fails, the ones already brought
up are undone, in reverse order, and the error is returned. If the lane
itself fails, all of them are undone.
- exit and power_off: if the lane fails, its PHYs are left as they are,
because the PHY core keeps the lane counted as up and the consumer may
retry; taking them down now would do it twice. Otherwise, a failure of
one of the downstream PHYs is logged and the others are still taken down.
- set_mode and validate: the first error is returned. A PHY that does not
implement validate fails the validation of the lane too, since the lane
cannot tell that the PHY accepts the mode.
There is no rollback if set_mode fails on one of the PHYs, because there
is no previous mode to go back to: neither the PHY core nor the retimer
drivers record the submode. The next phy_set_mode_ext(), which dpaa2-mac
makes from every mac_config(), reconfigures the whole signal path.
The forwarding is done once in the core, for both the 10G and the 28G
driver. The core ops are installed on all the lane PHYs, whether or not
they have downstream PHYs, and call the ops of the driver. They are
copied at probe time to take the .owner of the driver.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
drivers/phy/freescale/phy-fsl-lynx-core.c | 206 +++++++++++++++++++++-
drivers/phy/freescale/phy-fsl-lynx-core.h | 10 +-
2 files changed, 209 insertions(+), 7 deletions(-)
diff --git a/drivers/phy/freescale/phy-fsl-lynx-core.c b/drivers/phy/freescale/phy-fsl-lynx-core.c
index 307427b73d40..8a2e9ab8aebb 100644
--- a/drivers/phy/freescale/phy-fsl-lynx-core.c
+++ b/drivers/phy/freescale/phy-fsl-lynx-core.c
@@ -374,9 +374,200 @@ static int lynx_lane_get_retimers(struct lynx_priv *priv,
return 0;
}
+/* The PHYs of the lane are brought up before the lane, in the order of
+ * "phys", and taken down after it, also in the order of "phys". If one of them
+ * fails to come up, the ones already brought up are undone and the error is
+ * returned. If one of them fails to go down, the error is only logged, so that
+ * all of them get a chance to go down.
+ */
+static int lynx_init(struct phy *phy)
+{
+ struct lynx_lane *lane = phy_get_drvdata(phy);
+ struct phy *retimer;
+ int i, err, ret;
+
+ for (i = 0; i < lane->num_retimers; i++) {
+ retimer = lane->retimer[i];
+ err = phy_init(retimer);
+ if (err) {
+ dev_err(&phy->dev, "phy_init failed on %s: %pe\n",
+ dev_name(&retimer->dev), ERR_PTR(err));
+ goto err_exit_retimers;
+ }
+ }
+
+ err = lane->priv->drv_ops->init(phy);
+ if (err)
+ goto err_exit_retimers;
+
+ return 0;
+
+err_exit_retimers:
+ while (i--) {
+ retimer = lane->retimer[i];
+ ret = phy_exit(retimer);
+ if (ret)
+ dev_err(&phy->dev, "phy_exit failed on %s: %pe\n",
+ dev_name(&retimer->dev), ERR_PTR(ret));
+ }
+
+ return err;
+}
+
+static int lynx_exit(struct phy *phy)
+{
+ struct lynx_lane *lane = phy_get_drvdata(phy);
+ struct phy *retimer;
+ int i, err;
+
+ /* If the lane fails its .exit() callback, the PHY core does not
+ * decrement its init_count, and the consumer may retry. In that case,
+ * return directly without calling phy_exit() on the downstream retimer
+ * PHYs so that we avoid an unbalance of their init_count field.
+ */
+ err = lane->priv->drv_ops->exit(phy);
+ if (err)
+ return err;
+
+ /* A failure of a downstream PHY is only logged. There is no point
+ * stopping and returning an error.
+ */
+ for (i = 0; i < lane->num_retimers; i++) {
+ retimer = lane->retimer[i];
+ err = phy_exit(retimer);
+ if (err)
+ dev_err(&phy->dev, "phy_exit failed on %s: %pe\n",
+ dev_name(&retimer->dev), ERR_PTR(err));
+ }
+
+ return 0;
+}
+
+static int lynx_power_on(struct phy *phy)
+{
+ struct lynx_lane *lane = phy_get_drvdata(phy);
+ struct phy *retimer;
+ int i, err, ret;
+
+ for (i = 0; i < lane->num_retimers; i++) {
+ retimer = lane->retimer[i];
+ err = phy_power_on(retimer);
+ if (err) {
+ dev_err(&phy->dev, "phy_power_on failed on %s: %pe\n",
+ dev_name(&retimer->dev), ERR_PTR(err));
+ goto err_power_off_retimers;
+ }
+ }
+
+ err = lane->priv->drv_ops->power_on(phy);
+ if (err)
+ goto err_power_off_retimers;
+
+ return 0;
+
+err_power_off_retimers:
+ while (i--) {
+ retimer = lane->retimer[i];
+ ret = phy_power_off(retimer);
+ if (ret)
+ dev_err(&phy->dev, "phy_power_off failed on %s: %pe\n",
+ dev_name(&retimer->dev), ERR_PTR(ret));
+ }
+
+ return err;
+}
+
+static int lynx_power_off(struct phy *phy)
+{
+ struct lynx_lane *lane = phy_get_drvdata(phy);
+ struct phy *retimer;
+ int i, err;
+
+ /* If the lane fails to power_off, the PHY core keeps it counted as up,
+ * and the consumer may retry. Leave the downstream retimer PHYs of the
+ * lane up too, so that the retry does not take them down twice and
+ * unbalance their counters.
+ */
+ err = lane->priv->drv_ops->power_off(phy);
+ if (err)
+ return err;
+
+ /* A failure of a downstream PHY is only logged. Returning it would
+ * make the PHY core keep the lane counted as on, although its own op
+ * already turned it off, and a later phy_power_on() would then not
+ * turn it back on.
+ */
+ for (i = 0; i < lane->num_retimers; i++) {
+ retimer = lane->retimer[i];
+ err = phy_power_off(retimer);
+ if (err)
+ dev_err(&phy->dev, "phy_power_off failed on %s: %pe\n",
+ dev_name(&retimer->dev), ERR_PTR(err));
+ }
+
+ return 0;
+}
+
+/* There is no rollback if one of the PHYs fails, because there is no previous
+ * mode to go back to: the submode is not recorded by the PHY core or by the
+ * retimer drivers. The next phy_set_mode_ext() from the consumer reconfigures
+ * the whole signal path.
+ */
+static int lynx_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+ struct lynx_lane *lane = phy_get_drvdata(phy);
+ struct phy *retimer;
+ int i, err;
+
+ for (i = 0; i < lane->num_retimers; i++) {
+ retimer = lane->retimer[i];
+ err = phy_set_mode_ext(retimer, mode, submode);
+ if (err)
+ return err;
+ }
+
+ return lane->priv->drv_ops->set_mode(phy, mode, submode);
+}
+
+static int lynx_validate(struct phy *phy, enum phy_mode mode, int submode,
+ union phy_configure_opts *opts)
+{
+ struct lynx_lane *lane = phy_get_drvdata(phy);
+ struct phy *retimer;
+ int i, err;
+
+ for (i = 0; i < lane->num_retimers; i++) {
+ retimer = lane->retimer[i];
+ /* A retimer PHY that cannot validate the mode, including one
+ * without .validate (-EOPNOTSUPP), makes the lane fail as
+ * well.
+ */
+ err = phy_validate(retimer, mode, submode, opts);
+ if (err)
+ return err;
+ }
+
+ return lane->priv->drv_ops->validate(phy, mode, submode, opts);
+}
+
+/* The ops installed on the lane PHYs, for every lane. They call the ops of the
+ * driver, after the ones of the PHYs of the lane. .owner is not set here, see
+ * lynx_probe().
+ *
+ * The ops of the driver are called without checking for NULL: the Lynx 10G and
+ * 28G drivers, the only users of this core, implement all of them.
+ */
+static const struct phy_ops lynx_ops = {
+ .init = lynx_init,
+ .exit = lynx_exit,
+ .power_on = lynx_power_on,
+ .power_off = lynx_power_off,
+ .set_mode = lynx_set_mode,
+ .validate = lynx_validate,
+};
+
static int lynx_probe_lane(struct lynx_priv *priv, int id,
- struct device_node *dn,
- const struct phy_ops *phy_ops)
+ struct device_node *dn)
{
struct lynx_lane *lane = &priv->lane[id];
struct phy *phy;
@@ -386,7 +577,7 @@ static int lynx_probe_lane(struct lynx_priv *priv, int id,
if (err)
return err;
- phy = devm_phy_create(priv->dev, dn, phy_ops);
+ phy = devm_phy_create(priv->dev, dn, &priv->phy_ops);
if (IS_ERR(phy))
return PTR_ERR(phy);
@@ -400,7 +591,7 @@ static int lynx_probe_lane(struct lynx_priv *priv, int id,
}
int lynx_probe(struct platform_device *pdev, const struct lynx_info *info,
- const struct phy_ops *phy_ops)
+ const struct phy_ops *drv_ops)
{
struct device *dev = &pdev->dev;
struct phy_provider *provider;
@@ -423,6 +614,9 @@ int lynx_probe(struct platform_device *pdev, const struct lynx_info *info,
priv->dev = dev;
priv->info = info;
+ priv->drv_ops = drv_ops;
+ priv->phy_ops = lynx_ops;
+ priv->phy_ops.owner = drv_ops->owner;
priv->big_endian = device_property_read_bool(dev, "big-endian");
dev_set_drvdata(dev, priv);
spin_lock_init(&priv->pcc_lock);
@@ -467,7 +661,7 @@ int lynx_probe(struct platform_device *pdev, const struct lynx_info *info,
return -EINVAL;
}
- err = lynx_probe_lane(priv, reg, child, phy_ops);
+ err = lynx_probe_lane(priv, reg, child);
if (err) {
of_node_put(child);
return err;
@@ -475,7 +669,7 @@ int lynx_probe(struct platform_device *pdev, const struct lynx_info *info,
}
} else {
for (int i = priv->info->first_lane; i < priv->info->num_lanes; i++) {
- err = lynx_probe_lane(priv, i, NULL, phy_ops);
+ err = lynx_probe_lane(priv, i, NULL);
if (err)
return err;
}
diff --git a/drivers/phy/freescale/phy-fsl-lynx-core.h b/drivers/phy/freescale/phy-fsl-lynx-core.h
index c2ad81a9144b..88a9de75a134 100644
--- a/drivers/phy/freescale/phy-fsl-lynx-core.h
+++ b/drivers/phy/freescale/phy-fsl-lynx-core.h
@@ -70,6 +70,14 @@ struct lynx_priv {
struct lynx_pll pll[LYNX_NUM_PLL];
struct lynx_lane *lane;
+ /* PHY ops defined by the driver - either Lynx10G or Lynx28G */
+ const struct phy_ops *drv_ops;
+ /* Lynx core ops which take care of any possible downstream retimer
+ * PHYs as well as calling the driver callbacks. Cannot be const
+ * because the .owner field needs to be copied from the drv_ops.
+ */
+ struct phy_ops phy_ops;
+
struct delayed_work cdr_check;
};
@@ -115,7 +123,7 @@ static inline void lynx_rmw(struct lynx_priv *priv, unsigned long off, u32 val,
lynx_read((pll)->priv, reg((pll)->id))
int lynx_probe(struct platform_device *pdev, const struct lynx_info *info,
- const struct phy_ops *phy_ops);
+ const struct phy_ops *drv_ops);
void lynx_remove(struct platform_device *pdev);
const char *lynx_lane_mode_str(enum lynx_lane_mode lane_mode);
--
2.25.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 5+ messages in thread