MLK-10919 net: phy: micrel: add ksz8081 resume function
authorFugang Duan <b38611@freescale.com>
Mon, 27 Jul 2015 07:40:00 +0000 (15:40 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:46:49 +0000 (14:46 -0500)
Add ksz8081 resume function since the phy has some non-standard
register init process that has some fixup.

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 65c6e997b8e020b9e87d1af23c94c15c13e3d2e3)

drivers/net/phy/micrel.c
drivers/net/phy/phy_device.c
include/linux/phy.h

index 2032a6d..52c24ac 100644 (file)
@@ -788,6 +788,22 @@ static int kszphy_probe(struct phy_device *phydev)
        return 0;
 }
 
+static int ksz8081_resume(struct phy_device *phydev)
+{
+       int value;
+
+       mutex_lock(&phydev->lock);
+       value = phy_read(phydev, MII_BMCR);
+       phy_write(phydev, MII_BMCR, value & ~BMCR_PDOWN);
+
+       value = phy_scan_fixups(phydev);
+       if (value < 0)
+               return value;
+       mutex_unlock(&phydev->lock);
+
+       return 0;
+}
+
 static struct phy_driver ksphy_driver[] = {
 {
        .phy_id         = PHY_ID_KS8737,
@@ -936,7 +952,7 @@ static struct phy_driver ksphy_driver[] = {
        .get_strings    = kszphy_get_strings,
        .get_stats      = kszphy_get_stats,
        .suspend        = kszphy_suspend,
-       .resume         = kszphy_resume,
+       .resume         = ksz8081_resume,
 }, {
        .phy_id         = PHY_ID_KSZ8061,
        .name           = "Micrel KSZ8061",
index bf02f8e..74690cd 100644 (file)
@@ -252,7 +252,7 @@ static int phy_needs_fixup(struct phy_device *phydev, struct phy_fixup *fixup)
 }
 
 /* Runs any matching fixups for this phydev */
-static int phy_scan_fixups(struct phy_device *phydev)
+int phy_scan_fixups(struct phy_device *phydev)
 {
        struct phy_fixup *fixup;
 
@@ -272,6 +272,7 @@ static int phy_scan_fixups(struct phy_device *phydev)
 
        return 0;
 }
+EXPORT_SYMBOL(phy_scan_fixups);
 
 static int phy_bus_match(struct device *dev, struct device_driver *drv)
 {
index 867110c..cc374eb 100644 (file)
@@ -833,6 +833,7 @@ void phy_print_status(struct phy_device *phydev);
 void phy_device_free(struct phy_device *phydev);
 int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
 
+int phy_scan_fixups(struct phy_device *phydev);
 int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
                       int (*run)(struct phy_device *));
 int phy_register_fixup_for_id(const char *bus_id,