Thread (35 messages) 35 messages, 5 authors, 2018-08-27

Re: [PATCH net-next 10/10] net: mscc: ocelot: make use of SerDes PHYs for handling their configuration

From: Quentin Schulz <hidden>
Date: 2018-08-01 07:52:00
Also in: linux-mips, lkml, netdev

Hi Andrew,

On Mon, Jul 30, 2018 at 03:50:18PM +0200, Andrew Lunn wrote:
 On Mon, Jul 30, 2018 at 02:43:55PM +0200, Quentin Schulz wrote:
quoted
+		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.
I'll replace this with a switch case to handle other cases.
quoted
+
+		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.
Ack.
quoted
+				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?
Ack.

Thanks,
Quentin

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help