Re: [PATCH net-next] net: stmmac: Fix the case when PHY handle is not present

From: Sergei Shtylyov
Date: Tue Jun 25 2019 - 06:51:44 EST


On 25.06.2019 13:29, Sergei Shtylyov wrote:

Some DT bindings do not have the PHY handle. Let's fallback to manually
discovery in case phylink_of_phy_connect() fails.

Reported-by: Katsuhiro Suzuki <katsuhiro@xxxxxxxxxxxxx>
Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic")
Signed-off-by: Jose Abreu <joabreu@xxxxxxxxxxxx>
Cc: Joao Pinto <jpinto@xxxxxxxxxxxx>
Cc: David S. Miller <davem@xxxxxxxxxxxxx>
Cc: Giuseppe Cavallaro <peppe.cavallaro@xxxxxx>
Cc: Alexandre Torgue <alexandre.torgue@xxxxxx>
---
Hello Katsuhiro,

Can you please test this patch ?
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a48751989fa6..f4593d2d9d20 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -950,9 +950,12 @@ static int stmmac_init_phy(struct net_device *dev)
ÂÂÂÂÂ node = priv->plat->phylink_node;
-ÂÂÂ if (node) {
+ÂÂÂ if (node)
ÂÂÂÂÂÂÂÂÂ ret = phylink_of_phy_connect(priv->phylink, node, 0);
-ÂÂÂ } else {
+
+ÂÂÂ /* Some DT bindings do not set-up the PHY handle. Let's try to
+ÂÂÂÂ * manually parse it */

ÂÂ The multi-line comments inb the networking code should be formatted like below:

ÂÂÂÂ/*
ÂÂÂÂ * bla

Oops, that was the general comment format, networking code starts without the leading empty line:\

/* bla
ÂÂÂÂ * bla
ÂÂÂÂ */
[...]

MBR, Sergei