diff options
author | hayeswang <hayeswang@realtek.com> | 2013-04-01 18:23:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-07 16:44:13 -0400 |
commit | beb330a441da4196115d140e03df063ac82cbcf2 (patch) | |
tree | 9d4f8e30ce7bf95891fd22766e67ab79aa5cd8ba /drivers/net/ethernet/realtek | |
parent | eee3786f7d3134e3edc54c1134511d520dd74285 (diff) |
r8169: Update the RTL8111G parameters
- replace rtl8168g-1.fw with rtl8168g-2.fw which support new method.
- fix PHY power down is useless.
- disable rx early which causes the rx abnormal.
- enable auto fifo.
- set 10M IFG to default value.
- fix the conflict between jumbo frame and flow control.
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.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index e7e7d3735c19..0211836f2cb7 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #define FIRMWARE_8402_1 "rtl_nic/rtl8402-1.fw" | 47 | #define FIRMWARE_8402_1 "rtl_nic/rtl8402-1.fw" |
48 | #define FIRMWARE_8411_1 "rtl_nic/rtl8411-1.fw" | 48 | #define FIRMWARE_8411_1 "rtl_nic/rtl8411-1.fw" |
49 | #define FIRMWARE_8106E_1 "rtl_nic/rtl8106e-1.fw" | 49 | #define FIRMWARE_8106E_1 "rtl_nic/rtl8106e-1.fw" |
50 | #define FIRMWARE_8168G_1 "rtl_nic/rtl8168g-1.fw" | 50 | #define FIRMWARE_8168G_2 "rtl_nic/rtl8168g-2.fw" |
51 | 51 | ||
52 | #ifdef RTL8169_DEBUG | 52 | #ifdef RTL8169_DEBUG |
53 | #define assert(expr) \ | 53 | #define assert(expr) \ |
@@ -262,7 +262,7 @@ static const struct { | |||
262 | _R("RTL8106e", RTL_TD_1, FIRMWARE_8106E_1, | 262 | _R("RTL8106e", RTL_TD_1, FIRMWARE_8106E_1, |
263 | JUMBO_1K, true), | 263 | JUMBO_1K, true), |
264 | [RTL_GIGA_MAC_VER_40] = | 264 | [RTL_GIGA_MAC_VER_40] = |
265 | _R("RTL8168g/8111g", RTL_TD_1, FIRMWARE_8168G_1, | 265 | _R("RTL8168g/8111g", RTL_TD_1, FIRMWARE_8168G_2, |
266 | JUMBO_9K, false), | 266 | JUMBO_9K, false), |
267 | [RTL_GIGA_MAC_VER_41] = | 267 | [RTL_GIGA_MAC_VER_41] = |
268 | _R("RTL8168g/8111g", RTL_TD_1, NULL, JUMBO_9K, false), | 268 | _R("RTL8168g/8111g", RTL_TD_1, NULL, JUMBO_9K, false), |
@@ -329,6 +329,7 @@ enum rtl_registers { | |||
329 | #define RXCFG_FIFO_SHIFT 13 | 329 | #define RXCFG_FIFO_SHIFT 13 |
330 | /* No threshold before first PCI xfer */ | 330 | /* No threshold before first PCI xfer */ |
331 | #define RX_FIFO_THRESH (7 << RXCFG_FIFO_SHIFT) | 331 | #define RX_FIFO_THRESH (7 << RXCFG_FIFO_SHIFT) |
332 | #define RX_EARLY_OFF (1 << 11) | ||
332 | #define RXCFG_DMA_SHIFT 8 | 333 | #define RXCFG_DMA_SHIFT 8 |
333 | /* Unlimited maximum PCI burst. */ | 334 | /* Unlimited maximum PCI burst. */ |
334 | #define RX_DMA_BURST (7 << RXCFG_DMA_SHIFT) | 335 | #define RX_DMA_BURST (7 << RXCFG_DMA_SHIFT) |
@@ -814,7 +815,7 @@ MODULE_FIRMWARE(FIRMWARE_8168F_2); | |||
814 | MODULE_FIRMWARE(FIRMWARE_8402_1); | 815 | MODULE_FIRMWARE(FIRMWARE_8402_1); |
815 | MODULE_FIRMWARE(FIRMWARE_8411_1); | 816 | MODULE_FIRMWARE(FIRMWARE_8411_1); |
816 | MODULE_FIRMWARE(FIRMWARE_8106E_1); | 817 | MODULE_FIRMWARE(FIRMWARE_8106E_1); |
817 | MODULE_FIRMWARE(FIRMWARE_8168G_1); | 818 | MODULE_FIRMWARE(FIRMWARE_8168G_2); |
818 | 819 | ||
819 | static void rtl_lock_work(struct rtl8169_private *tp) | 820 | static void rtl_lock_work(struct rtl8169_private *tp) |
820 | { | 821 | { |
@@ -3967,6 +3968,8 @@ static void r8168_phy_power_down(struct rtl8169_private *tp) | |||
3967 | switch (tp->mac_version) { | 3968 | switch (tp->mac_version) { |
3968 | case RTL_GIGA_MAC_VER_32: | 3969 | case RTL_GIGA_MAC_VER_32: |
3969 | case RTL_GIGA_MAC_VER_33: | 3970 | case RTL_GIGA_MAC_VER_33: |
3971 | case RTL_GIGA_MAC_VER_40: | ||
3972 | case RTL_GIGA_MAC_VER_41: | ||
3970 | rtl_writephy(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN); | 3973 | rtl_writephy(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN); |
3971 | break; | 3974 | break; |
3972 | 3975 | ||
@@ -4028,6 +4031,11 @@ static void r8168_pll_power_down(struct rtl8169_private *tp) | |||
4028 | case RTL_GIGA_MAC_VER_33: | 4031 | case RTL_GIGA_MAC_VER_33: |
4029 | RTL_W8(PMCH, RTL_R8(PMCH) & ~0x80); | 4032 | RTL_W8(PMCH, RTL_R8(PMCH) & ~0x80); |
4030 | break; | 4033 | break; |
4034 | case RTL_GIGA_MAC_VER_40: | ||
4035 | case RTL_GIGA_MAC_VER_41: | ||
4036 | rtl_w1w0_eri(tp, 0x1a8, ERIAR_MASK_1111, 0x00000000, | ||
4037 | 0xfc000000, ERIAR_EXGMAC); | ||
4038 | break; | ||
4031 | } | 4039 | } |
4032 | } | 4040 | } |
4033 | 4041 | ||
@@ -4045,6 +4053,11 @@ static void r8168_pll_power_up(struct rtl8169_private *tp) | |||
4045 | case RTL_GIGA_MAC_VER_33: | 4053 | case RTL_GIGA_MAC_VER_33: |
4046 | RTL_W8(PMCH, RTL_R8(PMCH) | 0x80); | 4054 | RTL_W8(PMCH, RTL_R8(PMCH) | 0x80); |
4047 | break; | 4055 | break; |
4056 | case RTL_GIGA_MAC_VER_40: | ||
4057 | case RTL_GIGA_MAC_VER_41: | ||
4058 | rtl_w1w0_eri(tp, 0x1a8, ERIAR_MASK_1111, 0xfc000000, | ||
4059 | 0x00000000, ERIAR_EXGMAC); | ||
4060 | break; | ||
4048 | } | 4061 | } |
4049 | 4062 | ||
4050 | r8168_phy_power_up(tp); | 4063 | r8168_phy_power_up(tp); |
@@ -4150,6 +4163,10 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) | |||
4150 | case RTL_GIGA_MAC_VER_34: | 4163 | case RTL_GIGA_MAC_VER_34: |
4151 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); | 4164 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); |
4152 | break; | 4165 | break; |
4166 | case RTL_GIGA_MAC_VER_40: | ||
4167 | case RTL_GIGA_MAC_VER_41: | ||
4168 | RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); | ||
4169 | break; | ||
4153 | default: | 4170 | default: |
4154 | RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST); | 4171 | RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST); |
4155 | break; | 4172 | break; |
@@ -5128,6 +5145,8 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp) | |||
5128 | void __iomem *ioaddr = tp->mmio_addr; | 5145 | void __iomem *ioaddr = tp->mmio_addr; |
5129 | struct pci_dev *pdev = tp->pci_dev; | 5146 | struct pci_dev *pdev = tp->pci_dev; |
5130 | 5147 | ||
5148 | RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO); | ||
5149 | |||
5131 | rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x080002, ERIAR_EXGMAC); | 5150 | rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x080002, ERIAR_EXGMAC); |
5132 | rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC); | 5151 | rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC); |
5133 | rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC); | 5152 | rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC); |
@@ -5139,6 +5158,7 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp) | |||
5139 | 5158 | ||
5140 | rtl_w1w0_eri(tp, 0xdc, ERIAR_MASK_0001, 0x00, 0x01, ERIAR_EXGMAC); | 5159 | rtl_w1w0_eri(tp, 0xdc, ERIAR_MASK_0001, 0x00, 0x01, ERIAR_EXGMAC); |
5141 | rtl_w1w0_eri(tp, 0xdc, ERIAR_MASK_0001, 0x01, 0x00, ERIAR_EXGMAC); | 5160 | rtl_w1w0_eri(tp, 0xdc, ERIAR_MASK_0001, 0x01, 0x00, ERIAR_EXGMAC); |
5161 | rtl_eri_write(tp, 0x2f8, ERIAR_MASK_0011, 0x1d8f, ERIAR_EXGMAC); | ||
5142 | 5162 | ||
5143 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 5163 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
5144 | RTL_W32(MISC, RTL_R32(MISC) & ~RXDV_GATED_EN); | 5164 | RTL_W32(MISC, RTL_R32(MISC) & ~RXDV_GATED_EN); |
@@ -5150,7 +5170,8 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp) | |||
5150 | /* Adjust EEE LED frequency */ | 5170 | /* Adjust EEE LED frequency */ |
5151 | RTL_W8(EEE_LED, RTL_R8(EEE_LED) & ~0x07); | 5171 | RTL_W8(EEE_LED, RTL_R8(EEE_LED) & ~0x07); |
5152 | 5172 | ||
5153 | rtl_w1w0_eri(tp, 0x2fc, ERIAR_MASK_0001, 0x01, 0x02, ERIAR_EXGMAC); | 5173 | rtl_w1w0_eri(tp, 0x2fc, ERIAR_MASK_0001, 0x01, 0x06, ERIAR_EXGMAC); |
5174 | rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC); | ||
5154 | } | 5175 | } |
5155 | 5176 | ||
5156 | static void rtl_hw_start_8168(struct net_device *dev) | 5177 | static void rtl_hw_start_8168(struct net_device *dev) |