aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHayes Wang <hayeswang@realtek.com>2012-03-30 02:33:03 -0400
committerFrancois Romieu <romieu@fr.zoreil.com>2012-04-17 05:22:41 -0400
commit5f886e08901adaaaa1c79d1f964035aee6a29370 (patch)
tree93e08217baa63e327e3b2b258c7bf348526a472e
parent7e18dca16246b2891239cfc3c6e2dfcea715d353 (diff)
r8169: adjust some functions of 8111f
Put some settings of 8111f into one function which may be reused. Signed-off-by: Hayes Wang <hayeswang@realtek.com>
-rw-r--r--drivers/net/ethernet/realtek/r8169.c99
1 files changed, 47 insertions, 52 deletions
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 03020a48b9d4..28a08616569f 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -3022,6 +3022,28 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
3022 rtl_writephy(tp, 0x1f, 0x0000); 3022 rtl_writephy(tp, 0x1f, 0x0000);
3023} 3023}
3024 3024
3025static void rtl8168f_hw_phy_config(struct rtl8169_private *tp)
3026{
3027 /* For 4-corner performance improve */
3028 rtl_writephy(tp, 0x1f, 0x0005);
3029 rtl_writephy(tp, 0x05, 0x8b80);
3030 rtl_w1w0_phy(tp, 0x06, 0x0006, 0x0000);
3031 rtl_writephy(tp, 0x1f, 0x0000);
3032
3033 /* PHY auto speed down */
3034 rtl_writephy(tp, 0x1f, 0x0007);
3035 rtl_writephy(tp, 0x1e, 0x002d);
3036 rtl_w1w0_phy(tp, 0x18, 0x0010, 0x0000);
3037 rtl_writephy(tp, 0x1f, 0x0000);
3038 rtl_w1w0_phy(tp, 0x14, 0x8000, 0x0000);
3039
3040 /* Improve 10M EEE waveform */
3041 rtl_writephy(tp, 0x1f, 0x0005);
3042 rtl_writephy(tp, 0x05, 0x8b86);
3043 rtl_w1w0_phy(tp, 0x06, 0x0001, 0x0000);
3044 rtl_writephy(tp, 0x1f, 0x0000);
3045}
3046
3025static void rtl8168f_1_hw_phy_config(struct rtl8169_private *tp) 3047static void rtl8168f_1_hw_phy_config(struct rtl8169_private *tp)
3026{ 3048{
3027 static const struct phy_reg phy_reg_init[] = { 3049 static const struct phy_reg phy_reg_init[] = {
@@ -3063,24 +3085,7 @@ static void rtl8168f_1_hw_phy_config(struct rtl8169_private *tp)
3063 3085
3064 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init)); 3086 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
3065 3087
3066 /* For 4-corner performance improve */ 3088 rtl8168f_hw_phy_config(tp);
3067 rtl_writephy(tp, 0x1f, 0x0005);
3068 rtl_writephy(tp, 0x05, 0x8b80);
3069 rtl_w1w0_phy(tp, 0x06, 0x0006, 0x0000);
3070 rtl_writephy(tp, 0x1f, 0x0000);
3071
3072 /* PHY auto speed down */
3073 rtl_writephy(tp, 0x1f, 0x0007);
3074 rtl_writephy(tp, 0x1e, 0x002d);
3075 rtl_w1w0_phy(tp, 0x18, 0x0010, 0x0000);
3076 rtl_writephy(tp, 0x1f, 0x0000);
3077 rtl_w1w0_phy(tp, 0x14, 0x8000, 0x0000);
3078
3079 /* Improve 10M EEE waveform */
3080 rtl_writephy(tp, 0x1f, 0x0005);
3081 rtl_writephy(tp, 0x05, 0x8b86);
3082 rtl_w1w0_phy(tp, 0x06, 0x0001, 0x0000);
3083 rtl_writephy(tp, 0x1f, 0x0000);
3084 3089
3085 /* Improve 2-pair detection performance */ 3090 /* Improve 2-pair detection performance */
3086 rtl_writephy(tp, 0x1f, 0x0005); 3091 rtl_writephy(tp, 0x1f, 0x0005);
@@ -3093,24 +3098,7 @@ static void rtl8168f_2_hw_phy_config(struct rtl8169_private *tp)
3093{ 3098{
3094 rtl_apply_firmware(tp); 3099 rtl_apply_firmware(tp);
3095 3100
3096 /* For 4-corner performance improve */ 3101 rtl8168f_hw_phy_config(tp);
3097 rtl_writephy(tp, 0x1f, 0x0005);
3098 rtl_writephy(tp, 0x05, 0x8b80);
3099 rtl_w1w0_phy(tp, 0x06, 0x0006, 0x0000);
3100 rtl_writephy(tp, 0x1f, 0x0000);
3101
3102 /* PHY auto speed down */
3103 rtl_writephy(tp, 0x1f, 0x0007);
3104 rtl_writephy(tp, 0x1e, 0x002d);
3105 rtl_w1w0_phy(tp, 0x18, 0x0010, 0x0000);
3106 rtl_writephy(tp, 0x1f, 0x0000);
3107 rtl_w1w0_phy(tp, 0x14, 0x8000, 0x0000);
3108
3109 /* Improve 10M EEE waveform */
3110 rtl_writephy(tp, 0x1f, 0x0005);
3111 rtl_writephy(tp, 0x05, 0x8b86);
3112 rtl_w1w0_phy(tp, 0x06, 0x0001, 0x0000);
3113 rtl_writephy(tp, 0x1f, 0x0000);
3114} 3102}
3115 3103
3116static void rtl8102e_hw_phy_config(struct rtl8169_private *tp) 3104static void rtl8102e_hw_phy_config(struct rtl8169_private *tp)
@@ -4704,20 +4692,12 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp)
4704 RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en); 4692 RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en);
4705} 4693}
4706 4694
4707static void rtl_hw_start_8168f_1(struct rtl8169_private *tp) 4695static void rtl_hw_start_8168f(struct rtl8169_private *tp)
4708{ 4696{
4709 void __iomem *ioaddr = tp->mmio_addr; 4697 void __iomem *ioaddr = tp->mmio_addr;
4710 struct pci_dev *pdev = tp->pci_dev; 4698 struct pci_dev *pdev = tp->pci_dev;
4711 static const struct ephy_info e_info_8168f_1[] = {
4712 { 0x06, 0x00c0, 0x0020 },
4713 { 0x08, 0x0001, 0x0002 },
4714 { 0x09, 0x0000, 0x0080 },
4715 { 0x19, 0x0000, 0x0224 }
4716 };
4717
4718 rtl_csi_access_enable_1(tp);
4719 4699
4720 rtl_ephy_init(ioaddr, e_info_8168f_1, ARRAY_SIZE(e_info_8168f_1)); 4700 rtl_csi_access_enable_2(tp);
4721 4701
4722 rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); 4702 rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT);
4723 4703
@@ -4731,8 +4711,6 @@ static void rtl_hw_start_8168f_1(struct rtl8169_private *tp)
4731 rtl_w1w0_eri(ioaddr, 0x1d0, ERIAR_MASK_0001, 0x10, 0x00, ERIAR_EXGMAC); 4711 rtl_w1w0_eri(ioaddr, 0x1d0, ERIAR_MASK_0001, 0x10, 0x00, ERIAR_EXGMAC);
4732 rtl_eri_write(ioaddr, 0xcc, ERIAR_MASK_1111, 0x00000050, ERIAR_EXGMAC); 4712 rtl_eri_write(ioaddr, 0xcc, ERIAR_MASK_1111, 0x00000050, ERIAR_EXGMAC);
4733 rtl_eri_write(ioaddr, 0xd0, ERIAR_MASK_1111, 0x00000060, ERIAR_EXGMAC); 4713 rtl_eri_write(ioaddr, 0xd0, ERIAR_MASK_1111, 0x00000060, ERIAR_EXGMAC);
4734 rtl_w1w0_eri(ioaddr, 0x0d4, ERIAR_MASK_0011, 0x0c00, 0xff00,
4735 ERIAR_EXGMAC);
4736 4714
4737 RTL_W8(MaxTxPacketSize, EarlySize); 4715 RTL_W8(MaxTxPacketSize, EarlySize);
4738 4716
@@ -4740,15 +4718,32 @@ static void rtl_hw_start_8168f_1(struct rtl8169_private *tp)
4740 4718
4741 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO); 4719 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
4742 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB); 4720 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB);
4743
4744 /* Adjust EEE LED frequency */
4745 RTL_W8(EEE_LED, RTL_R8(EEE_LED) & ~0x07);
4746
4747 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); 4721 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN);
4748 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN); 4722 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN);
4749 RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en); 4723 RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en);
4750} 4724}
4751 4725
4726static void rtl_hw_start_8168f_1(struct rtl8169_private *tp)
4727{
4728 void __iomem *ioaddr = tp->mmio_addr;
4729 static const struct ephy_info e_info_8168f_1[] = {
4730 { 0x06, 0x00c0, 0x0020 },
4731 { 0x08, 0x0001, 0x0002 },
4732 { 0x09, 0x0000, 0x0080 },
4733 { 0x19, 0x0000, 0x0224 }
4734 };
4735
4736 rtl_hw_start_8168f(tp);
4737
4738 rtl_ephy_init(ioaddr, e_info_8168f_1, ARRAY_SIZE(e_info_8168f_1));
4739
4740 rtl_w1w0_eri(ioaddr, 0x0d4, ERIAR_MASK_0011, 0x0c00, 0xff00,
4741 ERIAR_EXGMAC);
4742
4743 /* Adjust EEE LED frequency */
4744 RTL_W8(EEE_LED, RTL_R8(EEE_LED) & ~0x07);
4745}
4746
4752static void rtl_hw_start_8168(struct net_device *dev) 4747static void rtl_hw_start_8168(struct net_device *dev)
4753{ 4748{
4754 struct rtl8169_private *tp = netdev_priv(dev); 4749 struct rtl8169_private *tp = netdev_priv(dev);