e1000e: PHY loopback broken on 82578
Subsystems (2)
PATCH 1/6 e1000e: PHY loopback broken on 82578
From: Bruce Allan <[email protected]>
PHY loopback on 82578 fails to work as a result of flushing the packets in the FIFO buffer in the link stall workaround. Don't perform the workaround if in PHY loopback mode.
---
drivers/net/e1000e/defines.h | 2 ++ drivers/net/e1000e/phy.c | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/e1000e/defines.h +2 -0
@@ -575,6 +575,8 @@#define PHY_1000T_STATUS 0x0A/* 1000Base-T Status Reg */ #define PHY_EXT_STATUS 0x0F/* Extended Status Reg */ +#define PHY_CONTROL_LB 0x4000/* PHY Loopback bit */ +/* NVM Control */ #define E1000_EECD_SK 0x00000001/* NVM Clock */ #define E1000_EECD_CS 0x00000002/* NVM Chip Select */
drivers/net/e1000e/phy.c +5 -0
@@ -2737,6 +2737,11 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw)if (hw->phy.type != e1000_phy_82578) goto out; +/* Do not apply workaround if in PHY loopback bit 14 set */ + hw->phy.ops.read_phy_reg (hw,PHY_CONTROL , &data); +if (data &PHY_CONTROL_LB ) + goto out; +/* check if link is up and at 1Gbps */ ret_val = hw->phy.ops.read_phy_reg (hw,BM_CS_STATUS , &data);if (ret_val)
PATCH 2/6 e1000e: delay after LCD reset and proper checks for PHY configuration done
From: Bruce Allan <[email protected]>
A previous workaround for 82578 to avoid link stall causes some PHY registers to get cleared inadvertently. Add a delay after all LCD resets to make sure PHY registers are in a stable state before continuing. Also, after resets check the EEC register for the state of PHY configuration performed by the MAC for ICH9 and earlier parts (as done before), but check the LAN_INIT_DONE bit in the STATUS register for ICH10 and newer parts (EEC doesn't exist in these newer parts).
---
drivers/net/e1000e/defines.h | 1 drivers/net/e1000e/ich8lan.c | 125 +++++++++++++++++++++++++++--------------- 2 files changed, 82 insertions(+), 44 deletions(-)
drivers/net/e1000e/defines.h +1 -0
@@ -238,6 +238,7 @@#define E1000_STATUS_SPEED_100 0x00000040/* Speed 100Mb/s */ #define E1000_STATUS_SPEED_1000 0x00000080/* Speed 1000Mb/s */ #define E1000_STATUS_LAN_INIT_DONE 0x00000200/* Lan Init Completion by NVM */ +#define E1000_STATUS_PHYRA 0x00000400/* PHY Reset Asserted */ #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000/* Status of Master requests. */ /* Constants used to interpret the masked PCI-X bus speed. */
drivers/net/e1000e/ich8lan.c +81 -44
181 lines not on this page · raw message
PATCH 3/6 e1000e: do not write SmartSpeed register bits on parts without support
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
The driver was accessing register bits for features on parts that do not support that feature. This could cause problems in the hardware.
---
drivers/net/e1000e/ich8lan.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)
drivers/net/e1000e/ich8lan.c +15 -4
@@ -977,12 +977,14 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) phy_ctrl |=E1000_PHY_CTRL_D0A_LPLU ;ew32 (PHY_CTRL , phy_ctrl); +if (phy->type != e1000_phy_igp_3) +return 0 ; +/* * Call gig speed drop workaround on LPLU before accessing * any PHY registers */ -if ((hw->mac.type == e1000_ich8lan) && - (hw->phy.type == e1000_phy_igp_3)) +if (hw->mac.type == e1000_ich8lan)e1000e_gig_downshift_workaround_ich8lan (hw);/* When LPLU is enabled, we should disable SmartSpeed */
@@ -995,6 +997,9 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU ;ew32 (PHY_CTRL , phy_ctrl); +if (phy->type != e1000_phy_igp_3) +return 0 ; +/* * LPLU and SmartSpeed are mutually exclusive. LPLU is used * during Dx states where the power conservation is most
@@ -1054,6 +1059,10 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active)if (!active) { phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU ;ew32 (PHY_CTRL , phy_ctrl); + +if (phy->type != e1000_phy_igp_3) +return 0 ; +/* * LPLU and SmartSpeed are mutually exclusive. LPLU is used * during Dx states where the power conservation is most
@@ -1089,12 +1098,14 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) phy_ctrl |=E1000_PHY_CTRL_NOND0A_LPLU ;ew32 (PHY_CTRL , phy_ctrl); +if (phy->type != e1000_phy_igp_3) +return 0 ; +/* * Call gig speed drop workaround on LPLU before accessing * any PHY registers */ -if ((hw->mac.type == e1000_ich8lan) && - (hw->phy.type == e1000_phy_igp_3)) +if (hw->mac.type == e1000_ich8lan)e1000e_gig_downshift_workaround_ich8lan (hw);/* When LPLU is enabled, we should disable SmartSpeed */
PATCH 4/6 e1000e: prevent NVM corruption on sectors larger than 4K
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
Limit NVM writes to 4K sections to prevent NVM corruption on larger sector allocations (up to 64K).
---
drivers/net/e1000e/ich8lan.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
drivers/net/e1000e/ich8lan.c +17 -2
@@ -338,6 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) {struct e1000_nvm_info *nvm = &hw->nvm;struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; +union ich8_hws_flash_status hsfsts;u32 gfpreg;u32 sector_base_addr;u32 sector_end_addr;
@@ -374,6 +375,20 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)/* Adjust to word count */ nvm->flash_bank_size /=sizeof (u16); +/* +* Make sure the flash bank size does not overwrite the 4k +* sector ranges. We may have 64k allotted to us but we only care +* about the first 2 4k sectors. Therefore, if we have anything less +* than 64k set in the HSFSTS register, we will reduce the bank size +* down to 4k and let the rest remain unused. If berasesz == 3, then +* we are working in 64k mode. Otherwise we are not. +*/ +if (nvm->flash_bank_size >E1000_ICH8_SHADOW_RAM_WORDS ) { + hsfsts.regval =er16flash (ICH_FLASH_HSFSTS ); +if (hsfsts.hsf_status.berasesz !=3 ) + nvm->flash_bank_size =E1000_ICH8_SHADOW_RAM_WORDS ; + } + nvm->word_size =E1000_ICH8_SHADOW_RAM_WORDS ;/* Clear shadow ram */
@@ -1932,7 +1947,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)break ;case 1 : sector_size =ICH_FLASH_SEG_SIZE_4K ; - iteration = flash_bank_size /ICH_FLASH_SEG_SIZE_4K ; + iteration =1 ;break ;case 2 :if (hw->mac.type == e1000_ich9lan) {
@@ -1944,7 +1959,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)break ;case 3 : sector_size =ICH_FLASH_SEG_SIZE_64K ; - iteration = flash_bank_size /ICH_FLASH_SEG_SIZE_64K ; + iteration =1 ;break ;default :return -E1000_ERR_NVM ;
PATCH 5/6 e1000e: delay second read of PHY_STATUS register on failure of first read
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
Some PHYs may require two reads of the PHY_STATUS register to determine the link status. If the PHY is being accessed by another thread it is possible the first read could timeout and fail. In this case, put a delay in so the second read will pick up the correct link status.
---
drivers/net/e1000e/phy.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/net/e1000e/phy.c +6 -1
@@ -1531,7 +1531,12 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,*/ ret_val =e1e_rphy (hw,PHY_STATUS , &phy_status);if (ret_val) -break ; +/* +* If the first read fails, another entity may have +* ownership of the resources, wait and try again to +* see if they have relinquished the resources yet. +*/ +udelay (usec_interval); ret_val =e1e_rphy (hw,PHY_STATUS , &phy_status);if (ret_val)break ;
PATCH 6/6 e1000e: disable K1 at 1000Mbps for 82577/82578
In reply to Jeff KirsherFrom: Bruce Allan <[email protected]>
This workaround is required for an issue in hardware where noise on the interconnect between the MAC and PHY could be generated by a lower power mode (K1) at 1000Mbps resulting in bad packets. Disable K1 while at 1000 Mbps but keep it enabled for 10/100Mbps and when the cable is disconnected.
---
drivers/net/e1000e/hw.h | 4 ++ drivers/net/e1000e/ich8lan.c | 107 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/e1000e/lib.c | 6 -- 3 files changed, 110 insertions(+), 7 deletions(-)
drivers/net/e1000e/hw.h +4 -0
@@ -215,6 +215,7 @@ enum e1e_registers {E1000_SWSM =0x05B50 ,/* SW Semaphore */ E1000_FWSM =0x05B54 ,/* FW Semaphore */ E1000_SWSM2 =0x05B58 ,/* Driver-only SW semaphore */ +E1000_CRC_OFFSET =0x05F50 ,/* CRC Offset register */ E1000_HICR = 0x08F00, /* Host Interface Control */ };
@@ -302,6 +303,9 @@ enum e1e_registers {#define E1000_KMRNCTRLSTA_REN 0x00200000#define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3/* Kumeran Diagnostic */ #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000/* Nearend Loopback mode */ +#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 +#define E1000_KMRNCTRLSTA_K1_ENABLE 0x140E +#define E1000_KMRNCTRLSTA_K1_DISABLE 0x1400#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10#define IFE_PHY_SPECIAL_CONTROL 0x11/* 100BaseTx PHY Special Control */
drivers/net/e1000e/ich8lan.c +106 -1
131 lines not on this page · raw message
drivers/net/e1000e/lib.c +0 -6
@@ -378,12 +378,6 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw) mac->get_link_status =0 ; -if (hw->phy.type == e1000_phy_82578) { - ret_val =e1000_link_stall_workaround_hv (hw); -if (ret_val) -return ret_val; - } -/* * Check if there was DownShift, must be checked * immediately after link-up
David Miller
maintainerAll 6 patches applied, thanks!