netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: fec: Issue error for missing but expected PHY
@ 2017-07-30 20:11 Andrew Lunn
  2017-07-31  1:42 ` Andy Duan
  2017-07-31  2:26 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Lunn @ 2017-07-30 20:11 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Fugang Duan, Andrew Lunn

If the PHY is missing but expected, e.g. because of a typ0 in the dt
file, it is not possible to open the interface. ip link returns:

RTNETLINK answers: No such device

It is not very obvious what the problem is. Add a netdev_err() in this
case to make it easier to debug the issue.

[   21.409385] fec 2188000.ethernet eth0: Unable to connect to phy
RTNETLINK answers: No such device

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/ethernet/freescale/fec_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index cc0c2a58c4de..c5995f07f821 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1907,8 +1907,10 @@ static int fec_enet_mii_probe(struct net_device *ndev)
 		phy_dev = of_phy_connect(ndev, fep->phy_node,
 					 &fec_enet_adjust_link, 0,
 					 fep->phy_interface);
-		if (!phy_dev)
+		if (!phy_dev) {
+			netdev_err(ndev, "Unable to connect to phy\n");
 			return -ENODEV;
+		}
 	} else {
 		/* check for attached phy */
 		for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH net-next] net: fec: Issue error for missing but expected PHY
  2017-07-30 20:11 [PATCH net-next] net: fec: Issue error for missing but expected PHY Andrew Lunn
@ 2017-07-31  1:42 ` Andy Duan
  2017-07-31  2:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Duan @ 2017-07-31  1:42 UTC (permalink / raw)
  To: Andrew Lunn, David Miller; +Cc: netdev

From: Andrew Lunn <andrew@lunn.ch> Sent: Monday, July 31, 2017 4:11 AM
>If the PHY is missing but expected, e.g. because of a typ0 in the dt file, it is not
>possible to open the interface. ip link returns:
>
>RTNETLINK answers: No such device
>
>It is not very obvious what the problem is. Add a netdev_err() in this case to
>make it easier to debug the issue.
>
>[   21.409385] fec 2188000.ethernet eth0: Unable to connect to phy
>RTNETLINK answers: No such device
>
>Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Acked-by: Fugang Duan <fugang.duan@nxp.com>

>---
> drivers/net/ethernet/freescale/fec_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/freescale/fec_main.c
>b/drivers/net/ethernet/freescale/fec_main.c
>index cc0c2a58c4de..c5995f07f821 100644
>--- a/drivers/net/ethernet/freescale/fec_main.c
>+++ b/drivers/net/ethernet/freescale/fec_main.c
>@@ -1907,8 +1907,10 @@ static int fec_enet_mii_probe(struct net_device
>*ndev)
> 		phy_dev = of_phy_connect(ndev, fep->phy_node,
> 					 &fec_enet_adjust_link, 0,
> 					 fep->phy_interface);
>-		if (!phy_dev)
>+		if (!phy_dev) {
>+			netdev_err(ndev, "Unable to connect to phy\n");
> 			return -ENODEV;
>+		}
> 	} else {
> 		/* check for attached phy */
> 		for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
>--
>2.13.2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: fec: Issue error for missing but expected PHY
  2017-07-30 20:11 [PATCH net-next] net: fec: Issue error for missing but expected PHY Andrew Lunn
  2017-07-31  1:42 ` Andy Duan
@ 2017-07-31  2:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-07-31  2:26 UTC (permalink / raw)
  To: andrew; +Cc: netdev, fugang.duan

From: Andrew Lunn <andrew@lunn.ch>
Date: Sun, 30 Jul 2017 22:11:06 +0200

> If the PHY is missing but expected, e.g. because of a typ0 in the dt
> file, it is not possible to open the interface. ip link returns:
> 
> RTNETLINK answers: No such device
> 
> It is not very obvious what the problem is. Add a netdev_err() in this
> case to make it easier to debug the issue.
> 
> [   21.409385] fec 2188000.ethernet eth0: Unable to connect to phy
> RTNETLINK answers: No such device
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-31  2:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-30 20:11 [PATCH net-next] net: fec: Issue error for missing but expected PHY Andrew Lunn
2017-07-31  1:42 ` Andy Duan
2017-07-31  2:26 ` David Miller

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