forked from Minki/linux
r8169: use phy_resume/phy_suspend
Use phy_resume() / phy_suspend() instead of open coding this functionality. The chip version specific differences are handled by the respective PHY drivers. The call to r8168_phy_power_down() in r8168_pll_power_down() can be removed because phylib takes care now. The relevant scenarios are: - rtl8169_close(): phy_disconnect() powers down PHY - suspend: mdio_bus_phy_suspend() takes care - runtime-suspend: WoL is active, don't suspend PHY - rtl_shutdown(): no need to power down PHY Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f1e911d5d0
commit
242cd9b586
@ -4450,47 +4450,6 @@ static bool rtl_wol_pll_power_down(struct rtl8169_private *tp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void r8168_phy_power_up(struct rtl8169_private *tp)
|
||||
{
|
||||
rtl_writephy(tp, 0x1f, 0x0000);
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_11:
|
||||
case RTL_GIGA_MAC_VER_12:
|
||||
case RTL_GIGA_MAC_VER_17 ... RTL_GIGA_MAC_VER_28:
|
||||
case RTL_GIGA_MAC_VER_31:
|
||||
rtl_writephy(tp, 0x0e, 0x0000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
rtl_writephy(tp, MII_BMCR, BMCR_ANENABLE);
|
||||
|
||||
/* give MAC/PHY some time to resume */
|
||||
msleep(20);
|
||||
}
|
||||
|
||||
static void r8168_phy_power_down(struct rtl8169_private *tp)
|
||||
{
|
||||
rtl_writephy(tp, 0x1f, 0x0000);
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_32:
|
||||
case RTL_GIGA_MAC_VER_33:
|
||||
case RTL_GIGA_MAC_VER_40:
|
||||
case RTL_GIGA_MAC_VER_41:
|
||||
rtl_writephy(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN);
|
||||
break;
|
||||
|
||||
case RTL_GIGA_MAC_VER_11:
|
||||
case RTL_GIGA_MAC_VER_12:
|
||||
case RTL_GIGA_MAC_VER_17 ... RTL_GIGA_MAC_VER_28:
|
||||
case RTL_GIGA_MAC_VER_31:
|
||||
rtl_writephy(tp, 0x0e, 0x0200);
|
||||
default:
|
||||
rtl_writephy(tp, MII_BMCR, BMCR_PDOWN);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void r8168_pll_power_down(struct rtl8169_private *tp)
|
||||
{
|
||||
if (r8168_check_dash(tp))
|
||||
@ -4503,8 +4462,6 @@ static void r8168_pll_power_down(struct rtl8169_private *tp)
|
||||
if (rtl_wol_pll_power_down(tp))
|
||||
return;
|
||||
|
||||
r8168_phy_power_down(tp);
|
||||
|
||||
switch (tp->mac_version) {
|
||||
case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_33:
|
||||
case RTL_GIGA_MAC_VER_37:
|
||||
@ -4556,7 +4513,9 @@ static void r8168_pll_power_up(struct rtl8169_private *tp)
|
||||
break;
|
||||
}
|
||||
|
||||
r8168_phy_power_up(tp);
|
||||
phy_resume(tp->dev->phydev);
|
||||
/* give MAC/PHY some time to resume */
|
||||
msleep(20);
|
||||
}
|
||||
|
||||
static void rtl_pll_power_down(struct rtl8169_private *tp)
|
||||
@ -7472,6 +7431,9 @@ static int r8169_mdio_register(struct rtl8169_private *tp)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* PHY will be woken up in rtl_open() */
|
||||
phy_suspend(phydev);
|
||||
|
||||
tp->mii_bus = new_bus;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user