]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: phy: realtek: add delay to resume path of certain internal PHY's
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 18 Apr 2020 20:08:51 +0000 (22:08 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Apr 2020 18:12:29 +0000 (11:12 -0700)
Internal PHY's from RTL8168h up may not be instantly ready after calling
genphy_resume(). So far r8169 network driver adds the needed delay, but
better handle this in the PHY driver. The network driver may miss other
places where the PHY is resumed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/realtek.c

index 2d99e9de6ee1bb8f9879701fe09ef3fb29fbf7e7..c7229d022a27b466fc6509dba721942e2e94a36d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/bitops.h>
 #include <linux/phy.h>
 #include <linux/module.h>
+#include <linux/delay.h>
 
 #define RTL821x_PHYSR                          0x11
 #define RTL821x_PHYSR_DUPLEX                   BIT(13)
@@ -526,6 +527,16 @@ static int rtl8125_match_phy_device(struct phy_device *phydev)
               rtlgen_supports_2_5gbps(phydev);
 }
 
+static int rtlgen_resume(struct phy_device *phydev)
+{
+       int ret = genphy_resume(phydev);
+
+       /* Internal PHY's from RTL8168h up may not be instantly ready */
+       msleep(20);
+
+       return ret;
+}
+
 static struct phy_driver realtek_drvs[] = {
        {
                PHY_ID_MATCH_EXACT(0x00008201),
@@ -609,7 +620,7 @@ static struct phy_driver realtek_drvs[] = {
                .match_phy_device = rtlgen_match_phy_device,
                .read_status    = rtlgen_read_status,
                .suspend        = genphy_suspend,
-               .resume         = genphy_resume,
+               .resume         = rtlgen_resume,
                .read_page      = rtl821x_read_page,
                .write_page     = rtl821x_write_page,
                .read_mmd       = rtlgen_read_mmd,
@@ -621,7 +632,7 @@ static struct phy_driver realtek_drvs[] = {
                .config_aneg    = rtl8125_config_aneg,
                .read_status    = rtl8125_read_status,
                .suspend        = genphy_suspend,
-               .resume         = genphy_resume,
+               .resume         = rtlgen_resume,
                .read_page      = rtl821x_read_page,
                .write_page     = rtl821x_write_page,
                .read_mmd       = rtl8125_read_mmd,