aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fec_mpc52xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/fec_mpc52xx.c')
-rw-r--r--drivers/net/fec_mpc52xx.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index a67f29017a4e..2d0a198882ab 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -271,15 +271,6 @@ static void mpc52xx_fec_phy_stop(struct net_device *dev)
271 phy_write(priv->phydev, MII_BMCR, BMCR_PDOWN); 271 phy_write(priv->phydev, MII_BMCR, BMCR_PDOWN);
272} 272}
273 273
274static int mpc52xx_fec_phy_mii_ioctl(struct mpc52xx_fec_priv *priv,
275 struct mii_ioctl_data *mii_data, int cmd)
276{
277 if (!priv->phydev)
278 return -ENOTSUPP;
279
280 return phy_mii_ioctl(priv->phydev, mii_data, cmd);
281}
282
283static void mpc52xx_fec_phy_hw_init(struct mpc52xx_fec_priv *priv) 274static void mpc52xx_fec_phy_hw_init(struct mpc52xx_fec_priv *priv)
284{ 275{
285 struct mpc52xx_fec __iomem *fec = priv->fec; 276 struct mpc52xx_fec __iomem *fec = priv->fec;
@@ -852,12 +843,20 @@ static void mpc52xx_fec_get_drvinfo(struct net_device *dev,
852static int mpc52xx_fec_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 843static int mpc52xx_fec_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
853{ 844{
854 struct mpc52xx_fec_priv *priv = netdev_priv(dev); 845 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
846
847 if (!priv->phydev)
848 return -ENODEV;
849
855 return phy_ethtool_gset(priv->phydev, cmd); 850 return phy_ethtool_gset(priv->phydev, cmd);
856} 851}
857 852
858static int mpc52xx_fec_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 853static int mpc52xx_fec_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
859{ 854{
860 struct mpc52xx_fec_priv *priv = netdev_priv(dev); 855 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
856
857 if (!priv->phydev)
858 return -ENODEV;
859
861 return phy_ethtool_sset(priv->phydev, cmd); 860 return phy_ethtool_sset(priv->phydev, cmd);
862} 861}
863 862
@@ -887,7 +886,10 @@ static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
887{ 886{
888 struct mpc52xx_fec_priv *priv = netdev_priv(dev); 887 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
889 888
890 return mpc52xx_fec_phy_mii_ioctl(priv, if_mii(rq), cmd); 889 if (!priv->phydev)
890 return -ENOTSUPP;
891
892 return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
891} 893}
892 894
893static const struct net_device_ops mpc52xx_fec_netdev_ops = { 895static const struct net_device_ops mpc52xx_fec_netdev_ops = {