net: phy: realtek: fix RTL8211F interrupt mode
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 12 Nov 2017 15:16:04 +0000 (16:16 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Nov 2017 12:33:50 +0000 (21:33 +0900)
After commit b94d22d94ad22 "ARM64: dts: meson-gx: add external PHY
interrupt on some platforms" ethernet stopped working on my Odroid-C2
which has a RTL8211F phy.

It turned out that no interrupts were triggered. Further analysis
showed the register INER can't be altered on page 0.
Because register INSR needs to be accessed via page 0xa43 I assumed
that register INER needs to be accessed via some page too.
Some brute force check resulted in page 0xa42 being the right one.

With this patch the phy is working properly in interrupt mode.

Fixes: 3447cf2e9a11 ("net/phy: Add support for Realtek RTL8211F")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/realtek.c

index d4670ecdb1ba16191ba1976f65a4fc4309e1d8c5..eda0a6e869189a823e37a93ba50630c589bf6d8d 100644 (file)
@@ -115,11 +115,13 @@ static int rtl8211f_config_intr(struct phy_device *phydev)
 {
        int err;
 
+       phy_write(phydev, RTL821x_PAGE_SELECT, 0xa42);
        if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
                err = phy_write(phydev, RTL821x_INER,
                                RTL8211F_INER_LINK_STATUS);
        else
                err = phy_write(phydev, RTL821x_INER, 0);
+       phy_write(phydev, RTL821x_PAGE_SELECT, 0);
 
        return err;
 }