From f923ded1f3a67416183d3994ac10ce08408b4e57 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Wed, 23 Jun 2021 15:28:20 +0300 Subject: [PATCH] net: ldpaa_eth: connect to multiple PHYs/retimers There are cases where multiple retimers are needed for a single port. This is the case of the M8 mezzanine card used on the LX2160AQDS boards, where 2 Inphi IN112525 S05 retimers are needed for a 100G port. In this case we need to specify 2 PHYs in the phy-handle property so that both retimers are initialized. Signed-off-by: Ioana Ciornei --- drivers/net/ldpaa_eth/ldpaa_eth.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c index 725173f6273..1227417425d 100644 --- a/drivers/net/ldpaa_eth/ldpaa_eth.c +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2014-2016 Freescale Semiconductor, Inc. - * Copyright 2017 NXP + * Copyright 2017-2021 NXP */ #include @@ -25,11 +25,11 @@ #ifdef CONFIG_PHYLIB #ifdef CONFIG_DM_ETH -static void init_phy(struct udevice *dev) +static void init_phy(struct udevice *dev, int i) { struct ldpaa_eth_priv *priv = dev_get_priv(dev); - priv->phy = dm_eth_phy_connect(dev); + priv->phy = dm_eth_phy_connect_index(dev, i); if (!priv->phy) return; @@ -1101,14 +1101,17 @@ static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv) static int ldpaa_eth_probe(struct udevice *dev) { struct ofnode_phandle_args phandle; + int i; - /* Nothing to do if there is no "phy-handle" in the DTS node */ - if (dev_read_phandle_with_args(dev, "phy-handle", NULL, - 0, 0, &phandle)) { - return 0; - } + for (i = 0; i < WRIOP_MAX_PHY_NUM; i++) { + /* Nothing to do if there is no "phy-handle" in the DTS node */ + if (dev_read_phandle_with_args(dev, "phy-handle", NULL, + 0, i, &phandle)) { + return 0; + } - init_phy(dev); + init_phy(dev, i); + } return 0; }