r8169:update hardware parameter
v2 cover r8169:update hardware parameter
These series of patch include the pcie ephy parameter update of following adapters.
rtl8411
rtl8168f
rtl8168evl
rtl8168dp
rtl8105
rtl8402
And include jumbo frame patch update of following adapters. rtl8168dp
rtl8168e
rtl8168evl
Also remove unnecessary function rtl_hw_start_8168dp and add function rtl_hw_start_8168f_2 to set rtl8168f rev.b pcie ephy parameters.
In v2 patch, give more explanation about pcie ephy parameter update.
Chunhao Lin (8):
r8169:change rtl8168dp jumbo frame patch
r8169:update rtl8168e and rtl8168evl jumbo frame patch r8169:correct the way of setting rtl8168dp pcie ephy parameters r8169:rtl8168dp rev.c pcie ephy setting is the same as rtl8168dp rev.b r8169:update rtl8168dp pcie ephy parameters to improve power
consumption
r8169:update pcie ephy parameters to decrease the resume time from L0s
to L0
r8169:update rtl8402 pcie ephy parameter
r8169:update rtl8168f rev.b pcie ephy parameter
drivers/net/ethernet/realtek/r8169.c | 112 +++++++++++++++-------------------- 1 file changed, 49 insertions(+), 63 deletions(-)
--
1.9.1
PATCH v2 1/8 r8169:change rtl8168dp jumbo frame patch
RTL8168DP jumbo frame patch is the same as RTL8168C. So, for RTL8168DP, change to use RTL8168C jumbo frame patch. Also reomve uncessary function "r8168dp_hw_jumbo_enable" and "r8168dp_hw_jumbo_disable".
--- drivers/net/ethernet/realtek/r8169.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-)
drivers/net/ethernet/realtek/r8169.c +6 -22
@@ -4927,20 +4927,6 @@ static void r8168c_hw_jumbo_disable(struct rtl8169_private *tp)rtl_tx_performance_tweak (tp->pci_dev,0x5 <<MAX_READ_REQUEST_SHIFT ); } -static void r8168dp_hw_jumbo_enable (struct rtl8169_private *tp) -{ -void __iomem *ioaddr = tp->mmio_addr; - -RTL_W8 (Config3,RTL_R8 (Config3) | Jumbo_En0); -} - -static void r8168dp_hw_jumbo_disable (struct rtl8169_private *tp) -{ -void __iomem *ioaddr = tp->mmio_addr; - -RTL_W8 (Config3,RTL_R8 (Config3) & ~Jumbo_En0); -} -static void r8168e_hw_jumbo_enable (struct rtl8169_private *tp) {void __iomem *ioaddr = tp->mmio_addr;
@@ -5014,16 +5000,13 @@ static void rtl_init_jumbo_ops(struct rtl8169_private *tp)case RTL_GIGA_MAC_VER_24 :case RTL_GIGA_MAC_VER_25 :case RTL_GIGA_MAC_VER_26 : - ops->disable = r8168c_hw_jumbo_disable; - ops->enable = r8168c_hw_jumbo_enable; -break ;case RTL_GIGA_MAC_VER_27 :case RTL_GIGA_MAC_VER_28 : - ops->disable = r8168dp_hw_jumbo_disable; - ops->enable = r8168dp_hw_jumbo_enable; +case RTL_GIGA_MAC_VER_31 : + ops->disable = r8168c_hw_jumbo_disable; + ops->enable = r8168c_hw_jumbo_enable;break ; -case RTL_GIGA_MAC_VER_31 :/* Wild guess. Needs info from Realtek. */ -case RTL_GIGA_MAC_VER_32 : +case RTL_GIGA_MAC_VER_32 :/* Wild guess. Needs info from Realtek. */ case RTL_GIGA_MAC_VER_33 :case RTL_GIGA_MAC_VER_34 : ops->disable = r8168e_hw_jumbo_disable;
@@ -5758,7 +5741,8 @@ static void rtl_hw_start_8168d_4(struct rtl8169_private *tp)rtl_csi_access_enable_1 (tp); -rtl_tx_performance_tweak (pdev,0x5 <<MAX_READ_REQUEST_SHIFT ); +if (tp->dev->mtu <=ETH_DATA_LEN ) +rtl_tx_performance_tweak (pdev,0x5 <<MAX_READ_REQUEST_SHIFT );RTL_W8 (MaxTxPacketSize, TxPacketMax);
Signature · 1 line
1.9.1
Re: [PATCH net-next v2 1/8] r8169:change rtl8168dp jumbo frame patch
Hello.
Quoted 2 lines · Chunhao Lin
RTL8168DP jumbo frame patch is the same as RTL8168C. So, for RTL8168DP, change to use RTL8168C jumbo frame patch. Also reomve uncessary function
s/reomve uncessary/remove unnecessary/.
Quoted 3 lines
"
r8168dp_hw_jumbo_enable" and "r8168dp_hw_jumbo_disable".Signed-off-by Chunhao Lin <[email protected]>
WBR, Sergei
PATCH v2 2/8 r8169:update rtl8168e and rtl8168evl jumbo frame patch
In reply to Chunhao LinRTL8168E and RTL8168EVL do not need to change pcie max read request size when jumbo frame is enabled. So remove setting pcie max read request size from their jumbo frame patch.
--- drivers/net/ethernet/realtek/r8169.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/realtek/r8169.c +0 -2
@@ -4934,7 +4934,6 @@ static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp)RTL_W8 (MaxTxPacketSize,0x3f );RTL_W8 (Config3,RTL_R8 (Config3) | Jumbo_En0);RTL_W8 (Config4,RTL_R8 (Config4) |0x01 ); -rtl_tx_performance_tweak (tp->pci_dev,0x2 <<MAX_READ_REQUEST_SHIFT ); }static void r8168e_hw_jumbo_disable (struct rtl8169_private *tp)
@@ -4944,7 +4943,6 @@ static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp)RTL_W8 (MaxTxPacketSize,0x0c );RTL_W8 (Config3,RTL_R8 (Config3) & ~Jumbo_En0);RTL_W8 (Config4,RTL_R8 (Config4) & ~0x01 ); -rtl_tx_performance_tweak (tp->pci_dev,0x5 <<MAX_READ_REQUEST_SHIFT ); }static void r8168b_0_hw_jumbo_enable (struct rtl8169_private *tp)
Signature · 1 line
1.9.1
PATCH v2 3/8 r8169:correct the way of setting rtl8168dp pcie ephy parameters
In reply to Chunhao LinThe original way is wrong, it always sets the ephy reg 0x03. Correct it in this patch.
--- drivers/net/ethernet/realtek/r8169.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/net/ethernet/realtek/r8169.c +4 -11
@@ -5731,11 +5731,10 @@ static void rtl_hw_start_8168d_4(struct rtl8169_private *tp)void __iomem *ioaddr = tp->mmio_addr;struct pci_dev *pdev = tp->pci_dev;static const struct ephy_info e_info_8168d_4[] = { - {0x0b , ~0 ,0x48 }, - {0x19 ,0x20 ,0x50 }, - {0x0c , ~0 ,0x20 } + {0x0b ,0x0000 ,0x0048 }, + {0x19 ,0x0020 ,0x0050 }, + {0x0c ,0x0100 ,0x0020 } }; -int i;rtl_csi_access_enable_1 (tp);
@@ -5744,13 +5743,7 @@ static void rtl_hw_start_8168d_4(struct rtl8169_private *tp)RTL_W8 (MaxTxPacketSize, TxPacketMax); -for (i =0 ; i <ARRAY_SIZE (e_info_8168d_4); i++) { -const struct ephy_info *e = e_info_8168d_4 + i; -u16 w; - - w =rtl_ephy_read (tp, e->offset); -rtl_ephy_write (tp,0x03 , (w & e->mask) | e->bits); - } +rtl_ephy_init (tp, e_info_8168d_4,ARRAY_SIZE (e_info_8168d_4));rtl_enable_clock_request (pdev); }
Signature · 1 line
1.9.1
PATCH v2 4/8 r8169:rtl8168dp rev.c pcie ephy setting is the same as rtl8168dp rev.b
In reply to Chunhao LinThease two chips should use the same pcie ephy parameters. So only need function rtl_hw_start_8168d_4. Function rtl_hw_start_8168dp is uncessary.
--- drivers/net/ethernet/realtek/r8169.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-)
drivers/net/ethernet/realtek/r8169.c +1 -19
@@ -5711,21 +5711,6 @@ static void rtl_hw_start_8168d(struct rtl8169_private *tp)RTL_W16 (CPlusCmd,RTL_R16 (CPlusCmd) & ~R8168_CPCMD_QUIRK_MASK ); } -static void rtl_hw_start_8168dp (struct rtl8169_private *tp) -{ -void __iomem *ioaddr = tp->mmio_addr; -struct pci_dev *pdev = tp->pci_dev; - -rtl_csi_access_enable_1 (tp); - -if (tp->dev->mtu <=ETH_DATA_LEN ) -rtl_tx_performance_tweak (pdev,0x5 <<MAX_READ_REQUEST_SHIFT ); - -RTL_W8 (MaxTxPacketSize, TxPacketMax); - -rtl_disable_clock_request (pdev); -} -static void rtl_hw_start_8168d_4 (struct rtl8169_private *tp) {void __iomem *ioaddr = tp->mmio_addr;
@@ -6271,11 +6256,8 @@ static void rtl_hw_start_8168(struct net_device *dev)break ;case RTL_GIGA_MAC_VER_28 : -rtl_hw_start_8168d_4 (tp); -break ; -case RTL_GIGA_MAC_VER_31 : -rtl_hw_start_8168dp (tp); +rtl_hw_start_8168d_4 (tp);break ;case RTL_GIGA_MAC_VER_32 :
Signature · 1 line
1.9.1
PATCH v2 5/8 r8169:update rtl8168dp pcie ephy parameters to improve power consumption
In reply to Chunhao LinThe following parameter will disable more pcie ephy block (like pcie ephy read/write clock.....etc ) to save more power when in aspm+clkreq mode.
{ 0x10, 0x0004, 0x0000 }
--- drivers/net/ethernet/realtek/r8169.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169.c +2 -1
@@ -5718,7 +5718,8 @@ static void rtl_hw_start_8168d_4(struct rtl8169_private *tp)static const struct ephy_info e_info_8168d_4[] = { {0x0b ,0x0000 ,0x0048 }, {0x19 ,0x0020 ,0x0050 }, - {0x0c ,0x0100 ,0x0020 } + {0x0c ,0x0100 ,0x0020 }, + {0x10 ,0x0004 ,0x0000 } };rtl_csi_access_enable_1 (tp);
Signature · 1 line
1.9.1
PATCH v2 6/8 r8169:update pcie ephy parameters to decrease the resume time from L0s to L0
In reply to Chunhao LinFor RTL8168EVL, RTL8168F, RTL8411, and RTL8105E, their pcie ephy will have bit error check reset after receive FTS and cause pcie ephy enter recovery mode. This will cause pcie ephy resume from L0s to L0 too slow.
This patch adjust the pcie ephy parameter to decrease the resume time from L0s to L0.
--- drivers/net/ethernet/realtek/r8169.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/ethernet/realtek/r8169.c +13 -6
@@ -5778,7 +5778,9 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp)struct pci_dev *pdev = tp->pci_dev;static const struct ephy_info e_info_8168e_2[] = { {0x09 ,0x0000 ,0x0080 }, - {0x19 ,0x0000 ,0x0224 } + {0x19 ,0x0000 ,0x0224 }, + {0x00 ,0x0000 ,0x0008 }, + {0x0c ,0x3df0 ,0x0200 } };rtl_csi_access_enable_1 (tp);
@@ -5850,7 +5852,9 @@ static void rtl_hw_start_8168f_1(struct rtl8169_private *tp) { 0x06, 0x00c0, 0x0020 }, { 0x08, 0x0001, 0x0002 }, { 0x09, 0x0000, 0x0080 }, - { 0x19, 0x0000, 0x0224 } + { 0x19, 0x0000, 0x0224 }, + { 0x00, 0x0000, 0x0008 }, + { 0x0c, 0x3df0, 0x0200 } };rtl_hw_start_8168f (tp);
@@ -5865,17 +5869,19 @@ static void rtl_hw_start_8168f_1(struct rtl8169_private *tp)static void rtl_hw_start_8411 (struct rtl8169_private *tp) { -static const struct ephy_info e_info_8168f_1[] = { +static const struct ephy_info e_info_8411[] = { {0x06 ,0x00c0 ,0x0020 }, {0x0f ,0xffff ,0x5200 }, {0x1e ,0x0000 ,0x4000 }, - {0x19 ,0x0000 ,0x0224 } + {0x19 ,0x0000 ,0x0224 }, + {0x00 ,0x0000 ,0x0008 }, + {0x0c ,0x3df0 ,0x0200 } };rtl_hw_start_8168f (tp);rtl_pcie_state_l2l3_enable (tp, false); -rtl_ephy_init (tp, e_info_8168f_1,ARRAY_SIZE (e_info_8168f_1)); +rtl_ephy_init (tp, e_info_8411,ARRAY_SIZE (e_info_8411));rtl_w0w1_eri (tp,0x0d4 ,ERIAR_MASK_0011 ,0x0c00 ,0x0000 ,ERIAR_EXGMAC ); }
@@ -6397,7 +6403,8 @@ static void rtl_hw_start_8105e_1(struct rtl8169_private *tp) { 0x03, 0, 0x0001 }, { 0x19, 0, 0x0100 }, { 0x19, 0, 0x0004 }, - { 0x0a, 0, 0x0020 } + { 0x0a, 0, 0x0020 }, + { 0x05, 0, 0x2000 } };/* Force LAN exit from ASPM if Rx/Tx are not idle */
Signature · 1 line
1.9.1
PATCH v2 7/8 r8169:update rtl8402 pcie ephy parameter
In reply to Chunhao LinRemove following unnecessary ephy parameter.
{ 0x1e, 0, 0x4000 }
--- drivers/net/ethernet/realtek/r8169.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/realtek/r8169.c +1 -2
@@ -6431,8 +6431,7 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp) {void __iomem *ioaddr = tp->mmio_addr;static const struct ephy_info e_info_8402[] = { - {0x19 ,0xffff ,0xff64 }, - {0x1e ,0 ,0x4000 } + {0x19 ,0xffff ,0xff64 } };rtl_csi_access_enable_2 (tp);
Signature · 1 line
1.9.1
PATCH v2 8/8 r8169:update rtl8168f rev.b pcie ephy parameter
In reply to Chunhao LinRTL8168F rev.B does not have to set following two ephy parameters.
{ 0x06, 0x00c0, 0x0020 }
{ 0x08, 0x0001, 0x0002 }
Add function rtl_hw_start_8168f_2 to set RTL8168F rev.B ephy parameters, instead of using function rtl_hw_start_8168f_1.
--- drivers/net/ethernet/realtek/r8169.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169.c +23 -1
@@ -5867,6 +5867,26 @@ static void rtl_hw_start_8168f_1(struct rtl8169_private *tp)RTL_W8 (EEE_LED ,RTL_R8 (EEE_LED ) & ~0x07 ); } +static void rtl_hw_start_8168f_2 (struct rtl8169_private *tp) +{ +void __iomem *ioaddr = tp->mmio_addr; +static const struct ephy_info e_info_8168f_2[] = { + {0x09 ,0x0000 ,0x0080 }, + {0x19 ,0x0000 ,0x0224 }, + {0x00 ,0x0000 ,0x0008 }, + {0x0c ,0x3df0 ,0x0200 } + }; + +rtl_hw_start_8168f (tp); + +rtl_ephy_init (tp, e_info_8168f_2,ARRAY_SIZE (e_info_8168f_2)); + +rtl_w0w1_eri (tp,0x0d4 ,ERIAR_MASK_0011 ,0x0c00 ,0xff00 ,ERIAR_EXGMAC ); + +/* Adjust EEE LED frequency */ +RTL_W8 (EEE_LED ,RTL_R8 (EEE_LED ) & ~0x07 ); +} +static void rtl_hw_start_8411 (struct rtl8169_private *tp) {static const struct ephy_info e_info_8411[] = {
@@ -6276,9 +6296,11 @@ static void rtl_hw_start_8168(struct net_device *dev)break ;case RTL_GIGA_MAC_VER_35 : -case RTL_GIGA_MAC_VER_36 :rtl_hw_start_8168f_1 (tp);break ; +case RTL_GIGA_MAC_VER_36 : +rtl_hw_start_8168f_2 (tp); +break ;case RTL_GIGA_MAC_VER_38 :rtl_hw_start_8411 (tp);
Signature · 1 line
1.9.1