Commit eef63cc1 authored by Francois Romieu's avatar Francois Romieu

Revert "r8169: enable ALDPS for power saving".

This reverts commit e0c07557.

Jörg Otte reported his 8168evl to fail boot time link detection.

Hayes suggests reverting it for the time being.
Signed-off-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
Cc: Jörg Otte <jrg.otte@gmail.com>
parent a1c83b05
...@@ -684,7 +684,6 @@ enum features { ...@@ -684,7 +684,6 @@ enum features {
RTL_FEATURE_WOL = (1 << 0), RTL_FEATURE_WOL = (1 << 0),
RTL_FEATURE_MSI = (1 << 1), RTL_FEATURE_MSI = (1 << 1),
RTL_FEATURE_GMII = (1 << 2), RTL_FEATURE_GMII = (1 << 2),
RTL_FEATURE_FW_LOADED = (1 << 3),
}; };
struct rtl8169_counters { struct rtl8169_counters {
...@@ -2389,10 +2388,8 @@ static void rtl_apply_firmware(struct rtl8169_private *tp) ...@@ -2389,10 +2388,8 @@ static void rtl_apply_firmware(struct rtl8169_private *tp)
struct rtl_fw *rtl_fw = tp->rtl_fw; struct rtl_fw *rtl_fw = tp->rtl_fw;
/* TODO: release firmware once rtl_phy_write_fw signals failures. */ /* TODO: release firmware once rtl_phy_write_fw signals failures. */
if (!IS_ERR_OR_NULL(rtl_fw)) { if (!IS_ERR_OR_NULL(rtl_fw))
rtl_phy_write_fw(tp, rtl_fw); rtl_phy_write_fw(tp, rtl_fw);
tp->features |= RTL_FEATURE_FW_LOADED;
}
} }
static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val) static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val)
...@@ -2403,31 +2400,6 @@ static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val) ...@@ -2403,31 +2400,6 @@ static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val)
rtl_apply_firmware(tp); rtl_apply_firmware(tp);
} }
static void r810x_aldps_disable(struct rtl8169_private *tp)
{
rtl_writephy(tp, 0x1f, 0x0000);
rtl_writephy(tp, 0x18, 0x0310);
msleep(100);
}
static void r810x_aldps_enable(struct rtl8169_private *tp)
{
if (!(tp->features & RTL_FEATURE_FW_LOADED))
return;
rtl_writephy(tp, 0x1f, 0x0000);
rtl_writephy(tp, 0x18, 0x8310);
}
static void r8168_aldps_enable_1(struct rtl8169_private *tp)
{
if (!(tp->features & RTL_FEATURE_FW_LOADED))
return;
rtl_writephy(tp, 0x1f, 0x0000);
rtl_w1w0_phy(tp, 0x15, 0x1000, 0x0000);
}
static void rtl8169s_hw_phy_config(struct rtl8169_private *tp) static void rtl8169s_hw_phy_config(struct rtl8169_private *tp)
{ {
static const struct phy_reg phy_reg_init[] = { static const struct phy_reg phy_reg_init[] = {
...@@ -3218,8 +3190,6 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp) ...@@ -3218,8 +3190,6 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0400); rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0400);
rtl_writephy(tp, 0x1f, 0x0000); rtl_writephy(tp, 0x1f, 0x0000);
r8168_aldps_enable_1(tp);
/* Broken BIOS workaround: feed GigaMAC registers with MAC address. */ /* Broken BIOS workaround: feed GigaMAC registers with MAC address. */
rtl_rar_exgmac_set(tp, tp->dev->dev_addr); rtl_rar_exgmac_set(tp, tp->dev->dev_addr);
} }
...@@ -3294,8 +3264,6 @@ static void rtl8168f_1_hw_phy_config(struct rtl8169_private *tp) ...@@ -3294,8 +3264,6 @@ static void rtl8168f_1_hw_phy_config(struct rtl8169_private *tp)
rtl_writephy(tp, 0x05, 0x8b85); rtl_writephy(tp, 0x05, 0x8b85);
rtl_w1w0_phy(tp, 0x06, 0x4000, 0x0000); rtl_w1w0_phy(tp, 0x06, 0x4000, 0x0000);
rtl_writephy(tp, 0x1f, 0x0000); rtl_writephy(tp, 0x1f, 0x0000);
r8168_aldps_enable_1(tp);
} }
static void rtl8168f_2_hw_phy_config(struct rtl8169_private *tp) static void rtl8168f_2_hw_phy_config(struct rtl8169_private *tp)
...@@ -3303,8 +3271,6 @@ static void rtl8168f_2_hw_phy_config(struct rtl8169_private *tp) ...@@ -3303,8 +3271,6 @@ static void rtl8168f_2_hw_phy_config(struct rtl8169_private *tp)
rtl_apply_firmware(tp); rtl_apply_firmware(tp);
rtl8168f_hw_phy_config(tp); rtl8168f_hw_phy_config(tp);
r8168_aldps_enable_1(tp);
} }
static void rtl8411_hw_phy_config(struct rtl8169_private *tp) static void rtl8411_hw_phy_config(struct rtl8169_private *tp)
...@@ -3402,8 +3368,6 @@ static void rtl8411_hw_phy_config(struct rtl8169_private *tp) ...@@ -3402,8 +3368,6 @@ static void rtl8411_hw_phy_config(struct rtl8169_private *tp)
rtl_w1w0_phy(tp, 0x19, 0x0000, 0x0001); rtl_w1w0_phy(tp, 0x19, 0x0000, 0x0001);
rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0400); rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0400);
rtl_writephy(tp, 0x1f, 0x0000); rtl_writephy(tp, 0x1f, 0x0000);
r8168_aldps_enable_1(tp);
} }
static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp) static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp)
...@@ -3489,19 +3453,21 @@ static void rtl8105e_hw_phy_config(struct rtl8169_private *tp) ...@@ -3489,19 +3453,21 @@ static void rtl8105e_hw_phy_config(struct rtl8169_private *tp)
}; };
/* Disable ALDPS before ram code */ /* Disable ALDPS before ram code */
r810x_aldps_disable(tp); rtl_writephy(tp, 0x1f, 0x0000);
rtl_writephy(tp, 0x18, 0x0310);
msleep(100);
rtl_apply_firmware(tp); rtl_apply_firmware(tp);
rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init)); rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
r810x_aldps_enable(tp);
} }
static void rtl8402_hw_phy_config(struct rtl8169_private *tp) static void rtl8402_hw_phy_config(struct rtl8169_private *tp)
{ {
/* Disable ALDPS before setting firmware */ /* Disable ALDPS before setting firmware */
r810x_aldps_disable(tp); rtl_writephy(tp, 0x1f, 0x0000);
rtl_writephy(tp, 0x18, 0x0310);
msleep(20);
rtl_apply_firmware(tp); rtl_apply_firmware(tp);
...@@ -3511,8 +3477,6 @@ static void rtl8402_hw_phy_config(struct rtl8169_private *tp) ...@@ -3511,8 +3477,6 @@ static void rtl8402_hw_phy_config(struct rtl8169_private *tp)
rtl_writephy(tp, 0x10, 0x401f); rtl_writephy(tp, 0x10, 0x401f);
rtl_writephy(tp, 0x19, 0x7030); rtl_writephy(tp, 0x19, 0x7030);
rtl_writephy(tp, 0x1f, 0x0000); rtl_writephy(tp, 0x1f, 0x0000);
r810x_aldps_enable(tp);
} }
static void rtl8106e_hw_phy_config(struct rtl8169_private *tp) static void rtl8106e_hw_phy_config(struct rtl8169_private *tp)
...@@ -3525,7 +3489,9 @@ static void rtl8106e_hw_phy_config(struct rtl8169_private *tp) ...@@ -3525,7 +3489,9 @@ static void rtl8106e_hw_phy_config(struct rtl8169_private *tp)
}; };
/* Disable ALDPS before ram code */ /* Disable ALDPS before ram code */
r810x_aldps_disable(tp); rtl_writephy(tp, 0x1f, 0x0000);
rtl_writephy(tp, 0x18, 0x0310);
msleep(100);
rtl_apply_firmware(tp); rtl_apply_firmware(tp);
...@@ -3533,8 +3499,6 @@ static void rtl8106e_hw_phy_config(struct rtl8169_private *tp) ...@@ -3533,8 +3499,6 @@ static void rtl8106e_hw_phy_config(struct rtl8169_private *tp)
rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init)); rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
rtl_eri_write(tp, 0x1d0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); rtl_eri_write(tp, 0x1d0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC);
r810x_aldps_enable(tp);
} }
static void rtl_hw_phy_config(struct net_device *dev) static void rtl_hw_phy_config(struct net_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment