aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/realtek
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2012-11-01 12:46:28 -0400
committerDavid S. Miller <davem@davemloft.net>2012-11-04 12:21:36 -0500
commitd64ec841517a25f6d468bde9f67e5b4cffdc67c7 (patch)
treebba65ba23550a3038e78151d3e9e85d331172d3e /drivers/net/ethernet/realtek
parent0cb2bbbea0857c5c76db4cae85343553a882c0de (diff)
r8169: enable internal ASPM and clock request settings
The following chips need to enable internal settings to let ASPM and clock request work. RTL8111E-VL, RTL8111F, RTL8411, RTL8111G RTL8105, RTL8402, RTL8106 Signed-off-by: Hayes Wang <hayeswang@realtek.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.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index bf0b32411b1a..d6c6cfb68631 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -455,6 +455,7 @@ enum rtl8168_registers {
455#define PWM_EN (1 << 22) 455#define PWM_EN (1 << 22)
456#define RXDV_GATED_EN (1 << 19) 456#define RXDV_GATED_EN (1 << 19)
457#define EARLY_TALLY_EN (1 << 16) 457#define EARLY_TALLY_EN (1 << 16)
458#define FORCE_CLK (1 << 15) /* force clock request */
458}; 459};
459 460
460enum rtl_register_content { 461enum rtl_register_content {
@@ -518,6 +519,7 @@ enum rtl_register_content {
518 PMEnable = (1 << 0), /* Power Management Enable */ 519 PMEnable = (1 << 0), /* Power Management Enable */
519 520
520 /* Config2 register p. 25 */ 521 /* Config2 register p. 25 */
522 ClkReqEn = (1 << 7), /* Clock Request Enable */
521 MSIEnable = (1 << 5), /* 8169 only. Reserved in the 8168. */ 523 MSIEnable = (1 << 5), /* 8169 only. Reserved in the 8168. */
522 PCI_Clock_66MHz = 0x01, 524 PCI_Clock_66MHz = 0x01,
523 PCI_Clock_33MHz = 0x00, 525 PCI_Clock_33MHz = 0x00,
@@ -538,6 +540,7 @@ enum rtl_register_content {
538 Spi_en = (1 << 3), 540 Spi_en = (1 << 3),
539 LanWake = (1 << 1), /* LanWake enable/disable */ 541 LanWake = (1 << 1), /* LanWake enable/disable */
540 PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ 542 PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */
543 ASPM_en = (1 << 0), /* ASPM enable */
541 544
542 /* TBICSR p.28 */ 545 /* TBICSR p.28 */
543 TBIReset = 0x80000000, 546 TBIReset = 0x80000000,
@@ -5045,8 +5048,6 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp)
5045 5048
5046 RTL_W8(MaxTxPacketSize, EarlySize); 5049 RTL_W8(MaxTxPacketSize, EarlySize);
5047 5050
5048 rtl_disable_clock_request(pdev);
5049
5050 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO); 5051 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
5051 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB); 5052 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB);
5052 5053
@@ -5055,7 +5056,8 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp)
5055 5056
5056 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); 5057 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN);
5057 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN); 5058 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN);
5058 RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en); 5059 RTL_W8(Config5, (RTL_R8(Config5) & ~Spi_en) | ASPM_en);
5060 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5059} 5061}
5060 5062
5061static void rtl_hw_start_8168f(struct rtl8169_private *tp) 5063static void rtl_hw_start_8168f(struct rtl8169_private *tp)
@@ -5080,13 +5082,12 @@ static void rtl_hw_start_8168f(struct rtl8169_private *tp)
5080 5082
5081 RTL_W8(MaxTxPacketSize, EarlySize); 5083 RTL_W8(MaxTxPacketSize, EarlySize);
5082 5084
5083 rtl_disable_clock_request(pdev);
5084
5085 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO); 5085 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
5086 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB); 5086 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB);
5087 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); 5087 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN);
5088 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN); 5088 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN | FORCE_CLK);
5089 RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en); 5089 RTL_W8(Config5, (RTL_R8(Config5) & ~Spi_en) | ASPM_en);
5090 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5090} 5091}
5091 5092
5092static void rtl_hw_start_8168f_1(struct rtl8169_private *tp) 5093static void rtl_hw_start_8168f_1(struct rtl8169_private *tp)
@@ -5143,8 +5144,10 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp)
5143 rtl_w1w0_eri(tp, 0xdc, ERIAR_MASK_0001, 0x01, 0x00, ERIAR_EXGMAC); 5144 rtl_w1w0_eri(tp, 0xdc, ERIAR_MASK_0001, 0x01, 0x00, ERIAR_EXGMAC);
5144 5145
5145 RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); 5146 RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
5146 RTL_W32(MISC, RTL_R32(MISC) & ~RXDV_GATED_EN); 5147 RTL_W32(MISC, (RTL_R32(MISC) | FORCE_CLK) & ~RXDV_GATED_EN);
5147 RTL_W8(MaxTxPacketSize, EarlySize); 5148 RTL_W8(MaxTxPacketSize, EarlySize);
5149 RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
5150 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5148 5151
5149 rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); 5152 rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC);
5150 rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); 5153 rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC);
@@ -5360,6 +5363,9 @@ static void rtl_hw_start_8105e_1(struct rtl8169_private *tp)
5360 5363
5361 RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); 5364 RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET);
5362 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); 5365 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN);
5366 RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
5367 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5368 RTL_W32(MISC, RTL_R32(MISC) | FORCE_CLK);
5363 5369
5364 rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1)); 5370 rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1));
5365} 5371}
@@ -5385,6 +5391,9 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp)
5385 5391
5386 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO); 5392 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
5387 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB); 5393 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB);
5394 RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
5395 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5396 RTL_W32(MISC, RTL_R32(MISC) | FORCE_CLK);
5388 5397
5389 rtl_ephy_init(tp, e_info_8402, ARRAY_SIZE(e_info_8402)); 5398 rtl_ephy_init(tp, e_info_8402, ARRAY_SIZE(e_info_8402));
5390 5399
@@ -5406,7 +5415,10 @@ static void rtl_hw_start_8106(struct rtl8169_private *tp)
5406 /* Force LAN exit from ASPM if Rx/Tx are not idle */ 5415 /* Force LAN exit from ASPM if Rx/Tx are not idle */
5407 RTL_W32(FuncEvent, RTL_R32(FuncEvent) | 0x002800); 5416 RTL_W32(FuncEvent, RTL_R32(FuncEvent) | 0x002800);
5408 5417
5409 RTL_W32(MISC, (RTL_R32(MISC) | DISABLE_LAN_EN) & ~EARLY_TALLY_EN); 5418 RTL_W32(MISC,
5419 (RTL_R32(MISC) | DISABLE_LAN_EN | FORCE_CLK) & ~EARLY_TALLY_EN);
5420 RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
5421 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5410 RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); 5422 RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET);
5411 RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN); 5423 RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN);
5412} 5424}