]> git.baikalelectronics.ru Git - uboot.git/commitdiff
net: enetc: require a PHY device when probing
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 29 Jun 2021 17:53:15 +0000 (20:53 +0300)
committerRamon Fried <rfried.dev@gmail.com>
Tue, 6 Jul 2021 02:22:41 +0000 (05:22 +0300)
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.

Copyright updated according to corporate requirements.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
drivers/net/fsl_enetc.c

index f6fc7801b95bca2c2d4622f76a915dec8c462955..9c198a1039d27b6b74dc40d5d7acafa640792b32 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * ENETC ethernet controller driver
- * Copyright 2017-2019 NXP
+ * Copyright 2017-2021 NXP
  */
 
 #include <common.h>
@@ -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;
 }