diff options
author | hayeswang <hayeswang@realtek.com> | 2014-07-09 02:52:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-09 19:42:08 -0400 |
commit | b51ecea852b712618796d9eab8428a7d5f1f106f (patch) | |
tree | 41c1ea68b785102d20a89f36584fe2f9b7fb1a84 /drivers/net/ethernet/realtek | |
parent | ac30ef832e6af0505b6f0251a6659adcfa74975e (diff) |
r8169: disable L23
For RTL8411, RTL8111G, RTL8402, RTL8105, and RTL8106, disable the feature
of entering the L2/L3 link state of the PCIe. When the nic starts the process
of entering the L2/L3 link state and the PCI reset occurs before the work
is finished, the work would be queued and continue after the next the PCI
reset occurs. This causes the device stays in L2/L3 link state, and the system
couldn't find the device.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/realtek')
-rw-r--r-- | drivers/net/ethernet/realtek/r8169.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index be425ad5e824..06bdc31a828d 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -538,6 +538,7 @@ enum rtl_register_content { | |||
538 | MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ | 538 | MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ |
539 | LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ | 539 | LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ |
540 | Jumbo_En0 = (1 << 2), /* 8168 only. Reserved in the 8168b */ | 540 | Jumbo_En0 = (1 << 2), /* 8168 only. Reserved in the 8168b */ |
541 | Rdy_to_L23 = (1 << 1), /* L23 Enable */ | ||
541 | Beacon_en = (1 << 0), /* 8168 only. Reserved in the 8168b */ | 542 | Beacon_en = (1 << 0), /* 8168 only. Reserved in the 8168b */ |
542 | 543 | ||
543 | /* Config4 register */ | 544 | /* Config4 register */ |
@@ -4897,6 +4898,21 @@ static void rtl_enable_clock_request(struct pci_dev *pdev) | |||
4897 | PCI_EXP_LNKCTL_CLKREQ_EN); | 4898 | PCI_EXP_LNKCTL_CLKREQ_EN); |
4898 | } | 4899 | } |
4899 | 4900 | ||
4901 | static void rtl_pcie_state_l2l3_enable(struct rtl8169_private *tp, bool enable) | ||
4902 | { | ||
4903 | void __iomem *ioaddr = tp->mmio_addr; | ||
4904 | u8 data; | ||
4905 | |||
4906 | data = RTL_R8(Config3); | ||
4907 | |||
4908 | if (enable) | ||
4909 | data |= Rdy_to_L23; | ||
4910 | else | ||
4911 | data &= ~Rdy_to_L23; | ||
4912 | |||
4913 | RTL_W8(Config3, data); | ||
4914 | } | ||
4915 | |||
4900 | #define R8168_CPCMD_QUIRK_MASK (\ | 4916 | #define R8168_CPCMD_QUIRK_MASK (\ |
4901 | EnableBist | \ | 4917 | EnableBist | \ |
4902 | Mac_dbgo_oe | \ | 4918 | Mac_dbgo_oe | \ |
@@ -5246,6 +5262,7 @@ static void rtl_hw_start_8411(struct rtl8169_private *tp) | |||
5246 | }; | 5262 | }; |
5247 | 5263 | ||
5248 | rtl_hw_start_8168f(tp); | 5264 | rtl_hw_start_8168f(tp); |
5265 | rtl_pcie_state_l2l3_enable(tp, false); | ||
5249 | 5266 | ||
5250 | rtl_ephy_init(tp, e_info_8168f_1, ARRAY_SIZE(e_info_8168f_1)); | 5267 | rtl_ephy_init(tp, e_info_8168f_1, ARRAY_SIZE(e_info_8168f_1)); |
5251 | 5268 | ||
@@ -5284,6 +5301,8 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp) | |||
5284 | 5301 | ||
5285 | rtl_w1w0_eri(tp, 0x2fc, ERIAR_MASK_0001, 0x01, 0x06, ERIAR_EXGMAC); | 5302 | rtl_w1w0_eri(tp, 0x2fc, ERIAR_MASK_0001, 0x01, 0x06, ERIAR_EXGMAC); |
5286 | rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC); | 5303 | rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC); |
5304 | |||
5305 | rtl_pcie_state_l2l3_enable(tp, false); | ||
5287 | } | 5306 | } |
5288 | 5307 | ||
5289 | static void rtl_hw_start_8168g_2(struct rtl8169_private *tp) | 5308 | static void rtl_hw_start_8168g_2(struct rtl8169_private *tp) |
@@ -5536,6 +5555,8 @@ static void rtl_hw_start_8105e_1(struct rtl8169_private *tp) | |||
5536 | RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); | 5555 | RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); |
5537 | 5556 | ||
5538 | rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1)); | 5557 | rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1)); |
5558 | |||
5559 | rtl_pcie_state_l2l3_enable(tp, false); | ||
5539 | } | 5560 | } |
5540 | 5561 | ||
5541 | static void rtl_hw_start_8105e_2(struct rtl8169_private *tp) | 5562 | static void rtl_hw_start_8105e_2(struct rtl8169_private *tp) |
@@ -5571,6 +5592,8 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp) | |||
5571 | rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); | 5592 | rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); |
5572 | rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); | 5593 | rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); |
5573 | rtl_w1w0_eri(tp, 0x0d4, ERIAR_MASK_0011, 0x0e00, 0xff00, ERIAR_EXGMAC); | 5594 | rtl_w1w0_eri(tp, 0x0d4, ERIAR_MASK_0011, 0x0e00, 0xff00, ERIAR_EXGMAC); |
5595 | |||
5596 | rtl_pcie_state_l2l3_enable(tp, false); | ||
5574 | } | 5597 | } |
5575 | 5598 | ||
5576 | static void rtl_hw_start_8106(struct rtl8169_private *tp) | 5599 | static void rtl_hw_start_8106(struct rtl8169_private *tp) |
@@ -5583,6 +5606,8 @@ static void rtl_hw_start_8106(struct rtl8169_private *tp) | |||
5583 | RTL_W32(MISC, (RTL_R32(MISC) | DISABLE_LAN_EN) & ~EARLY_TALLY_EN); | 5606 | RTL_W32(MISC, (RTL_R32(MISC) | DISABLE_LAN_EN) & ~EARLY_TALLY_EN); |
5584 | RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); | 5607 | RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); |
5585 | RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN); | 5608 | RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN); |
5609 | |||
5610 | rtl_pcie_state_l2l3_enable(tp, false); | ||
5586 | } | 5611 | } |
5587 | 5612 | ||
5588 | static void rtl_hw_start_8101(struct net_device *dev) | 5613 | static void rtl_hw_start_8101(struct net_device *dev) |