netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Milind Parab <mparab@cadence.com>
To: <nicolas.nerre@microchip.com>, <andrew@lunn.ch>,
	<antoine.tenart@bootlin.com>, <f.fainelli@gmail.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<hkallweit1@gmail.com>, <linux-kernel@vger.kernel.org>,
	<dkangude@cadence.com>, <a.fatoum@pengutronix.de>,
	<brad.mouring@ni.com>, <rmk+kernel@armlinux.org.uk>,
	<pthombar@cadence.com>, Milind Parab <mparab@cadence.com>
Subject: [PATCH 1/3] net: macb: fix for fixed-link mode
Date: Mon, 9 Dec 2019 11:14:21 +0000	[thread overview]
Message-ID: <1575890061-24250-1-git-send-email-mparab@cadence.com> (raw)
In-Reply-To: <1575890033-23846-1-git-send-email-mparab@cadence.com>

This patch fix the issue with fixed link. With fixed-link
device opening fails due to macb_phylink_connect not
handling fixed-link mode, in which case no MAC-PHY connection
is needed and phylink_connect return success (0), however
in current driver attempt is made to search and connect to
PHY even for fixed-link.

Signed-off-by: Milind Parab <mparab@cadence.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 9c767ee252ac..6b68ef34ab19 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -615,17 +615,13 @@ static int macb_phylink_connect(struct macb *bp)
 {
 	struct net_device *dev = bp->dev;
 	struct phy_device *phydev;
+	struct device_node *dn = bp->pdev->dev.of_node;
 	int ret;
 
-	if (bp->pdev->dev.of_node &&
-	    of_parse_phandle(bp->pdev->dev.of_node, "phy-handle", 0)) {
-		ret = phylink_of_phy_connect(bp->phylink, bp->pdev->dev.of_node,
-					     0);
-		if (ret) {
-			netdev_err(dev, "Could not attach PHY (%d)\n", ret);
-			return ret;
-		}
-	} else {
+	if (dn)
+		ret = phylink_of_phy_connect(bp->phylink, dn, 0);
+
+	if (!dn || (ret && !of_parse_phandle(dn, "phy-handle", 0))) {
 		phydev = phy_find_first(bp->mii_bus);
 		if (!phydev) {
 			netdev_err(dev, "no PHY found\n");
@@ -638,6 +634,9 @@ static int macb_phylink_connect(struct macb *bp)
 			netdev_err(dev, "Could not attach to PHY (%d)\n", ret);
 			return ret;
 		}
+	} else if (ret) {
+		netdev_err(dev, "Could not attach PHY (%d)\n", ret);
+		return ret;
 	}
 
 	phylink_start(bp->phylink);
-- 
2.17.1


  reply	other threads:[~2019-12-09 11:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 11:13 [PATCH 0/3] net: macb: fix for fixed link, support for c45 mdio and 10G Milind Parab
2019-12-09 11:14 ` Milind Parab [this message]
2019-12-09 11:26   ` [PATCH 1/3] net: macb: fix for fixed-link mode Russell King - ARM Linux admin
2019-12-10  9:14     ` Milind Parab
2019-12-10 11:38       ` Russell King - ARM Linux admin
2019-12-11  8:21         ` Milind Parab
2019-12-09 11:15 ` [PATCH 2/3] net: macb: add support for C45 MDIO read/write Milind Parab
2019-12-09 11:16 ` [PATCH 3/3] net: macb: add support for high speed interface Milind Parab
2019-12-09 11:36   ` Russell King - ARM Linux admin
2019-12-10 11:20     ` Milind Parab
2019-12-10 13:33       ` Andrew Lunn
2019-12-11  9:20         ` Milind Parab
     [not found]       ` <20191210114053.GU25745@shell.armlinux.org.uk>
     [not found]         ` <BY5PR07MB65147AEF32345E351E920188D35A0@BY5PR07MB6514.namprd07.prod.outlook.com>
2019-12-11  9:37           ` Russell King - ARM Linux admin
2019-12-11 11:55             ` Milind Parab
  -- strict thread matches above, loose matches on Subject: below --
2019-11-26  9:09 [PATCH 0/3] net: macb: cover letter Milind Parab
2019-11-26  9:09 ` [PATCH 1/3] net: macb: fix for fixed-link mode Milind Parab
2019-11-26 14:30   ` Andrew Lunn
2019-11-27 18:02   ` Nicolas.Ferre
2019-11-28  6:50     ` Milind Parab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1575890061-24250-1-git-send-email-mparab@cadence.com \
    --to=mparab@cadence.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=antoine.tenart@bootlin.com \
    --cc=brad.mouring@ni.com \
    --cc=davem@davemloft.net \
    --cc=dkangude@cadence.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.nerre@microchip.com \
    --cc=pthombar@cadence.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).