netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH] net: gemini: Try to register phy before netdev
@ 2020-09-05 10:45 Linus Walleij
  2020-09-05 15:50 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2020-09-05 10:45 UTC (permalink / raw)
  To: netdev, David S . Miller; +Cc: Hans Ulli Kroll, Linus Walleij

It's nice if the phy is online before we register the netdev
so try to do that first.

Reported-by: David Miller <davem@davemloft.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/net/ethernet/cortina/gemini.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index ffec0f3dd957..cf4dc6345f0d 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -2505,6 +2505,11 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
 	if (ret)
 		goto unprepare;
 
+	ret = gmac_setup_phy(netdev);
+	if (ret)
+		netdev_info(netdev,
+			    "PHY init failed, deferring to ifup time\n");
+
 	ret = register_netdev(netdev);
 	if (ret)
 		goto unprepare;
@@ -2513,10 +2518,6 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
 		    "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n",
 		    port->irq, &dmares->start,
 		    &gmacres->start);
-	ret = gmac_setup_phy(netdev);
-	if (ret)
-		netdev_info(netdev,
-			    "PHY init failed, deferring to ifup time\n");
 	return 0;
 
 unprepare:
-- 
2.26.2


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

* Re: [net-next PATCH] net: gemini: Try to register phy before netdev
  2020-09-05 10:45 [net-next PATCH] net: gemini: Try to register phy before netdev Linus Walleij
@ 2020-09-05 15:50 ` Andrew Lunn
  2020-09-05 20:41   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-09-05 15:50 UTC (permalink / raw)
  To: Linus Walleij; +Cc: netdev, David S . Miller, Hans Ulli Kroll

On Sat, Sep 05, 2020 at 12:45:30PM +0200, Linus Walleij wrote:
> It's nice if the phy is online before we register the netdev
> so try to do that first.

Hi Linus

The PHY handling in this driver is all a bit odd.

gmac_open() will also try to connect the PHY if it has not already
been found. gmac_stop() does not seem to have a symmetrical
phy_disconnect. However, gmac_uninit does?

I do wonder if more cleanup should be done while you are at it?

    Andrew

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

* Re: [net-next PATCH] net: gemini: Try to register phy before netdev
  2020-09-05 15:50 ` Andrew Lunn
@ 2020-09-05 20:41   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-09-05 20:41 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev, David S . Miller, Hans Ulli Kroll

On Sat, Sep 5, 2020 at 5:50 PM Andrew Lunn <andrew@lunn.ch> wrote:

> The PHY handling in this driver is all a bit odd.
>
> gmac_open() will also try to connect the PHY if it has not already
> been found. gmac_stop() does not seem to have a symmetrical
> phy_disconnect. However, gmac_uninit does?
>
> I do wonder if more cleanup should be done while you are at it?

OK I send a new more invasive version :)

Thanks,
Linus Walleij

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

end of thread, other threads:[~2020-09-05 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05 10:45 [net-next PATCH] net: gemini: Try to register phy before netdev Linus Walleij
2020-09-05 15:50 ` Andrew Lunn
2020-09-05 20:41   ` Linus Walleij

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