aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/realtek/r8169.c
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2013-04-01 18:23:40 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-07 16:44:13 -0400
commit57538c4a89506c333b480ff5bdfcd4f16f78ccdf (patch)
treef4cfb1f8a3b04e81d807195e1e098bc86f5b53d2 /drivers/net/ethernet/realtek/r8169.c
parentbeb330a441da4196115d140e03df063ac82cbcf2 (diff)
r8169: add a new chip for RTL8111G
Add a new chip for RTL8111G series. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/realtek/r8169.c')
-rw-r--r--drivers/net/ethernet/realtek/r8169.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 0211836f2cb7..573b693cb10e 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -48,6 +48,7 @@
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_2 "rtl_nic/rtl8168g-2.fw" 50#define FIRMWARE_8168G_2 "rtl_nic/rtl8168g-2.fw"
51#define FIRMWARE_8168G_3 "rtl_nic/rtl8168g-3.fw"
51 52
52#ifdef RTL8169_DEBUG 53#ifdef RTL8169_DEBUG
53#define assert(expr) \ 54#define assert(expr) \
@@ -140,6 +141,7 @@ enum mac_version {
140 RTL_GIGA_MAC_VER_39, 141 RTL_GIGA_MAC_VER_39,
141 RTL_GIGA_MAC_VER_40, 142 RTL_GIGA_MAC_VER_40,
142 RTL_GIGA_MAC_VER_41, 143 RTL_GIGA_MAC_VER_41,
144 RTL_GIGA_MAC_VER_42,
143 RTL_GIGA_MAC_NONE = 0xff, 145 RTL_GIGA_MAC_NONE = 0xff,
144}; 146};
145 147
@@ -266,6 +268,9 @@ static const struct {
266 JUMBO_9K, false), 268 JUMBO_9K, false),
267 [RTL_GIGA_MAC_VER_41] = 269 [RTL_GIGA_MAC_VER_41] =
268 _R("RTL8168g/8111g", RTL_TD_1, NULL, JUMBO_9K, false), 270 _R("RTL8168g/8111g", RTL_TD_1, NULL, JUMBO_9K, false),
271 [RTL_GIGA_MAC_VER_42] =
272 _R("RTL8168g/8111g", RTL_TD_1, FIRMWARE_8168G_3,
273 JUMBO_9K, false),
269}; 274};
270#undef _R 275#undef _R
271 276
@@ -514,6 +519,7 @@ enum rtl_register_content {
514 PMEnable = (1 << 0), /* Power Management Enable */ 519 PMEnable = (1 << 0), /* Power Management Enable */
515 520
516 /* Config2 register p. 25 */ 521 /* Config2 register p. 25 */
522 ClkReqEn = (1 << 7), /* Clock Request Enable */
517 MSIEnable = (1 << 5), /* 8169 only. Reserved in the 8168. */ 523 MSIEnable = (1 << 5), /* 8169 only. Reserved in the 8168. */
518 PCI_Clock_66MHz = 0x01, 524 PCI_Clock_66MHz = 0x01,
519 PCI_Clock_33MHz = 0x00, 525 PCI_Clock_33MHz = 0x00,
@@ -534,6 +540,7 @@ enum rtl_register_content {
534 Spi_en = (1 << 3), 540 Spi_en = (1 << 3),
535 LanWake = (1 << 1), /* LanWake enable/disable */ 541 LanWake = (1 << 1), /* LanWake enable/disable */
536 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 */
537 544
538 /* TBICSR p.28 */ 545 /* TBICSR p.28 */
539 TBIReset = 0x80000000, 546 TBIReset = 0x80000000,
@@ -816,6 +823,7 @@ MODULE_FIRMWARE(FIRMWARE_8402_1);
816MODULE_FIRMWARE(FIRMWARE_8411_1); 823MODULE_FIRMWARE(FIRMWARE_8411_1);
817MODULE_FIRMWARE(FIRMWARE_8106E_1); 824MODULE_FIRMWARE(FIRMWARE_8106E_1);
818MODULE_FIRMWARE(FIRMWARE_8168G_2); 825MODULE_FIRMWARE(FIRMWARE_8168G_2);
826MODULE_FIRMWARE(FIRMWARE_8168G_3);
819 827
820static void rtl_lock_work(struct rtl8169_private *tp) 828static void rtl_lock_work(struct rtl8169_private *tp)
821{ 829{
@@ -2036,6 +2044,7 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
2036 int mac_version; 2044 int mac_version;
2037 } mac_info[] = { 2045 } mac_info[] = {
2038 /* 8168G family. */ 2046 /* 8168G family. */
2047 { 0x7cf00000, 0x50900000, RTL_GIGA_MAC_VER_42 },
2039 { 0x7cf00000, 0x4c100000, RTL_GIGA_MAC_VER_41 }, 2048 { 0x7cf00000, 0x4c100000, RTL_GIGA_MAC_VER_41 },
2040 { 0x7cf00000, 0x4c000000, RTL_GIGA_MAC_VER_40 }, 2049 { 0x7cf00000, 0x4c000000, RTL_GIGA_MAC_VER_40 },
2041 2050
@@ -3439,6 +3448,11 @@ static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp)
3439 rtl_writephy(tp, 0x1f, 0x0000); 3448 rtl_writephy(tp, 0x1f, 0x0000);
3440} 3449}
3441 3450
3451static void rtl8168g_2_hw_phy_config(struct rtl8169_private *tp)
3452{
3453 rtl_apply_firmware(tp);
3454}
3455
3442static void rtl8102e_hw_phy_config(struct rtl8169_private *tp) 3456static void rtl8102e_hw_phy_config(struct rtl8169_private *tp)
3443{ 3457{
3444 static const struct phy_reg phy_reg_init[] = { 3458 static const struct phy_reg phy_reg_init[] = {
@@ -3624,6 +3638,9 @@ static void rtl_hw_phy_config(struct net_device *dev)
3624 case RTL_GIGA_MAC_VER_40: 3638 case RTL_GIGA_MAC_VER_40:
3625 rtl8168g_1_hw_phy_config(tp); 3639 rtl8168g_1_hw_phy_config(tp);
3626 break; 3640 break;
3641 case RTL_GIGA_MAC_VER_42:
3642 rtl8168g_2_hw_phy_config(tp);
3643 break;
3627 3644
3628 case RTL_GIGA_MAC_VER_41: 3645 case RTL_GIGA_MAC_VER_41:
3629 default: 3646 default:
@@ -3832,6 +3849,7 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp)
3832 break; 3849 break;
3833 case RTL_GIGA_MAC_VER_40: 3850 case RTL_GIGA_MAC_VER_40:
3834 case RTL_GIGA_MAC_VER_41: 3851 case RTL_GIGA_MAC_VER_41:
3852 case RTL_GIGA_MAC_VER_42:
3835 ops->write = r8168g_mdio_write; 3853 ops->write = r8168g_mdio_write;
3836 ops->read = r8168g_mdio_read; 3854 ops->read = r8168g_mdio_read;
3837 break; 3855 break;
@@ -3859,6 +3877,7 @@ static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
3859 case RTL_GIGA_MAC_VER_39: 3877 case RTL_GIGA_MAC_VER_39:
3860 case RTL_GIGA_MAC_VER_40: 3878 case RTL_GIGA_MAC_VER_40:
3861 case RTL_GIGA_MAC_VER_41: 3879 case RTL_GIGA_MAC_VER_41:
3880 case RTL_GIGA_MAC_VER_42:
3862 RTL_W32(RxConfig, RTL_R32(RxConfig) | 3881 RTL_W32(RxConfig, RTL_R32(RxConfig) |
3863 AcceptBroadcast | AcceptMulticast | AcceptMyPhys); 3882 AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
3864 break; 3883 break;
@@ -4121,6 +4140,7 @@ static void rtl_init_pll_power_ops(struct rtl8169_private *tp)
4121 case RTL_GIGA_MAC_VER_38: 4140 case RTL_GIGA_MAC_VER_38:
4122 case RTL_GIGA_MAC_VER_40: 4141 case RTL_GIGA_MAC_VER_40:
4123 case RTL_GIGA_MAC_VER_41: 4142 case RTL_GIGA_MAC_VER_41:
4143 case RTL_GIGA_MAC_VER_42:
4124 ops->down = r8168_pll_power_down; 4144 ops->down = r8168_pll_power_down;
4125 ops->up = r8168_pll_power_up; 4145 ops->up = r8168_pll_power_up;
4126 break; 4146 break;
@@ -4165,6 +4185,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp)
4165 break; 4185 break;
4166 case RTL_GIGA_MAC_VER_40: 4186 case RTL_GIGA_MAC_VER_40:
4167 case RTL_GIGA_MAC_VER_41: 4187 case RTL_GIGA_MAC_VER_41:
4188 case RTL_GIGA_MAC_VER_42:
4168 RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); 4189 RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF);
4169 break; 4190 break;
4170 default: 4191 default:
@@ -4323,6 +4344,7 @@ static void rtl_init_jumbo_ops(struct rtl8169_private *tp)
4323 */ 4344 */
4324 case RTL_GIGA_MAC_VER_40: 4345 case RTL_GIGA_MAC_VER_40:
4325 case RTL_GIGA_MAC_VER_41: 4346 case RTL_GIGA_MAC_VER_41:
4347 case RTL_GIGA_MAC_VER_42:
4326 default: 4348 default:
4327 ops->disable = NULL; 4349 ops->disable = NULL;
4328 ops->enable = NULL; 4350 ops->enable = NULL;
@@ -4430,6 +4452,7 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp)
4430 tp->mac_version == RTL_GIGA_MAC_VER_37 || 4452 tp->mac_version == RTL_GIGA_MAC_VER_37 ||
4431 tp->mac_version == RTL_GIGA_MAC_VER_40 || 4453 tp->mac_version == RTL_GIGA_MAC_VER_40 ||
4432 tp->mac_version == RTL_GIGA_MAC_VER_41 || 4454 tp->mac_version == RTL_GIGA_MAC_VER_41 ||
4455 tp->mac_version == RTL_GIGA_MAC_VER_42 ||
4433 tp->mac_version == RTL_GIGA_MAC_VER_38) { 4456 tp->mac_version == RTL_GIGA_MAC_VER_38) {
4434 RTL_W8(ChipCmd, RTL_R8(ChipCmd) | StopReq); 4457 RTL_W8(ChipCmd, RTL_R8(ChipCmd) | StopReq);
4435 rtl_udelay_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666); 4458 rtl_udelay_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666);
@@ -5174,6 +5197,24 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp)
5174 rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC); 5197 rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC);
5175} 5198}
5176 5199
5200static void rtl_hw_start_8168g_2(struct rtl8169_private *tp)
5201{
5202 void __iomem *ioaddr = tp->mmio_addr;
5203 static const struct ephy_info e_info_8168g_2[] = {
5204 { 0x00, 0x0000, 0x0008 },
5205 { 0x0c, 0x3df0, 0x0200 },
5206 { 0x19, 0xffff, 0xfc00 },
5207 { 0x1e, 0xffff, 0x20eb }
5208 };
5209
5210 rtl_hw_start_8168g_1(tp);
5211
5212 /* disable aspm and clock request before access ephy */
5213 RTL_W8(Config2, RTL_R8(Config2) & ~ClkReqEn);
5214 RTL_W8(Config5, RTL_R8(Config5) & ~ASPM_en);
5215 rtl_ephy_init(tp, e_info_8168g_2, ARRAY_SIZE(e_info_8168g_2));
5216}
5217
5177static void rtl_hw_start_8168(struct net_device *dev) 5218static void rtl_hw_start_8168(struct net_device *dev)
5178{ 5219{
5179 struct rtl8169_private *tp = netdev_priv(dev); 5220 struct rtl8169_private *tp = netdev_priv(dev);
@@ -5279,6 +5320,9 @@ static void rtl_hw_start_8168(struct net_device *dev)
5279 case RTL_GIGA_MAC_VER_41: 5320 case RTL_GIGA_MAC_VER_41:
5280 rtl_hw_start_8168g_1(tp); 5321 rtl_hw_start_8168g_1(tp);
5281 break; 5322 break;
5323 case RTL_GIGA_MAC_VER_42:
5324 rtl_hw_start_8168g_2(tp);
5325 break;
5282 5326
5283 default: 5327 default:
5284 printk(KERN_ERR PFX "%s: unknown chipset (mac_version = %d).\n", 5328 printk(KERN_ERR PFX "%s: unknown chipset (mac_version = %d).\n",
@@ -6766,6 +6810,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp)
6766 switch (tp->mac_version) { 6810 switch (tp->mac_version) {
6767 case RTL_GIGA_MAC_VER_40: 6811 case RTL_GIGA_MAC_VER_40:
6768 case RTL_GIGA_MAC_VER_41: 6812 case RTL_GIGA_MAC_VER_41:
6813 case RTL_GIGA_MAC_VER_42:
6769 rtl_hw_init_8168g(tp); 6814 rtl_hw_init_8168g(tp);
6770 break; 6815 break;
6771 6816