LKML Archive on
help / color / mirror / Atom feed
From: Vladimir Oltean <>
To: Horatiu Vultur <>
Cc: Claudiu Manoil <>,
	"" <>,
	"" <>,
	"" <>,
	"" <>,
	"" <>,
	"" <>
Subject: Re: [PATCH net-next] net: mscc: ocelot: Fix probe for vsc7514
Date: Tue, 17 Aug 2021 12:24:12 +0000	[thread overview]
Message-ID: <20210817122412.6zjvjbfk3dnyh6uz@skbuf> (raw)
In-Reply-To: <>

Hi Horatiu,

On Tue, Aug 17, 2021 at 02:06:33PM +0200, Horatiu Vultur wrote:
> The check for parsing the 'phy-handle' was removed in the blamed commit.
> Therefor it would try to create phylinks for each port and connect to
> the phys. But on ocelot_pcb123 and ocelot_pcb120 not all the ports have
> a phy, so this will failed. So the probe of the network driver will
> fail.
> The fix consists in adding back the check for 'phy-handle' for vsc7514
> Fixes: e6e12df625f2 ("net: mscc: ocelot: convert to phylink")
> Signed-off-by: Horatiu Vultur <>
> ---
>  drivers/net/ethernet/mscc/ocelot_vsc7514.c | 3 +++
>  1 file changed, 3 insertions(+)
> diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
> index 18aed504f45d..96ac64f13382 100644
> --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c
> +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
> @@ -954,6 +954,9 @@ static int mscc_ocelot_init_ports(struct platform_device *pdev,
>  		if (of_property_read_u32(portnp, "reg", &reg))
>  			continue;
> +		if (!of_parse_phandle(portnp, "phy-handle", 0))
> +			continue;
> +
>  		port = reg;
>  		if (port < 0 || port >= ocelot->num_phys_ports) {
>  			dev_err(ocelot->dev,
> -- 
> 2.31.1

Thanks a lot for taking the time to test!

What do you think about this alternative? It should not limit the driver
to only having phy-handle (having a fixed-link is valid too):

-----------------------------[ cut here ]-----------------------------
From 598f7795389fb127726de199bb77fd7ddf5df096 Mon Sep 17 00:00:00 2001
From: Vladimir Oltean <>
Date: Tue, 17 Aug 2021 15:14:57 +0300
Subject: [PATCH] net: mscc: ocelot: allow probing to continue with ports that
 fail to register

The existing ocelot device trees, like ocelot_pcb123.dts for example,
have SERDES ports (ports 4 and higher) that do not have status = "disabled";
but on the other hand do not have a phy-handle or a fixed-link either.

So from the perspective of phylink, they have broken DT bindings.

Since the blamed commit, probing for the entire switch will fail when
such a device tree binding is encountered on a port. There used to be
this piece of code which skipped ports without a phy-handle:

	phy_node = of_parse_phandle(portnp, "phy-handle", 0);
	if (!phy_node)

but now it is gone.

Anyway, fixed-link setups are a thing which should work out of the box
with phylink, so it would not be in the best interest of the driver to
add that check back.

Instead, let's look at what other drivers do. Since commit 86f8b1c01a0a
("net: dsa: Do not make user port errors fatal"), DSA continues after a
switch port fails to register, and works only with the ports that

We can achieve the same behavior in ocelot by unregistering the devlink
port for ports where ocelot_port_phylink_create() failed (called via
ocelot_probe_port), and clear the bit in devlink_ports_registered for
that port. This will make the next iteration reconsider the port that
failed to probe as an unused port, and re-register a devlink port of
type UNUSED for it. No other cleanup should need to be performed, since
ocelot_probe_port() should be self-contained when it fails.

Fixes: e6e12df625f2 ("net: mscc: ocelot: convert to phylink")
Signed-off-by: Vladimir Oltean <>
 drivers/net/ethernet/mscc/ocelot_vsc7514.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
index 18aed504f45d..291ae6817c26 100644
--- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c
+++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
@@ -978,14 +978,15 @@ static int mscc_ocelot_init_ports(struct platform_device *pdev,
 			goto out_teardown;
-		devlink_ports_registered |= BIT(port);
 		err = ocelot_probe_port(ocelot, port, target, portnp);
 		if (err) {
-			of_node_put(portnp);
-			goto out_teardown;
+			ocelot_port_devlink_teardown(ocelot, port);
+			continue;
+		devlink_ports_registered |= BIT(port);
 		ocelot_port = ocelot->ports[port];
 		priv = container_of(ocelot_port, struct ocelot_port_private,
-----------------------------[ cut here ]-----------------------------

  reply	other threads:[~2021-08-17 12:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 12:06 Horatiu Vultur
2021-08-17 12:24 ` Vladimir Oltean [this message]
2021-08-18  7:32   ` Horatiu Vultur

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:

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

  git send-email \
    --in-reply-to=20210817122412.6zjvjbfk3dnyh6uz@skbuf \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH net-next] net: mscc: ocelot: Fix probe for vsc7514' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).