]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
net: phy: marvell: Call phy_reset() where possible
authorStefan Roese <sr@denx.de>
Wed, 10 Feb 2016 06:06:05 +0000 (07:06 +0100)
committerJoe Hershberger <joe.hershberger@ni.com>
Thu, 18 Feb 2016 17:32:00 +0000 (11:32 -0600)
Instead of coding the soft PHY reset function multiple times in marvell.c,
lets call the common phy_reset() function from phy.c.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Hao Zhang <hzhang@ti.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/phy/marvell.c

index eab15585c31a9d160b9fb05f4e783474821db438..6e3dc8537967a7deff790453c2b900acc70d53ef 100644 (file)
@@ -172,7 +172,6 @@ static int m88e1011s_startup(struct phy_device *phydev)
 static int m88e1111s_config(struct phy_device *phydev)
 {
        int reg;
-       int timeout;
 
        if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
                        (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
@@ -236,16 +235,7 @@ static int m88e1111s_config(struct phy_device *phydev)
                        MIIM_88E1111_PHY_EXT_SR, reg);
 
                /* soft reset */
-               timeout = 1000;
-               phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
-               udelay(1000);
-               reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
-               while ((reg & BMCR_RESET) && --timeout) {
-                       udelay(1000);
-                       reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
-               }
-               if (!timeout)
-                       printf("%s: phy soft reset timeout\n", __func__);
+               phy_reset(phydev);
 
                reg = phy_read(phydev, MDIO_DEVAD_NONE,
                        MIIM_88E1111_PHY_EXT_SR);
@@ -258,16 +248,7 @@ static int m88e1111s_config(struct phy_device *phydev)
        }
 
        /* soft reset */
-       timeout = 1000;
-       phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
-       udelay(1000);
-       reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
-       while ((reg & BMCR_RESET) && --timeout) {
-               udelay(1000);
-               reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
-       }
-       if (!timeout)
-               printf("%s: phy soft reset timeout\n", __func__);
+       phy_reset(phydev);
 
        genphy_config_aneg(phydev);