[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180730135018.GF13198@lunn.ch>
Date: Mon, 30 Jul 2018 15:50:18 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Quentin Schulz <quentin.schulz@...tlin.com>
Cc: alexandre.belloni@...tlin.com, ralf@...ux-mips.org,
paul.burton@...s.com, jhogan@...nel.org, robh+dt@...nel.org,
mark.rutland@....com, davem@...emloft.net, kishon@...com,
f.fainelli@...il.com, linux-mips@...ux-mips.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, allan.nielsen@...rosemi.com,
thomas.petazzoni@...tlin.com
Subject: Re: [PATCH net-next 10/10] net: mscc: ocelot: make use of SerDes
PHYs for handling their configuration
On Mon, Jul 30, 2018 at 02:43:55PM +0200, Quentin Schulz wrote:
> + err = of_get_phy_mode(portnp);
> + if (err < 0)
> + ocelot->ports[port]->phy_mode = PHY_INTERFACE_MODE_NA;
> + else
> + ocelot->ports[port]->phy_mode = err;
> +
> + if (ocelot->ports[port]->phy_mode == PHY_INTERFACE_MODE_NA)
> + continue;
> +
> + if (ocelot->ports[port]->phy_mode == PHY_INTERFACE_MODE_SGMII)
> + phy_mode = PHY_MODE_SGMII;
> + else
> + phy_mode = PHY_MODE_QSGMII;
Hi Quentin
Say somebody puts RGMII as the phy-mode? It would be better to verify
it is only SGMII or QSGMII and return -EINVAL otherwise.
> +
> + serdes = devm_of_phy_get(ocelot->dev, portnp, NULL);
> + if (IS_ERR(serdes)) {
> + if (PTR_ERR(serdes) == -EPROBE_DEFER) {
> + dev_err(ocelot->dev, "deferring probe\n");
dev_dbg() ? It is not really an error.
> + err = -EPROBE_DEFER;
> + goto err_probe_ports;
> + }
> +
> + dev_err(ocelot->dev, "missing SerDes phys for port%d\n",
> + port);
> + err = -ENODEV;
err = PTR_ERR(serdes) so we get the actual error?
> goto err_probe_ports;
> }
> +
> + ocelot->ports[port]->serdes = serdes;
> }
>
> register_netdevice_notifier(&ocelot_netdevice_nb);
Andrew
Powered by blists - more mailing lists