U-boot Archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	u-boot@lists.denx.de
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>,
	Priyanka Jain <priyanka.jain@nxp.com>,
	Bin Meng <bmeng.cn@gmail.com>
Subject: [PATCH 5/6] drivers: net: fsl_enetc: require a PHY device when probing
Date: Thu, 17 Jun 2021 17:35:53 +0300	[thread overview]
Message-ID: <20210617143554.2104712-6-vladimir.oltean@nxp.com> (raw)
In-Reply-To: <20210617143554.2104712-1-vladimir.oltean@nxp.com>

Given that even a fixed-link has an associated phy_device, there is no
reason to operate in a mode when dm_eth_phy_connect fails.

Remove the driver checks for a NULL priv->phy and just return -ENODEV
when that happens.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/fsl_enetc.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c
index f6fc7801b95b..5961775024ff 100644
--- a/drivers/net/fsl_enetc.c
+++ b/drivers/net/fsl_enetc.c
@@ -281,21 +281,20 @@ static void enetc_start_pcs(struct udevice *dev)
 }
 
 /* Configure the actual/external ethernet PHY, if one is found */
-static void enetc_config_phy(struct udevice *dev)
+static int enetc_config_phy(struct udevice *dev)
 {
 	struct enetc_priv *priv = dev_get_priv(dev);
 	int supported;
 
 	priv->phy = dm_eth_phy_connect(dev);
-
 	if (!priv->phy)
-		return;
+		return -ENODEV;
 
 	supported = PHY_GBIT_FEATURES | SUPPORTED_2500baseX_Full;
 	priv->phy->supported &= supported;
 	priv->phy->advertising &= supported;
 
-	phy_config(priv->phy);
+	return phy_config(priv->phy);
 }
 
 /*
@@ -335,9 +334,8 @@ static int enetc_probe(struct udevice *dev)
 	dm_pci_clrset_config16(dev, PCI_COMMAND, 0, PCI_COMMAND_MEMORY);
 
 	enetc_start_pcs(dev);
-	enetc_config_phy(dev);
 
-	return 0;
+	return enetc_config_phy(dev);
 }
 
 /*
@@ -550,8 +548,7 @@ static int enetc_start(struct udevice *dev)
 
 	enetc_setup_mac_iface(dev);
 
-	if (priv->phy)
-		phy_startup(priv->phy);
+	phy_startup(priv->phy);
 
 	return 0;
 }
-- 
2.25.1


  parent reply	other threads:[~2021-06-17 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 14:35 [PATCH 0/6] Fixes for the NXP LS1028A-QDS boards Vladimir Oltean
2021-06-17 14:35 ` [PATCH 1/6] arm: dts: ls1028a: enable the switch CPU port for the LS1028A-QDS Vladimir Oltean
2021-06-17 14:35 ` [PATCH 2/6] arm: dts: ls1028a: enable internal RGMII delays for the LS1028A-QDS AR8035 PHY Vladimir Oltean
2021-06-17 14:35 ` [PATCH 3/6] arm: dts: ls1028a: declare the fixed-link speeds for the internal ENETC ports Vladimir Oltean
2021-06-17 14:35 ` [PATCH 4/6] arm: dts: ls1028a: disable enetc-2 by default Vladimir Oltean
2021-06-17 14:35 ` Vladimir Oltean [this message]
2021-06-17 18:06   ` [PATCH 5/6] drivers: net: fsl_enetc: require a PHY device when probing Ramon Fried
2021-06-17 14:35 ` [PATCH 6/6] drivers: net: fsl_enetc: force the RGMII MAC speed/duplex instead of using in-band signaling Vladimir Oltean
2021-06-17 18:08   ` Ramon Fried

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=20210617143554.2104712-6-vladimir.oltean@nxp.com \
    --to=vladimir.oltean@nxp.com \
    --cc=bmeng.cn@gmail.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=joe.hershberger@ni.com \
    --cc=priyanka.jain@nxp.com \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).