aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2013-07-08 05:09:01 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-10 20:43:12 -0400
commit45dd95c443c2d81d8d41e55afeafd4c61042fa76 (patch)
tree27dedb92633399fdb644ae1966b9d84a18d4a818 /drivers/net/ethernet
parent0e00fd479465d00bf0a97cb371c63787e1887a2e (diff)
r8169: add a new chip for RTL8411
Add a new chip for RTL8411 series. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/realtek/r8169.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 393f961a013c..4106a743ca74 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -46,6 +46,7 @@
46#define FIRMWARE_8105E_1 "rtl_nic/rtl8105e-1.fw" 46#define FIRMWARE_8105E_1 "rtl_nic/rtl8105e-1.fw"
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_8411_2 "rtl_nic/rtl8411-2.fw"
49#define FIRMWARE_8106E_1 "rtl_nic/rtl8106e-1.fw" 50#define FIRMWARE_8106E_1 "rtl_nic/rtl8106e-1.fw"
50#define FIRMWARE_8106E_2 "rtl_nic/rtl8106e-2.fw" 51#define FIRMWARE_8106E_2 "rtl_nic/rtl8106e-2.fw"
51#define FIRMWARE_8168G_2 "rtl_nic/rtl8168g-2.fw" 52#define FIRMWARE_8168G_2 "rtl_nic/rtl8168g-2.fw"
@@ -144,6 +145,7 @@ enum mac_version {
144 RTL_GIGA_MAC_VER_41, 145 RTL_GIGA_MAC_VER_41,
145 RTL_GIGA_MAC_VER_42, 146 RTL_GIGA_MAC_VER_42,
146 RTL_GIGA_MAC_VER_43, 147 RTL_GIGA_MAC_VER_43,
148 RTL_GIGA_MAC_VER_44,
147 RTL_GIGA_MAC_NONE = 0xff, 149 RTL_GIGA_MAC_NONE = 0xff,
148}; 150};
149 151
@@ -276,6 +278,9 @@ static const struct {
276 [RTL_GIGA_MAC_VER_43] = 278 [RTL_GIGA_MAC_VER_43] =
277 _R("RTL8106e", RTL_TD_1, FIRMWARE_8106E_2, 279 _R("RTL8106e", RTL_TD_1, FIRMWARE_8106E_2,
278 JUMBO_1K, true), 280 JUMBO_1K, true),
281 [RTL_GIGA_MAC_VER_44] =
282 _R("RTL8411", RTL_TD_1, FIRMWARE_8411_2,
283 JUMBO_9K, false),
279}; 284};
280#undef _R 285#undef _R
281 286
@@ -394,6 +399,7 @@ enum rtl8168_8101_registers {
394#define CSIAR_FUNC_CARD 0x00000000 399#define CSIAR_FUNC_CARD 0x00000000
395#define CSIAR_FUNC_SDIO 0x00010000 400#define CSIAR_FUNC_SDIO 0x00010000
396#define CSIAR_FUNC_NIC 0x00020000 401#define CSIAR_FUNC_NIC 0x00020000
402#define CSIAR_FUNC_NIC2 0x00010000
397 PMCH = 0x6f, 403 PMCH = 0x6f,
398 EPHYAR = 0x80, 404 EPHYAR = 0x80,
399#define EPHYAR_FLAG 0x80000000 405#define EPHYAR_FLAG 0x80000000
@@ -826,6 +832,7 @@ MODULE_FIRMWARE(FIRMWARE_8168F_1);
826MODULE_FIRMWARE(FIRMWARE_8168F_2); 832MODULE_FIRMWARE(FIRMWARE_8168F_2);
827MODULE_FIRMWARE(FIRMWARE_8402_1); 833MODULE_FIRMWARE(FIRMWARE_8402_1);
828MODULE_FIRMWARE(FIRMWARE_8411_1); 834MODULE_FIRMWARE(FIRMWARE_8411_1);
835MODULE_FIRMWARE(FIRMWARE_8411_2);
829MODULE_FIRMWARE(FIRMWARE_8106E_1); 836MODULE_FIRMWARE(FIRMWARE_8106E_1);
830MODULE_FIRMWARE(FIRMWARE_8106E_2); 837MODULE_FIRMWARE(FIRMWARE_8106E_2);
831MODULE_FIRMWARE(FIRMWARE_8168G_2); 838MODULE_FIRMWARE(FIRMWARE_8168G_2);
@@ -2051,6 +2058,7 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
2051 int mac_version; 2058 int mac_version;
2052 } mac_info[] = { 2059 } mac_info[] = {
2053 /* 8168G family. */ 2060 /* 8168G family. */
2061 { 0x7cf00000, 0x5c800000, RTL_GIGA_MAC_VER_44 },
2054 { 0x7cf00000, 0x50900000, RTL_GIGA_MAC_VER_42 }, 2062 { 0x7cf00000, 0x50900000, RTL_GIGA_MAC_VER_42 },
2055 { 0x7cf00000, 0x4c100000, RTL_GIGA_MAC_VER_41 }, 2063 { 0x7cf00000, 0x4c100000, RTL_GIGA_MAC_VER_41 },
2056 { 0x7cf00000, 0x4c000000, RTL_GIGA_MAC_VER_40 }, 2064 { 0x7cf00000, 0x4c000000, RTL_GIGA_MAC_VER_40 },
@@ -3651,6 +3659,7 @@ static void rtl_hw_phy_config(struct net_device *dev)
3651 break; 3659 break;
3652 case RTL_GIGA_MAC_VER_42: 3660 case RTL_GIGA_MAC_VER_42:
3653 case RTL_GIGA_MAC_VER_43: 3661 case RTL_GIGA_MAC_VER_43:
3662 case RTL_GIGA_MAC_VER_44:
3654 rtl8168g_2_hw_phy_config(tp); 3663 rtl8168g_2_hw_phy_config(tp);
3655 break; 3664 break;
3656 3665
@@ -3863,6 +3872,7 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp)
3863 case RTL_GIGA_MAC_VER_41: 3872 case RTL_GIGA_MAC_VER_41:
3864 case RTL_GIGA_MAC_VER_42: 3873 case RTL_GIGA_MAC_VER_42:
3865 case RTL_GIGA_MAC_VER_43: 3874 case RTL_GIGA_MAC_VER_43:
3875 case RTL_GIGA_MAC_VER_44:
3866 ops->write = r8168g_mdio_write; 3876 ops->write = r8168g_mdio_write;
3867 ops->read = r8168g_mdio_read; 3877 ops->read = r8168g_mdio_read;
3868 break; 3878 break;
@@ -3916,6 +3926,7 @@ static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
3916 case RTL_GIGA_MAC_VER_41: 3926 case RTL_GIGA_MAC_VER_41:
3917 case RTL_GIGA_MAC_VER_42: 3927 case RTL_GIGA_MAC_VER_42:
3918 case RTL_GIGA_MAC_VER_43: 3928 case RTL_GIGA_MAC_VER_43:
3929 case RTL_GIGA_MAC_VER_44:
3919 RTL_W32(RxConfig, RTL_R32(RxConfig) | 3930 RTL_W32(RxConfig, RTL_R32(RxConfig) |
3920 AcceptBroadcast | AcceptMulticast | AcceptMyPhys); 3931 AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
3921 break; 3932 break;
@@ -4178,6 +4189,7 @@ static void rtl_init_pll_power_ops(struct rtl8169_private *tp)
4178 case RTL_GIGA_MAC_VER_40: 4189 case RTL_GIGA_MAC_VER_40:
4179 case RTL_GIGA_MAC_VER_41: 4190 case RTL_GIGA_MAC_VER_41:
4180 case RTL_GIGA_MAC_VER_42: 4191 case RTL_GIGA_MAC_VER_42:
4192 case RTL_GIGA_MAC_VER_44:
4181 ops->down = r8168_pll_power_down; 4193 ops->down = r8168_pll_power_down;
4182 ops->up = r8168_pll_power_up; 4194 ops->up = r8168_pll_power_up;
4183 break; 4195 break;
@@ -4224,6 +4236,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp)
4224 case RTL_GIGA_MAC_VER_41: 4236 case RTL_GIGA_MAC_VER_41:
4225 case RTL_GIGA_MAC_VER_42: 4237 case RTL_GIGA_MAC_VER_42:
4226 case RTL_GIGA_MAC_VER_43: 4238 case RTL_GIGA_MAC_VER_43:
4239 case RTL_GIGA_MAC_VER_44:
4227 RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); 4240 RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF);
4228 break; 4241 break;
4229 default: 4242 default:
@@ -4384,6 +4397,7 @@ static void rtl_init_jumbo_ops(struct rtl8169_private *tp)
4384 case RTL_GIGA_MAC_VER_41: 4397 case RTL_GIGA_MAC_VER_41:
4385 case RTL_GIGA_MAC_VER_42: 4398 case RTL_GIGA_MAC_VER_42:
4386 case RTL_GIGA_MAC_VER_43: 4399 case RTL_GIGA_MAC_VER_43:
4400 case RTL_GIGA_MAC_VER_44:
4387 default: 4401 default:
4388 ops->disable = NULL; 4402 ops->disable = NULL;
4389 ops->enable = NULL; 4403 ops->enable = NULL;
@@ -4493,6 +4507,7 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp)
4493 tp->mac_version == RTL_GIGA_MAC_VER_41 || 4507 tp->mac_version == RTL_GIGA_MAC_VER_41 ||
4494 tp->mac_version == RTL_GIGA_MAC_VER_42 || 4508 tp->mac_version == RTL_GIGA_MAC_VER_42 ||
4495 tp->mac_version == RTL_GIGA_MAC_VER_43 || 4509 tp->mac_version == RTL_GIGA_MAC_VER_43 ||
4510 tp->mac_version == RTL_GIGA_MAC_VER_44 ||
4496 tp->mac_version == RTL_GIGA_MAC_VER_38) { 4511 tp->mac_version == RTL_GIGA_MAC_VER_38) {
4497 RTL_W8(ChipCmd, RTL_R8(ChipCmd) | StopReq); 4512 RTL_W8(ChipCmd, RTL_R8(ChipCmd) | StopReq);
4498 rtl_udelay_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666); 4513 rtl_udelay_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666);
@@ -4782,6 +4797,29 @@ static u32 r8402_csi_read(struct rtl8169_private *tp, int addr)
4782 RTL_R32(CSIDR) : ~0; 4797 RTL_R32(CSIDR) : ~0;
4783} 4798}
4784 4799
4800static void r8411_csi_write(struct rtl8169_private *tp, int addr, int value)
4801{
4802 void __iomem *ioaddr = tp->mmio_addr;
4803
4804 RTL_W32(CSIDR, value);
4805 RTL_W32(CSIAR, CSIAR_WRITE_CMD | (addr & CSIAR_ADDR_MASK) |
4806 CSIAR_BYTE_ENABLE << CSIAR_BYTE_ENABLE_SHIFT |
4807 CSIAR_FUNC_NIC2);
4808
4809 rtl_udelay_loop_wait_low(tp, &rtl_csiar_cond, 10, 100);
4810}
4811
4812static u32 r8411_csi_read(struct rtl8169_private *tp, int addr)
4813{
4814 void __iomem *ioaddr = tp->mmio_addr;
4815
4816 RTL_W32(CSIAR, (addr & CSIAR_ADDR_MASK) | CSIAR_FUNC_NIC2 |
4817 CSIAR_BYTE_ENABLE << CSIAR_BYTE_ENABLE_SHIFT);
4818
4819 return rtl_udelay_loop_wait_high(tp, &rtl_csiar_cond, 10, 100) ?
4820 RTL_R32(CSIDR) : ~0;
4821}
4822
4785static void rtl_init_csi_ops(struct rtl8169_private *tp) 4823static void rtl_init_csi_ops(struct rtl8169_private *tp)
4786{ 4824{
4787 struct csi_ops *ops = &tp->csi_ops; 4825 struct csi_ops *ops = &tp->csi_ops;
@@ -4811,6 +4849,11 @@ static void rtl_init_csi_ops(struct rtl8169_private *tp)
4811 ops->read = r8402_csi_read; 4849 ops->read = r8402_csi_read;
4812 break; 4850 break;
4813 4851
4852 case RTL_GIGA_MAC_VER_44:
4853 ops->write = r8411_csi_write;
4854 ops->read = r8411_csi_read;
4855 break;
4856
4814 default: 4857 default:
4815 ops->write = r8169_csi_write; 4858 ops->write = r8169_csi_write;
4816 ops->read = r8169_csi_read; 4859 ops->read = r8169_csi_read;
@@ -5255,6 +5298,25 @@ static void rtl_hw_start_8168g_2(struct rtl8169_private *tp)
5255 rtl_ephy_init(tp, e_info_8168g_2, ARRAY_SIZE(e_info_8168g_2)); 5298 rtl_ephy_init(tp, e_info_8168g_2, ARRAY_SIZE(e_info_8168g_2));
5256} 5299}
5257 5300
5301static void rtl_hw_start_8411_2(struct rtl8169_private *tp)
5302{
5303 void __iomem *ioaddr = tp->mmio_addr;
5304 static const struct ephy_info e_info_8411_2[] = {
5305 { 0x00, 0x0000, 0x0008 },
5306 { 0x0c, 0x3df0, 0x0200 },
5307 { 0x0f, 0xffff, 0x5200 },
5308 { 0x19, 0x0020, 0x0000 },
5309 { 0x1e, 0x0000, 0x2000 }
5310 };
5311
5312 rtl_hw_start_8168g_1(tp);
5313
5314 /* disable aspm and clock request before access ephy */
5315 RTL_W8(Config2, RTL_R8(Config2) & ~ClkReqEn);
5316 RTL_W8(Config5, RTL_R8(Config5) & ~ASPM_en);
5317 rtl_ephy_init(tp, e_info_8411_2, ARRAY_SIZE(e_info_8411_2));
5318}
5319
5258static void rtl_hw_start_8168(struct net_device *dev) 5320static void rtl_hw_start_8168(struct net_device *dev)
5259{ 5321{
5260 struct rtl8169_private *tp = netdev_priv(dev); 5322 struct rtl8169_private *tp = netdev_priv(dev);
@@ -5361,6 +5423,10 @@ static void rtl_hw_start_8168(struct net_device *dev)
5361 rtl_hw_start_8168g_2(tp); 5423 rtl_hw_start_8168g_2(tp);
5362 break; 5424 break;
5363 5425
5426 case RTL_GIGA_MAC_VER_44:
5427 rtl_hw_start_8411_2(tp);
5428 break;
5429
5364 default: 5430 default:
5365 printk(KERN_ERR PFX "%s: unknown chipset (mac_version = %d).\n", 5431 printk(KERN_ERR PFX "%s: unknown chipset (mac_version = %d).\n",
5366 dev->name, tp->mac_version); 5432 dev->name, tp->mac_version);
@@ -6877,6 +6943,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp)
6877 case RTL_GIGA_MAC_VER_41: 6943 case RTL_GIGA_MAC_VER_41:
6878 case RTL_GIGA_MAC_VER_42: 6944 case RTL_GIGA_MAC_VER_42:
6879 case RTL_GIGA_MAC_VER_43: 6945 case RTL_GIGA_MAC_VER_43:
6946 case RTL_GIGA_MAC_VER_44:
6880 rtl_hw_init_8168g(tp); 6947 rtl_hw_init_8168g(tp);
6881 break; 6948 break;
6882 6949